WhatsApp API otp - nxtele/nxcloud-doc-en GitHub Wiki
Send Otp Message
Initiate WhatsApp number message sending service through the API.
- URL:
https://api2.nxcloud.com/api/wa/otp
- Method:
POST
- Content-Type:
application/json
- Requires authentication: Yes
Authentication Mechanism
Please refer to the following link for authentication rules: API Interface Call Convention
Request Parameters
Header Parameters:
Parameter Name |
Type |
Required |
Example |
Description |
accessKey |
String |
Yes |
fme2na3kdi3ki |
User identity identifier |
ts |
String |
Yes |
1655710885431 |
Current timestamp of the request (in milliseconds). The maximum allowed time difference is 60 seconds on the server side. |
bizType |
String |
Yes |
2 |
WhatsApp business type, fixed value "2" |
action |
String |
Yes |
mt |
WhatsApp business operation, fixed value "mt" |
sign |
String |
Yes |
6e9506557d1f289501d333ee2c365826 |
API input parameter signature, signature algorithm |
Body Parameters:
Parameter Name |
Type |
Required |
Example |
Description |
appkey |
String |
Yes |
|
Appkey of the NxCloud WhatsApp application |
business_phone |
String |
Yes |
86158xxxx1795 |
WhatsApp number of the message sender, including country code. e.g., 86158xxxx1795 |
messaging_product |
String |
Yes |
whatsapp |
Channel for sending messages, must be "whatsapp" when sending WhatsApp messages |
recipient_type |
String |
Yes |
individual |
Type of message recipient, must be "individual" when sending WhatsApp messages |
to |
String |
Yes |
86158xxxx1795 |
WhatsApp number of the message recipient, including country code. e.g., 86158xxxx1795 |
category |
String |
否 |
AUTHENTICATION |
If the template type, AUTHENTICATION or UTILITY, is empty, it defaults to AUTHENTICATION. |
content |
String |
是 |
189384 |
The content of the sent message contains a verification code, which consists of 4 to 8 consecutive digits. If there are other characters, the verification code will be extracted. |
language_code |
String |
是 |
en |
Send using the specified template language. |
cus_message_id |
String |
No |
wamid.HBgLODUyNTUzMTE3MDUVAgARGBI |
Custom message ID. It will be returned as the message ID in both the message submission success and status callback. Please ensure it is globally unique. |
dr_webhook |
String |
No |
https://test.com/webhook |
The message status callback will be pushed to this URL first. If not provided, it will be pushed to the app webhook. The HTTP status code returned by the webhook interface must be 200. |
api_type |
int |
No |
0 |
API type. 0 represents Cloud API, 1 represents MM Lite API. If not provided, the default is 0. |
Request Example
Body (application/json) parameters:
{
"appkey": "qlQxxxxCM5",
"messaging_product": "whatsapp",
"recipient_type": "individual",
"to": "xxxx7446",
"cus_message_id": "mmuud333dtee003444",
"dr_webhook": "https://webhook.site/24b22cdd-bfa8-4ad2-aa3f-d2b9d510c9d9",
"language_code": "en",
"content": "789033"
}
Response Example
Successful Example
{
"code": 0,
"data": {
"messaging_product": "whatsapp",
"messages": [
{
"id": "gBGHhhdgYFCBnwIJ6QRYvhwQk7Nc"
}
]
},
"message": "Request successful"
}
Failed Example
NxCloud Failure
{
"code": -1,
"message": "Request failed",
"data": null
}
Meta Failure
{
"code": 9099,
"message": "WhatsApp error",
"data":{
"error":{
"code":100,
"message":"(#100) Invalid parameter",
"type":"OAuthException",
"fbtrace_id":"AmCuD7sOjcEDetBNhlT2cJm",
"error_data":{
"messaging_product":"whatsapp",
"details":"Invalid parameter"
}
}
}
}
Response Code Explanation
code |
message |
Solution |
0 |
Request successful |
|
-1 |
Request failed |
NxCloud failure, please contact technical support to troubleshoot the issue |
1000~100X |
Authentication issue |
NxCloud failure, refer to the API authentication section for details |
9000 |
Parameter exception |
NxCloud failure, missing parameters, please check the required parameters |
9001 |
System business error |
NxCloud failure, please contact technical support to troubleshoot the issue |
9002 |
Merchant phone number error |
NxCloud failure, please confirm if the merchant number belongs to a WhatsApp number |
9003 |
Application does not exist/unavailable |
NxCloud failure, please contact business personnel to handle the creation/disabling of the cloud platform application |
9004 |
No corresponding country pricing for the application |
NxCloud failure, please contact business personnel to handle the application pricing issue |
9013 |
Customer APP does not have group |
Customer APP does not have group |
9014 |
Category does not exist |
Category does not exist |
9015 |
Content does not extract otp code |
Content does not extract otp code |
10003 |
WhatsApp business phone is not bind app |
The WhatsApp number is not linked to the application. Please contact the business representative to handle the application and phone number binding. |
10005 |
WhatsApp Template does not exist or low quality |
The template does not exist or has been suspended. |
Template Languages
Language |
Code |
|
Language |
Code |
|
Language |
Code |
Afrikaans |
af |
|
Greek |
el |
|
Portuguese (BR) |
pt_BR |
Albanian |
sq |
|
Gujarati |
gu |
|
Portuguese (POR) |
pt_PT |
Arabic |
ar |
|
Hebrew |
he |
|
Punjabi |
pa |
Azerbaijani |
az |
|
Hindi |
hi |
|
Romanian |
ro |
Bengali |
bn |
|
Hungarian |
hu |
|
Russian |
ru |
Bulgarian |
bg |
|
Indonesian |
id |
|
Serbian |
sr |
Catalan |
ca |
|
Irish |
ga |
|
Slovak |
sk |
Chinese (CHN) |
zh_CN |
|
Italian |
it |
|
Slovenian |
sl |
Chinese (HKG) |
zh_HK |
|
Japanese |
ja |
|
Spanish |
es |
Chinese (TAI) |
zh_TW |
|
Kannada |
kn |
|
Spanish (ARG) |
es_AR |
Croatian |
hr |
|
Kazakh |
kk |
|
Spanish (SPA) |
es_ES |
Czech |
cs |
|
Korean |
ko |
|
Spanish (MEX) |
es_MX |
Danish |
da |
|
Lao |
lo |
|
Swahili |
sw |
Dutch |
nl |
|
Latvian |
lv |
|
Swedish |
sv |
English |
en |
|
Lithuanian |
lt |
|
Tamil |
ta |
English (UK) |
en_GB |
|
Macedonian |
mk |
|
Telugu |
te |
English (US) |
en_US |
|
Malay |
ms |
|
Thai |
th |
Estonian |
et |
|
Marathi |
mr |
|
Turkish |
tr |
Filipino |
fil |
|
Norwegian |
nb |
|
Ukrainian |
uk |
Finnish |
fi |
|
Persian |
fa |
|
Urdu |
ur |
French |
fr |
|
Polish |
pl |
|
Uzbek |
uz |
German |
de |
|
|
|
|
Vietnamese |
vi |