DecisionTelecom WhatsApp API allows you to send and receive WhatsApp business messages to and from any country in the world via API. Each message is identified by a unique random ID, so users can always check the status of a message using given endpoint.
The WhatsApp API uses HTTPS with access key that is used as the API authorization. Request and response payloads are formatted as JSON using UTF-8 encoding.
API Authorization - Base64 access key.
Please contact your account manager to get an API key.
{"source_addr":"Custom Company","destination_addr":8882222200,"message_type":1,"text":"Message content","file_url":"https://yourdomain.com/images/image.jpg",// file extension is a mandatory attribute"callback_url":"https://yourdomain.com/whatsapp-callback","template_name":"image_tmp_en","template_params":"{ "to": "recipient_wa_id", "type": "template", "template": { "namespace": "your-namespace", "language": { "policy": "deterministic", "code": "your-language-and-locale-code" }, "name": "your-template-name", "components": [ { "type" : "header", "parameters": [ // The following parameters code example includes several different possible header types, // not all are required for a media message template API call. { "type": "text", "text": "replacement_text" } // OR { "type": "image", "image": { "link": "http(s)://the-url", # provider is an optional parameter"provider": {"name":"provider-name" }, } } ]// end header }, {"type":"body","parameters": [ {"type":"text","text":"replacement_text" }, {// Any additional template parameters } ] // end body }, ] } }" }
source_addr:
<= 20 chars - from whom the message
destination_addr:
<= 20 chars - to whom the message
message_type:
Type of message to be sent:
1 text message
2 message with media data (jpg, jpeg or png images)
4 message based on registered template
text:
<= 4096 chars - text of WhatsApp message
file_url:
Correct URL with image for media message. Correct file extensions:
jpg or jpeg (mime type is image/jpeg)
png (mime type is image/png)
callback_url:
Correct URL for message status callback
template_name:
Registered template name (only for template message)
template_params:
JSON data of all the necessary parameters to send a template message.
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://web.it-decision.com/v1/api/send-whatsapp");
request.Headers.Add("Authorization", "Basic api key");
var content = new StringContent(" {\"to\":\"38063xxxxxxx\",\"type\":\"template\",\"template\":{\"namespace\":\"xxxxx_xxxx_xxx_xxx_xxxxx\",\"language\":{\"policy\":\"deterministic\",\"code\":\"en_US\"},\"name\":\"media_2_english\",\"components\":[{\"type\":\"header\",\"parameters\":[{\"type\":\"image\",\"image\":{\"link\":\"url image.jpg\"}}]}]}}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
The server encountered an unexpected condition which prevented it from fulfilling the request
code
2
status
500
message
User balance is empty
code
3
status
402
message
The server encountered an unexpected condition which prevented it from fulfilling the request
code
4, // 5 and 6
status
500
message
Message failed to send because more than 24 hours have passed since the customer last replied to this number. In this case, you can only send a template message