Our Whatsapp Messaging API designed to fulfill most of your use cases and can be easily integrate to any of the system. We can implement business-initiated and userinitiated message.
POST
/whatsapp/v1/send
Authentication
AUTHORIZATION: Bearer Token
Request parameters
Parameter
Value / Pattern
*originator
The Phone number of Sender/Header of a message. We can use your mobile number that is registered and approved.
*recipients
Mobile Numbers to send Whatsapp seperated by comma in an array. The recipient's phone number should have a country code prefix.
*content
Details of the content object.
report_url
To receive delivery status (DLR) for your message, specify the callback server URL where you want to receive the message status updates using the report_url parameter. When the delivery status changes, the status updates will be sent to the specified URL. For information on the format of the DLR message, please refer to the "Receiving DLR" section.
Content object
Parameter
Value / Pattern
preview_url
Allows for URL previews in text messages. By default, the mobile WhatsApp application recognizes URLs and makes them clickable. Values: false (default), true.
*message_type
Type of the message inside the content. Valid values: TEXT, ATTACHMENT, LOCATION, CONTACTS, TEMPLATE.
*message_text
Text content users want to send, which can contain URLs and formatting. This field is reqiured if the message type is TEXT.
*attachment
Details of the attachment object. This field is reqiured if the message type is ATTACHMENT.
*location
Details of the location object. This field is reqiured if the message type is LOCATION.
*contact
Details of the contact object. This field is reqiured if the message type is CONTACTS.
*interactive
Details of the interactive object. This field is reqiured if the message type is INTERACTIVE.
*template
Details of the template object. This field is reqiured if the message type is TEMPLATE.
Attachment object
Parameter
Value / Pattern
*attachment_type
Type of the attachment you want to send. You can send: image, audio, document, video.
*attachment_url
URL for the attachment. The protocol and URL of the media to be sent. Use only with HTTP/HTTPS URL.
attachment_caption
Caption for the attachment.
attachment_mime_type
You can send attachments without using a URL by specifying the MIME type and attachment data. For images: image/png and image/jpeg, for documents: application/pdf, and for audio: audio/mpeg and audio/wav are supported.
attachment_data
String contains attachment binary data of Base64 encoded.
Location object
Parameter
Value / Pattern
*longitude
Longitude of the Location you wants to send.
*latitude
Longitude of the Location you wants to send.
name
Name of the Location you wants to send.
address
Address of the Location you wants to send. Only displayed if the name is present.
Contact Object
Parameter
Value / Pattern
*first_name
First name of the contact you wants to send.
*last_name
Last name of the contact you wants to send.
display_name
Display the name of the contact you wants to send.
*phone
Phone nnumber of the contact you wants to send.
email
Email ID of the contact you wants to send.
url
URL for the contact you wants to send.
Interactive Object
Parameter
Value / Pattern
*type
The type of interactive message you want to send. Supported values: button, list
*body
An object with the body of the message. The body object contains text field. Its required if body is present. The content of the message. Emojis and markdown are supported. Maximum length: 1024 characters.
footer
Optional. An object with the footer of the message. The footer object contains text field. Required if footer is present. The footer content. Emojis, markdown, and links are supported. Maximum length: 60 characters.
header
Optional. Header content displayed on top of a message.
*action
Action you want the user to perform after reading the message.
Header Object
Parameter
Value / Pattern
type
The header type you would like to use. Supported values: text- Used for List Messages & Reply Buttons, video- Used for Reply Buttons, image- Used for Reply Buttons, document- Used for Reply Buttons.
document
Required if type is set to document. Contains the media object for this document- filename, link.
image
Required if type is set to image. Contains the media object for this image- link.
text
Required if type is set to text. Text for the header. Formatting allows emojis, but not markdown. Maximum length: 60 characters.
video
Required if type is set to video. Contains the media object for this video- link
Action Object - List
Parameter
Value / Pattern
button
Required. It cannot be an empty string and must be unique within the message. Emojis are supported, markdown is not. Maximum length: 20 characters.
sections
Required. Array of section objects. Minimum of 1, maximum of 10. A section object can contain following parameters, title - Required if the message has more than one section. Title of the section. Maximum length: 24 characters. rows - Contains a list of rows. You can have a total of 10 rows across your sections. Each row must have a title (Maximum length: 24 characters) and an ID (Maximum length: 200 characters). You can add a description (Maximum length: 72 characters), but it is optional.
Action Object - Button
Parameter
Value / Pattern
buttons
Required for Reply Buttons. You can have up to 3 buttons. You cannot have leading or trailing spaces when setting the ID. A button object can contain the following parameters: type: only supported type is reply (for Reply Button) title: Button title. It cannot be an empty string and must be unique within the message. Emojis are supported, markdown is not. Maximum length: 20 characters. id: Unique identifier for your button. This ID is returned in the webhook when the button is clicked by the user. Maximum length: 256 characters.
Template object
Parameter
Value / Pattern
*template_id
Template ID configured for WhatsApp template (HSM). This should be registed and approved by D7. You can create a new Whatsapp Templatehere
*body_parameter_values
The Object of the body parameter values. Only required if your body text have varibles.
*media
Details of the media object.
*buttons
Details of the button object.
Media object
Parameter
Value / Pattern
*media_type
Type of the attachment you want to send through your template. Valid: image, audio, document, video
*media_url
URL for the attachment. Required except the media type is location.
media_caption
Caption for the attachment.
document_file_name
Describes the filename for the specific document. Only required if the media type is document
*text_header_title
Message content if you have a header section in your message. It is only required if the media type is Text.
*location
Details of the location object.
media_mime_type
You can send attachments without using a URL by specifying the MIME type and attachment data. For images: image/png and image/jpeg, for documents: application/pdf, and for audio: audio/mpeg and audio/wav are supported.
media_attachment_data
String contains attachment binary data of Base64 encoded.
Button object
Parameter
Value / Pattern
*quick_replies
List of quick_replies button object. This is required if you wants to add quick reply buttons in your message.
*actions
Tist of actions button object. This is required if you wants to add call to action buttons in your message.
Quick Reply Button object
Parameter
Value / Pattern
*button_index
Position index of the button. Required if you have quick reply in your template.
*button_payload
Developer-defined payload that will be returned when the button is clicked.
Call to Action Button object
Parameter
Value / Pattern
*action_type
Type of action that whats to do while clicking the button. It includes Dial and URL.
*action_index
Position index of the button. Required if you have either url or dial button in your template.
*action_payload
Developer-defined payload that will be returned when the button is clicked. For Dial Its a phone number and For URL it is a url.
Response
When the request is validated, request_id, status and created time will be returned. Users can use this request_id to
query status using the Get status endpoint.
{"detail":{"code":"ACCESS_TOKEN_SIGNATURE_VERIFICATION_FAILED","message":"It looks like your requests were failed due to a missing or invalid 'Access Token'. Sign up at https://app.d7networks.com and create an authentication token in the developer section."}}
<?php$curl=curl_init();$token={{api_access_token}};// Replace it with your API Token$originator={{originator}};// Replace it with your Sender ID$template_id={{template_id}}$recipients=array({{recipient1}},{{recipient2}});// Replace it with real recipients$body_parameter_values=array("0":"first_parameter_in_your_template","1":"second_parameter_in_your_template")$template=array("template_id"=>$template_id,"body_parameter_values"=>$body_parameter_values);$content=array("message_type"=>"TEMPLATE","template"=>$template);// Replace it with message content$message_obj=array("originator"=>$originator,"recipients"=>$recipients,"content"=>$content,"report_url"=>"https://the_url_to_recieve_delivery_report.com");$payload=json_encode(array("messages"=>array($message_obj)));curl_setopt_array($curl,array(CURLOPT_URL=>'https://api.d7networks.com/whatsapp/v1/send',CURLOPT_RETURNTRANSFER=>true,CURLOPT_ENCODING=>'',CURLOPT_MAXREDIRS=>10,CURLOPT_TIMEOUT=>0,CURLOPT_FOLLOWLOCATION=>true,CURLOPT_HTTP_VERSION=>CURL_HTTP_VERSION_1_1,CURLOPT_CUSTOMREQUEST=>'POST',CURLOPT_POSTFIELDS=>$payload,CURLOPT_HTTPHEADER=>array('Content-Type: application/json','Accept: application/json','Authorization: Bearer '.$token),));$response=curl_exec($curl);curl_close($curl);echo$response;// Add custom code to save the response in database and use it later to track the delivery report?>
<?php$curl=curl_init();$token={{api_access_token}};// Replace it with your API Token$originator={{originator}};// Replace it with your Sender ID$template_id={{template_id}}$recipients=array({{recipient1}},{{recipient2}});// Replace it with real recipients$body_parameter_values=array("0":"first_parameter_in_your_template","1":"second_parameter_in_your_template")$media=array("media_type"=>"image""media_url"=>"https://miro.medium.com/max/780/1*9Wdo1PuiJTZo0Du2A9JLQQ.jpeg")$template=array("template_id"=>$template_id,"media"=>$media"body_parameter_values"=>$body_parameter_values);$content=array("message_type"=>"TEMPLATE","template"=>$template);// Replace it with message content$message_obj=array("originator"=>$originator,"recipients"=>$recipients,"content"=>$content,"report_url"=>"https://the_url_to_recieve_delivery_report.com");$payload=json_encode(array("messages"=>array($message_obj)));curl_setopt_array($curl,array(CURLOPT_URL=>'https://api.d7networks.com/whatsapp/v1/send',CURLOPT_RETURNTRANSFER=>true,CURLOPT_ENCODING=>'',CURLOPT_MAXREDIRS=>10,CURLOPT_TIMEOUT=>0,CURLOPT_FOLLOWLOCATION=>true,CURLOPT_HTTP_VERSION=>CURL_HTTP_VERSION_1_1,CURLOPT_CUSTOMREQUEST=>'POST',CURLOPT_POSTFIELDS=>$payload,CURLOPT_HTTPHEADER=>array('Content-Type: application/json','Accept: application/json','Authorization: Bearer '.$token),));$response=curl_exec($curl);curl_close($curl);echo$response;// Add custom code to save the response in database and use it later to track the delivery report?>
<?php$curl=curl_init();$token={{api_access_token}};// Replace it with your API Token$originator={{originator}};// Replace it with your Sender ID$template_id={{template_id}}$recipients=array({{recipient1}},{{recipient2}});// Replace it with real recipients$body_parameter_values=array("0":"first_parameter_in_your_template","1":"second_parameter_in_your_template")$media=array("media_type"=>"image""media_url"=>"https://miro.medium.com/max/780/1*9Wdo1PuiJTZo0Du2A9JLQQ.jpeg")$buttons=array("quick_replies":[{"button_index":"0","button_payload":"ButtonText"},{"button_index":"1","button_payload":"ButtonText"}])$template=array("template_id"=>$template_id,"media"=>$media"body_parameter_values"=>$body_parameter_values"buttons"=>$buttons);$content=array("message_type"=>"TEMPLATE","template"=>$template);// Replace it with message content$message_obj=array("originator"=>$originator,"recipients"=>$recipients,"content"=>$content,"report_url"=>"https://the_url_to_recieve_delivery_report.com");$payload=json_encode(array("messages"=>array($message_obj)));curl_setopt_array($curl,array(CURLOPT_URL=>'https://api.d7networks.com/whatsapp/v1/send',CURLOPT_RETURNTRANSFER=>true,CURLOPT_ENCODING=>'',CURLOPT_MAXREDIRS=>10,CURLOPT_TIMEOUT=>0,CURLOPT_FOLLOWLOCATION=>true,CURLOPT_HTTP_VERSION=>CURL_HTTP_VERSION_1_1,CURLOPT_CUSTOMREQUEST=>'POST',CURLOPT_POSTFIELDS=>$payload,CURLOPT_HTTPHEADER=>array('Content-Type: application/json','Accept: application/json','Authorization: Bearer '.$token),));$response=curl_exec($curl);curl_close($curl);echo$response;// Add custom code to save the response in database and use it later to track the delivery report?>
<?php$curl=curl_init();$token={{api_access_token}};// Replace it with your API Token$originator={{originator}};// Replace it with your Sender ID$template_id={{template_id}}$recipients=array({{recipient1}},{{recipient2}});// Replace it with real recipients$contact=array("first_name":"FirstName","last_name":"SecondName","display_name":"DisplayName","phone":"PhoneNumber","email":"EmailAddress","url":"Url");$content=array("message_type"=>"CONTACTS","template"=>$contact);// Replace it with message content$message_obj=array("originator"=>$originator,"recipients"=>$recipients,"content"=>$content,"report_url"=>"https://the_url_to_recieve_delivery_report.com");$payload=json_encode(array("messages"=>array($message_obj)));curl_setopt_array($curl,array(CURLOPT_URL=>'https://api.d7networks.com/whatsapp/v1/send',CURLOPT_RETURNTRANSFER=>true,CURLOPT_ENCODING=>'',CURLOPT_MAXREDIRS=>10,CURLOPT_TIMEOUT=>0,CURLOPT_FOLLOWLOCATION=>true,CURLOPT_HTTP_VERSION=>CURL_HTTP_VERSION_1_1,CURLOPT_CUSTOMREQUEST=>'POST',CURLOPT_POSTFIELDS=>$payload,CURLOPT_HTTPHEADER=>array('Content-Type: application/json','Accept: application/json','Authorization: Bearer '.$token),));$response=curl_exec($curl);curl_close($curl);echo$response;// Add custom code to save the response in database and use it later to track the delivery report?>
<?php$curl=curl_init();$token={{api_access_token}};// Replace it with your API Token$originator={{originator}};// Replace it with your Sender ID$template_id={{template_id}}$recipients=array({{recipient1}},{{recipient2}});// Replace it with real recipients$location=array("longitude":77.1249,"latitude":12.8779,"name":"NameOfLocation","address":"AddressOfLocation");$content=array("message_type"=>"LOCATION","location"=>$location);// Replace it with message content$message_obj=array("originator"=>$originator,"recipients"=>$recipients,"content"=>$content,"report_url"=>"https://the_url_to_recieve_delivery_report.com");$payload=json_encode(array("messages"=>array($message_obj)));curl_setopt_array($curl,array(CURLOPT_URL=>'https://api.d7networks.com/whatsapp/v1/send',CURLOPT_RETURNTRANSFER=>true,CURLOPT_ENCODING=>'',CURLOPT_MAXREDIRS=>10,CURLOPT_TIMEOUT=>0,CURLOPT_FOLLOWLOCATION=>true,CURLOPT_HTTP_VERSION=>CURL_HTTP_VERSION_1_1,CURLOPT_CUSTOMREQUEST=>'POST',CURLOPT_POSTFIELDS=>$payload,CURLOPT_HTTPHEADER=>array('Content-Type: application/json','Accept: application/json','Authorization: Bearer '.$token),));$response=curl_exec($curl);curl_close($curl);echo$response;// Add custom code to save the response in database and use it later to track the delivery report?>
<?php$curl=curl_init();$token={{api_access_token}};// Replace it with your API Token$originator={{originator}};// Replace it with your Sender ID$template_id={{template_id}}$recipients=array({{recipient1}},{{recipient2}});// Replace it with real recipients$body_parameter_values=array("0":"first_parameter_in_your_template","1":"second_parameter_in_your_template")$attachment=array("attachment_type":"video","attachment_url":"AttachmnetUrl","attachment_caption":"AttachmentCaption");$content=array("message_type"=>"ATTACHMENT","attachment"=>$attachment);// Replace it with message content$message_obj=array("originator"=>$originator,"recipients"=>$recipients,"content"=>$content,"report_url"=>"https://the_url_to_recieve_delivery_report.com");$payload=json_encode(array("messages"=>array($message_obj)));curl_setopt_array($curl,array(CURLOPT_URL=>'https://api.d7networks.com/whatsapp/v1/send',CURLOPT_RETURNTRANSFER=>true,CURLOPT_ENCODING=>'',CURLOPT_MAXREDIRS=>10,CURLOPT_TIMEOUT=>0,CURLOPT_FOLLOWLOCATION=>true,CURLOPT_HTTP_VERSION=>CURL_HTTP_VERSION_1_1,CURLOPT_CUSTOMREQUEST=>'POST',CURLOPT_POSTFIELDS=>$payload,CURLOPT_HTTPHEADER=>array('Content-Type: application/json','Accept: application/json','Authorization: Bearer '.$token),));$response=curl_exec($curl);curl_close($curl);echo$response;// Add custom code to save the response in database and use it later to track the delivery report?>
varaxios=require('axios');vardata=JSON.stringify({"messages":[{"messages":[{"originator":"{{originator}}","recipients":["{{recipient1}}","{{recipient2}}"],"content":{"message_type":"TEXT","message_text":"Hi, How can I help you?"},"report_url":"https://the_url_to_recieve_delivery_report.com"}]});varconfig={method:'post',url:'https://api.d7networks.com/whatsapp/v1/send',headers:{'Content-Type':'application/json','Accept':'application/json','Authorization':'Bearer {{api_access_token}}'},data:data};axios(config).then(function(response){console.log(JSON.stringify(response.data));}).catch(function(error){console.log(error);});
importrequestsimportjsonurl="https://api.d7networks.com/whatsapp/v1/send"payload=json.dumps({"messages":[{"originator":"{{originator}}","recipients":["{{recipient1}}","{{recipient2}}"],"content":{"message_type":"TEXT","message_text":"Hi, How can I help you?"},"report_url":"https://the_url_to_recieve_delivery_report.com"}]})headers={'Content-Type':'application/json','Accept':'application/json','Authorization':'Bearer {{api_access_token}}'}response=requests.request("POST",url,headers=headers,data=payload)print(response.text)
<?php$curl=curl_init();$token={{api_access_token}};// Replace it with your API Token$originator={{originator}};// Replace it with your Sender ID$template_id={{template_id}}$recipients=array({{recipient1}},{{recipient2}});// Replace it with real recipients$content=array("message_type"=>"TEXT","template"=>'Hi, How can I help you?');// Replace it with message content$message_obj=array("originator"=>$originator,"recipients"=>$recipients,"content"=>$content,"report_url"=>"https://the_url_to_recieve_delivery_report.com");$payload=json_encode(array("messages"=>array($message_obj)));curl_setopt_array($curl,array(CURLOPT_URL=>'https://api.d7networks.com/whatsapp/v1/send',CURLOPT_RETURNTRANSFER=>true,CURLOPT_ENCODING=>'',CURLOPT_MAXREDIRS=>10,CURLOPT_TIMEOUT=>0,CURLOPT_FOLLOWLOCATION=>true,CURLOPT_HTTP_VERSION=>CURL_HTTP_VERSION_1_1,CURLOPT_CUSTOMREQUEST=>'POST',CURLOPT_POSTFIELDS=>$payload,CURLOPT_HTTPHEADER=>array('Content-Type: application/json','Accept: application/json','Authorization: Bearer '.$token),));$response=curl_exec($curl);curl_close($curl);echo$response;// Add custom code to save the response in database and use it later to track the delivery report?>
varsettings={"url":"https://api.d7networks.com/whatsapp/v1/send","method":"POST","timeout":0,"headers":{"Content-Type":"application/json","Accept":"application/json","Authorization":"Bearer {{api_access_token}}"},"data":JSON.stringify({"messages":[{"originator":"{{originator}}","recipients":["{{recipient1}}","{{recipient2}}"],"content":{"message_type":"TEXT","message_text":"Hi, How can I help you?"},"report_url":"https://the_url_to_recieve_delivery_report.com"}]}),};$.ajax(settings).done(function(response){console.log(response);});
varheaders={'Content-Type':'application/json','Accept':'application/json','Authorization':'Bearer {{api_access_token}}'};varrequest=http.Request('POST',Uri.parse('https://api.d7networks.com/whatsapp/v1/send'));request.body=json.encode({"messages":[{"originator":"{{originator}}","recipients":["{{recipient1}}","{{recipient2}}"],"content":{"message_type":"TEXT","message_text":"Hi, How can I help you?"},"report_url":"https://the_url_to_recieve_delivery_report.com"}]});request.headers.addAll(headers);http.StreamedResponseresponse=awaitrequest.send();if(response.statusCode==200){print(awaitresponse.stream.bytesToString());}else{print(response.reasonPhrase);}
$headers=New-Object"System.Collections.Generic.Dictionary[[String],[String]]"$headers.Add("Content-Type","application/json")$headers.Add("Accept","application/json")$headers.Add("Authorization","Bearer {{api_access_token}}")$body="{`n`"messages`": [`n {`n`"originator`": `"{{originator}}`",`n`"recipients`": [`"{{recipient1}}`",`"{{recipient2}}`"],`n`"content`": {`n`"message_type`": `"TEXT`",`n`"message_text`": `"Hi, How can I help you?`"`n },`n`"report_url`": `"https://the_url_to_recieve_delivery_report.com`"`n }`n ]`n }"$response=Invoke-RestMethod'https://api.d7networks.com/whatsapp/v1/send'-Method'POST'-Headers$headers-Body$body$response|ConvertTo-Json
require"uri"require"json"require"net/http"url=URI("https://api.d7networks.com/whatsapp/v1/send")https=Net::HTTP.new(url.host,url.port)https.use_ssl=truerequest=Net::HTTP::Post.new(url)request["Content-Type"]="application/json"request["Accept"]="application/json"request["Authorization"]="Bearer {{api_access_token}}"request.body=JSON.dump({"messages":[{"originator":"{{originator}}","recipients":["{{recipient1}}","{{recipient2}}"],"content":{"message_type":"TEXT","message_text":"Hi, How can I help you?"},"report_url":"https://the_url_to_recieve_delivery_report.com"}]})response=https.request(request)putsresponse.read_body
varaxios=require('axios');vardata=JSON.stringify({"messages":[{"originator":"91xx615xx5x4",
"content":{"preview_url":false,
"message_type":"INTERACTIVE",
"interactive":{"type":"list",
"header":{"type":"text",
"text":"Direct7 Networks"},
"body":{"text":"Choose one of our service"},
"footer":{"text":"Thank you"},
"action":{"button":"Choose Service",
"sections":[{"title":"SMS Messaging",
"rows":[{"id":"1",
"title":"Normal SMS",
"description":"Signup for free at the D7 platform to use our Messaging APIs."},
{"id":"2",
"title":"Verify",
"description":"D7 Verify API is to applications requires SMS based OTP authentications."}]},
{"title":"Whatsapp",
"rows":[{"id":"3",
"title":"WhatsApp Messages",
"description":"D7 Whatsapp API is to applications requires pre-registration."}]}]}}},
"recipients":[{"recipient":"+9715xx6xx543",
"recipient_type":"individual"}],
"report_url":"https://the_url_to_recieve_delivery_report.com"}]});varconfig={method:'post',
url:'https://api.d7networks.com/whatsapp/v1/send',
headers:{'Authorization':'Bearer {{api_access_token}}','Content-Type':'application/json'},
data:data
};axios(config).then(function(response){console.log(JSON.stringify(response.data));}).catch(function(error){console.log(error);});
importrequestsimportjsonurl="https://api.d7networks.com/whatsapp/v1/send"payload=json.dumps({"messages":[{"originator":"91xx615xx5x4","content":{"preview_url":False,"message_type":"INTERACTIVE","interactive":{"type":"list","header":{"type":"text","text":"Direct7 Networks"},"body":{"text":"Choose one of our service"},"footer":{"text":"Thank you"},"action":{"button":"Choose Service","sections":[{"title":"SMS Messaging","rows":[{"id":"1","title":"Normal SMS","description":"Signup for free at the D7 platform to use our Messaging APIs."},{"id":"2","title":"Verify","description":"D7 Verify API is to applications requires SMS based OTP authentications."}]},{"title":"Whatsapp","rows":[{"id":"3","title":"WhatsApp Messages","description":"D7 Whatsapp API is to applications requires pre-registration."}]}]}}},"recipients":[{"recipient":"+9715xx6xx543","recipient_type":"individual"}],"report_url":"https://the_url_to_recieve_delivery_report.com"}]})headers={'Authorization':'Bearer {{api_access_token}}','Content-Type':'application/json'}response=requests.request("POST",url,headers=headers,data=payload)print(response.text)
<?php$curl=curl_init();$token={{api_access_token}};// Replace it with your API Token$originator={{originator}};// Replace it with your Sender ID$recipients=array({{recipient1}},{{recipient2}});// Replace it with real recipients$header=array("type"=>"text","text"=>"Direct7 Networks")$sections1=array("title"=>"SMS Messaging","rows"=>[array("id"=>"1","title"=>"Normal SMS","description"=>"Signup for free at the D7 platform to use our Messaging APIs."),array("id"=>"2","title"=>"Verify","description"=>"D7 Verify API is to applications requires SMS based OTP authentications.")])$sections2=array("title"=>"Whatsapp","rows"=>[array("id"=>"3","title"=>"WhatsApp Messages","description"=>"D7 Whatsapp API is to applications requires pre-registration.")])$interactive=array("type"=>"list","header"=>$header,"body"=>array("text"=>"Choose one of our service"),"footer"=>array("text"=>"Thank you"),"action"=>array("button"=>"Choose one of our service","sections"=>[$sections1,$sections2]))$content=array("message_type"=>"INTERACTIVE","interactive"=>$interactive);// Replace it with message content$message_obj=array("originator"=>$originator,"recipients"=>$recipients,"content"=>$content,"report_url"=>"https://the_url_to_recieve_delivery_report.com");$payload=json_encode(array("messages"=>array($message_obj)));curl_setopt_array($curl,array(CURLOPT_URL=>'https://api.d7networks.com/whatsapp/v1/send',CURLOPT_RETURNTRANSFER=>true,CURLOPT_ENCODING=>'',CURLOPT_MAXREDIRS=>10,CURLOPT_TIMEOUT=>0,CURLOPT_FOLLOWLOCATION=>true,CURLOPT_HTTP_VERSION=>CURL_HTTP_VERSION_1_1,CURLOPT_CUSTOMREQUEST=>'POST',CURLOPT_POSTFIELDS=>$payload,CURLOPT_HTTPHEADER=>array('Content-Type: application/json','Accept: application/json','Authorization: Bearer '.$token),));$response=curl_exec($curl);curl_close($curl);echo$response;// Add custom code to save the response in database and use it later to track the delivery report?>
varsettings={"url":"https://api.d7networks.com/whatsapp/v1/send","method":"POST","timeout":0,"headers":{"Authorization":"Bearer {{api_access_token}}","Content-Type":"application/json"},"data":JSON.stringify({"messages":[{"originator":"91xx615xx5x4","content":{"preview_url":false,"message_type":"INTERACTIVE","interactive":{"type":"list","header":{"type":"text","text":"Direct7 Networks"},"body":{"text":"Choose one of our service"},"footer":{"text":"Thank you"},"action":{"button":"Choose Service","sections":[{"title":"SMS Messaging","rows":[{"id":"1","title":"Normal SMS","description":"Signup for free at the D7 platform to use our Messaging APIs."},{"id":"2","title":"Verify","description":"D7 Verify API is to applications requires SMS based OTP authentications."}]},{"title":"Whatsapp","rows":[{"id":"3","title":"WhatsApp Messages","description":"D7 Whatsapp API is to applications requires pre-registration."}]}]}}},"recipients":[{"recipient":"+9715xx6xx543","recipient_type":"individual"}],"report_url":"https://the_url_to_recieve_delivery_report.com"}]}),};$.ajax(settings).done(function(response){console.log(response);});
varheaders={'Authorization':'Bearer {{api_access_token}}','Content-Type':'application/json'};varrequest=http.Request('POST',Uri.parse('https://api.d7networks.com/whatsapp/v1/send'));request.body=json.encode({"messages":[{"originator":"91xx615xx5x4","content":{"preview_url":false,"message_type":"INTERACTIVE","interactive":{"type":"list","header":{"type":"text","text":"Direct7 Networks"},"body":{"text":"Choose one of our service"},"footer":{"text":"Thank you"},"action":{"button":"Choose Service","sections":[{"title":"SMS Messaging","rows":[{"id":"1","title":"Normal SMS","description":"Signup for free at the D7 platform to use our Messaging APIs."},{"id":"2","title":"Verify","description":"D7 Verify API is to applications requires SMS based OTP authentications."}]},{"title":"Whatsapp","rows":[{"id":"3","title":"WhatsApp Messages","description":"D7 Whatsapp API is to applications requires pre-registration."}]}]}}},"recipients":[{"recipient":"+9715xx6xx543","recipient_type":"individual"}],"report_url":"https://the_url_to_recieve_delivery_report.com"}]});request.headers.addAll(headers);http.StreamedResponseresponse=awaitrequest.send();if(response.statusCode==200){print(awaitresponse.stream.bytesToString());}else{print(response.reasonPhrase);}
require"uri"require"json"require"net/http"url=URI("https://api.d7networks.com/whatsapp/v1/send")https=Net::HTTP.new(url.host,url.port)https.use_ssl=truerequest=Net::HTTP::Post.new(url)request["Authorization"]="Bearer {{api_access_token}}"request["Content-Type"]="application/json"request.body=JSON.dump({"messages":[{"originator":"91xx615xx5x4","content":{"preview_url":false,"message_type":"INTERACTIVE","interactive":{"type":"list","header":{"type":"text","text":"Direct7 Networks"},"body":{"text":"Choose one of our service"},"footer":{"text":"Thank you"},"action":{"button":"Choose Service","sections":[{"title":"SMS Messaging","rows":[{"id":"1","title":"Normal SMS","description":"Signup for free at the D7 platform to use our Messaging APIs."},{"id":"2","title":"Verify","description":"D7 Verify API is to applications requires SMS based OTP authentications."}]},{"title":"Whatsapp","rows":[{"id":"3","title":"WhatsApp Messages","description":"D7 Whatsapp API is to applications requires pre-registration."}]}]}}},"recipients":[{"recipient":"+9715xx6xx543","recipient_type":"individual"}],"report_url":"https://the_url_to_recieve_delivery_report.com"}]})response=https.request(request)putsresponse.read_body
importrequestsimportjsonurl="https://api.d7networks.com/whatsapp/v1/send"payload=json.dumps({"messages":[{"originator":"919xx15xxx74","content":{"preview_url":False,"message_type":"INTERACTIVE","interactive":{"type":"button","header":{"type":"text","text":"Payment$ for D7 Whatsapp Service"},"body":{"text":"Direct7 Networks is a messaging service provider that specializes in helping organizations efficiently communicate with their customers."},"footer":{"text":"Thank You"},"action":{"buttons":[{"type":"reply","reply":{"id":"1","title":"Debit Card"}},{"type":"reply","reply":{"id":"2","title":"Credit Card"}},{"type":"reply","reply":{"id":"3","title":"Cash"}}]}}},"recipients":[{"recipient":"+9715xx6xx5x3","recipient_type":"individual"}],"report_url":"https://the_url_to_recieve_delivery_report.com"}]})headers={'Authorization':'Bearer {{api_access_token}}','Content-Type':'application/json'}response=requests.request("POST",url,headers=headers,data=payload)print(response.text)
<?php$curl=curl_init();$token={{api_access_token}};// Replace it with your API Token$originator={{originator}};// Replace it with your Sender ID$recipients=array({{recipient1}},{{recipient2}});// Replace it with real recipients$header=array("type"=>"text","text"=>"Payment$ for D7 Whatsapp Service")$button1=array("type"=>"reply","reply"=>[array("id"=>"1","title"=>"Debit Card")])$button2=array("type"=>"reply","reply"=>[array("id"=>"2","title"=>"Credit Card")])$button3=array("type"=>"reply","reply"=>[array("id"=>"3","title"=>"Cash")])$interactive=array("type"=>"button","header"=>$header,"body"=>array("text"=>"Direct7 Networks is a messaging service provider that specializes in helping organizations efficiently communicate with their customers."),"footer"=>array("text"=>"Thank you"),"action"=>array("buttons"=>[$button1,$button2,$button3]))$content=array("message_type"=>"INTERACTIVE","interactive"=>$interactive);// Replace it with message content$message_obj=array("originator"=>$originator,"recipients"=>$recipients,"content"=>$content,"report_url"=>"https://the_url_to_recieve_delivery_report.com");$payload=json_encode(array("messages"=>array($message_obj)));curl_setopt_array($curl,array(CURLOPT_URL=>'https://api.d7networks.com/whatsapp/v1/send',CURLOPT_RETURNTRANSFER=>true,CURLOPT_ENCODING=>'',CURLOPT_MAXREDIRS=>10,CURLOPT_TIMEOUT=>0,CURLOPT_FOLLOWLOCATION=>true,CURLOPT_HTTP_VERSION=>CURL_HTTP_VERSION_1_1,CURLOPT_CUSTOMREQUEST=>'POST',CURLOPT_POSTFIELDS=>$payload,CURLOPT_HTTPHEADER=>array('Content-Type: application/json','Accept: application/json','Authorization: Bearer '.$token),));$response=curl_exec($curl);curl_close($curl);echo$response;// Add custom code to save the response in database and use it later to track the delivery report?>
varsettings={"url":"https://api.d7networks.com/whatsapp/v1/send","method":"POST","timeout":0,"headers":{"Authorization":"Bearer {{api_access_token}}","Content-Type":"application/json"},"data":JSON.stringify({"messages":[{"originator":"919xx15xxx74","content":{"preview_url":false,"message_type":"INTERACTIVE","interactive":{"type":"button","header":{"type":"text","text":"Payment$ for D7 Whatsapp Service"},"body":{"text":"Direct7 Networks is a messaging service provider that specializes in helping organizations efficiently communicate with their customers."},"footer":{"text":"Thank You"},"action":{"buttons":[{"type":"reply","reply":{"id":"1","title":"Debit Card"}},{"type":"reply","reply":{"id":"2","title":"Credit Card"}},{"type":"reply","reply":{"id":"3","title":"Cash"}}]}}},"recipients":[{"recipient":"+9715xx6xx5x3","recipient_type":"individual"}],"report_url":"https://the_url_to_recieve_delivery_report.com"}]}),};$.ajax(settings).done(function(response){console.log(response);});
varheaders={'Authorization':'Bearer {{api_access_token}}','Content-Type':'application/json'};varrequest=http.Request('POST',Uri.parse('https://api.d7networks.com/whatsapp/v1/send'));request.body=json.encode({"messages":[{"originator":"919xx15xxx74","content":{"preview_url":false,"message_type":"INTERACTIVE","interactive":{"type":"button","header":{"type":"text","text":"Payment$ for D7 Whatsapp Service"},"body":{"text":"Direct7 Networks is a messaging service provider that specializes in helping organizations efficiently communicate with their customers."},"footer":{"text":"Thank You"},"action":{"buttons":[{"type":"reply","reply":{"id":"1","title":"Debit Card"}},{"type":"reply","reply":{"id":"2","title":"Credit Card"}},{"type":"reply","reply":{"id":"3","title":"Cash"}}]}}},"recipients":[{"recipient":"+9715xx6xx5x3","recipient_type":"individual"}],"report_url":"https://the_url_to_recieve_delivery_report.com"}]});request.headers.addAll(headers);http.StreamedResponseresponse=awaitrequest.send();if(response.statusCode==