WhatsApp Channel
Request the OTP
Finds the user of your company with this WhatsApp number and sends them an OTP by SMS and email (never by WhatsApp). Keep challengeId for Verify the OTP. Limits per number: one code every 30 seconds and 5 per hour.
Authentication
Authorization: Bearer <channel token>, from POST /api/v1/channel/token. The user token is not accepted here.
Production
Available in test today. In production these calls go to https://partners-api.kravata.co with your mTLS client certificate; ask your Kravata point of contact before going live.
See the WhatsApp channel guide for the full flow.
Errors
| Status | Code | Meaning |
|---|---|---|
| 400 | INVALID_WA_ID | waId is not a phone number. |
| 403 | CHANNEL_DISABLED | The channel is not enabled for your company. |
| 404 | USER_NOT_FOUND | No user of your company has this phone. |
| 409 | AMBIGUOUS_PHONE | More than one user has this phone. |
| 429 | OTP_RESEND_COOLDOWN | Less than 30 seconds since the last code. |
| 429 | TOO_MANY_OTP_REQUESTS | 5 codes in the last hour. |
| 502 | OTP_DELIVERY_FAILED | The code could not be sent. |
POST
/
api
/
v1
/
channel
/
whatsapp
/
session
/
request
Request the OTP
curl --request POST \
--url https://test-api-kore.kravata.co/api/v1/channel/whatsapp/session/request \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"waId": "573001234567"
}
'import requests
url = "https://test-api-kore.kravata.co/api/v1/channel/whatsapp/session/request"
payload = { "waId": "573001234567" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({waId: '573001234567'})
};
fetch('https://test-api-kore.kravata.co/api/v1/channel/whatsapp/session/request', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://test-api-kore.kravata.co/api/v1/channel/whatsapp/session/request",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'waId' => '573001234567'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://test-api-kore.kravata.co/api/v1/channel/whatsapp/session/request"
payload := strings.NewReader("{\n \"waId\": \"573001234567\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://test-api-kore.kravata.co/api/v1/channel/whatsapp/session/request")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"waId\": \"573001234567\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://test-api-kore.kravata.co/api/v1/channel/whatsapp/session/request")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"waId\": \"573001234567\"\n}"
response = http.request(request)
puts response.read_body{
"challengeId": "<string>",
"channels": [
"<string>"
],
"expiresIn": 300
}Authorizations
Access token from POST /api/v1/client/token.
Body
application/json
The user's WhatsApp number as WhatsApp sends it: country code, no +.
Example:
"573001234567"
Request the OTP
curl --request POST \
--url https://test-api-kore.kravata.co/api/v1/channel/whatsapp/session/request \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"waId": "573001234567"
}
'import requests
url = "https://test-api-kore.kravata.co/api/v1/channel/whatsapp/session/request"
payload = { "waId": "573001234567" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({waId: '573001234567'})
};
fetch('https://test-api-kore.kravata.co/api/v1/channel/whatsapp/session/request', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://test-api-kore.kravata.co/api/v1/channel/whatsapp/session/request",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'waId' => '573001234567'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://test-api-kore.kravata.co/api/v1/channel/whatsapp/session/request"
payload := strings.NewReader("{\n \"waId\": \"573001234567\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://test-api-kore.kravata.co/api/v1/channel/whatsapp/session/request")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"waId\": \"573001234567\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://test-api-kore.kravata.co/api/v1/channel/whatsapp/session/request")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"waId\": \"573001234567\"\n}"
response = http.request(request)
puts response.read_body{
"challengeId": "<string>",
"channels": [
"<string>"
],
"expiresIn": 300
}
