Send OTP
curl --request POST \
--url https://api.dojah.io/api/v1/messaging/otp \
--header 'AppId: <appid>' \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"sender_id": "<string>",
"destination": "<string>",
"channel": "<string>",
"length": {},
"priority": true
}
'import requests
url = "https://api.dojah.io/api/v1/messaging/otp"
payload = {
"sender_id": "<string>",
"destination": "<string>",
"channel": "<string>",
"length": {},
"priority": True
}
headers = {
"AppId": "<appid>",
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
AppId: '<appid>',
Authorization: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
sender_id: '<string>',
destination: '<string>',
channel: '<string>',
length: {},
priority: true
})
};
fetch('https://api.dojah.io/api/v1/messaging/otp', 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://api.dojah.io/api/v1/messaging/otp",
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([
'sender_id' => '<string>',
'destination' => '<string>',
'channel' => '<string>',
'length' => [
],
'priority' => true
]),
CURLOPT_HTTPHEADER => [
"AppId: <appid>",
"Authorization: <api-key>",
"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://api.dojah.io/api/v1/messaging/otp"
payload := strings.NewReader("{\n \"sender_id\": \"<string>\",\n \"destination\": \"<string>\",\n \"channel\": \"<string>\",\n \"length\": {},\n \"priority\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("AppId", "<appid>")
req.Header.Add("Authorization", "<api-key>")
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://api.dojah.io/api/v1/messaging/otp")
.header("AppId", "<appid>")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"sender_id\": \"<string>\",\n \"destination\": \"<string>\",\n \"channel\": \"<string>\",\n \"length\": {},\n \"priority\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dojah.io/api/v1/messaging/otp")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["AppId"] = '<appid>'
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"sender_id\": \"<string>\",\n \"destination\": \"<string>\",\n \"channel\": \"<string>\",\n \"length\": {},\n \"priority\": true\n}"
response = http.request(request)
puts response.read_body{
"entity": [
{
"reference_id": "fd2a5c3c-f62f-484d-bc19-410f3483c6f6",
"destination": "09098377027",
"status_id": "dj_e2f21121-feee-3740-854f-8bb2db378fe1",
"status": "whatsapp/voice/sms OTP sent successfully "
}
]
}
{
"error": "Invalid request parameters"
}
{
"error": "App Couldn't be Validated"
}
Send OTP
POST
/
api
/
v1
/
messaging
/
otp
Send OTP
curl --request POST \
--url https://api.dojah.io/api/v1/messaging/otp \
--header 'AppId: <appid>' \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"sender_id": "<string>",
"destination": "<string>",
"channel": "<string>",
"length": {},
"priority": true
}
'import requests
url = "https://api.dojah.io/api/v1/messaging/otp"
payload = {
"sender_id": "<string>",
"destination": "<string>",
"channel": "<string>",
"length": {},
"priority": True
}
headers = {
"AppId": "<appid>",
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
AppId: '<appid>',
Authorization: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
sender_id: '<string>',
destination: '<string>',
channel: '<string>',
length: {},
priority: true
})
};
fetch('https://api.dojah.io/api/v1/messaging/otp', 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://api.dojah.io/api/v1/messaging/otp",
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([
'sender_id' => '<string>',
'destination' => '<string>',
'channel' => '<string>',
'length' => [
],
'priority' => true
]),
CURLOPT_HTTPHEADER => [
"AppId: <appid>",
"Authorization: <api-key>",
"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://api.dojah.io/api/v1/messaging/otp"
payload := strings.NewReader("{\n \"sender_id\": \"<string>\",\n \"destination\": \"<string>\",\n \"channel\": \"<string>\",\n \"length\": {},\n \"priority\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("AppId", "<appid>")
req.Header.Add("Authorization", "<api-key>")
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://api.dojah.io/api/v1/messaging/otp")
.header("AppId", "<appid>")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"sender_id\": \"<string>\",\n \"destination\": \"<string>\",\n \"channel\": \"<string>\",\n \"length\": {},\n \"priority\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dojah.io/api/v1/messaging/otp")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["AppId"] = '<appid>'
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"sender_id\": \"<string>\",\n \"destination\": \"<string>\",\n \"channel\": \"<string>\",\n \"length\": {},\n \"priority\": true\n}"
response = http.request(request)
puts response.read_body{
"entity": [
{
"reference_id": "fd2a5c3c-f62f-484d-bc19-410f3483c6f6",
"destination": "09098377027",
"status_id": "dj_e2f21121-feee-3740-854f-8bb2db378fe1",
"status": "whatsapp/voice/sms OTP sent successfully "
}
]
}
{
"error": "Invalid request parameters"
}
{
"error": "App Couldn't be Validated"
}
What is an OTP?
OTP means One Time Password. It is an automatically generated numeric or alphanumeric string of characters that authenticates a user for transactions. Send OTP endpoint will deliver OTPs to your users via SMS, WhatsApp or Voice Channels.Application ID from dashboard
BODY PARAMS
Registered Sender ID
Mobile number to receive message. Multiple numbers should be separated by comma
Either or any of the following can be used. sms, whatsapp,voice
Length of token should be between 4-10 digits which is optional
Indicate if you want to send with the priority mode. Default is false
RESPONSES
json
{
"entity": [
{
"reference_id": "fd2a5c3c-f62f-484d-bc19-410f3483c6f6",
"destination": "09098377027",
"status_id": "dj_e2f21121-feee-3740-854f-8bb2db378fe1",
"status": "whatsapp/voice/sms OTP sent successfully "
}
]
}
{
"error": "Invalid request parameters"
}
{
"error": "App Couldn't be Validated"
}
Was this page helpful?
⌘I