Skip to content

Send Free-form Whatsapp Messages

You can use our business messaging API to send free-form messages of types:

Note: Before starting, it is recommended to go through the basics of whatsapp message

Endpoint

POST
/whatsapp/v2/send


POSTMAN

Authentication

AUTHORIZATION: Bearer Token

Body

Object

      {
          "messages": [
              {
                  "originator": "{registered phone_number}",
                  "content": {
                      "message_type":  "<TYPE>",

                       /* FOR TEXT MESSAGES ONLY */
                       "text": {<TEXT>}

                       /* FOR REACTION MESSAGES ONLY */
                       "reaction": {<REACTION>}

                       /* FOR ATTACHMENT MESSAGES ONLY */
                       "attachment": {<MEDIA>}

                       /* FOR LOCATION MESSAGES ONLY */
                       "location": {<LOCATION>}

                       /* FOR CONTACTS MESSAGES ONLY */
                       "contacts": {<CONTACTS>}

                       /* FOR INTERACTIVE MESSAGES ONLY */
                       "interactive": {<INTERACTIVE>}
                  },
                  "recipients": [<recipient>],
                  "report_url": "{report url}"
              }
          ]
      }

Body parameters

Parameter Type Description
* originator String The Phone number of Sender/Header of a message. We can use your mobile number that is registered and approved in meta.
* recipients Array(Object) Array of recipient object
*message_type String Possible types in free-form message are: TEXT, REACTION, ATTACHMENT, LOCATION, CONTACTS, INTERACTIVE
* text TEXT object If message type is text, then add, text object
* reaction REACTION object If message type is reaction, then add reaction object
* attachment MEDIA object If message type is attachment, then add media object
* location LOCATION object If message type is location, then add location object
* contacts CONTACTS object If message type is contacts, then add contacts object
* interactive INTERACTIVE object If message type is interactive, then add interactive object
report_url HttpUrl 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. See more

Message Objects

    "recipients": [
            {
                "recipient": "{{recipient1}}",
                "recipient_type": "individual",
                "reference": {
                    "cust_ref": "[email protected]",
                    "message_tag1": "d7id00001_m1",
                    "conversation_id": "d7id00001"
                }
            },
            {
                "recipient": "{{recipient2}}",
                "recipient_type": "individual",
                "reference": {
                    "cust_ref": "[email protected]",
                    "message_tag1": "d7id00001_m1",
                    "conversation_id": "d7id00001"
                }
            }
        ],
Parameter Type Description Value / Pattern
*recipient Array(string) Mobile Numbers to send Whatsapp seperated by comma in an array. The recipient's phone number should have a country code prefix. +97156xxxxxxx
*recipient_type String Default: individual. Now Support Only individual recipients individual
cust_ref string Any text to store reference of recipient [email protected]
message_tag1 string Any text tag for message reference tag1
message_tag2 string Any text tag for message reference tag2
message_tag3 string Any text tag for message reference tag3
message_tag4 string Any text tag for message reference tag4
message_tag5 string Any text tag for message reference tag5
conversation_id string Any text for conversation reference conversation_marketing
   "text":{
       "preview_url": true,
       "body": "Hi, How can I help you?"
   }
Parameter Type Description Value / Pattern
*body String Contains the text of the message, which can contain URLs and formatting. Maximum length: 4096 characters Hi, How can I help you?
preview url Boolean Set to true to have the WhatsApp Messenger and WhatsApp Business apps attempt to render a link preview of any URL in the body text string. URLs must begin with http:// or https://. If multiple URLs are in the body text string, only the first URL will be rendered. If preview_url is omitted, or if unable to retrieve a preview, a clickable link will be rendered instead.
Formatting Symbol Example
Bold Asterisk (*) Your total is $10.50
Italics Underscore (_) Welcome to WhatsApp!
Strike-through Tilde (~) This is ~better~ best!
Code Three backticks (```) ```print 'Hello World';```
     "reaction": {
                    "message_id": "6847c2ea-b52f-11ee-8fa2-0242ac190007",
                    "emoji": "\uD83D\uDE00"
                 }
Parameter Type Description
*message_id String The WhatsApp Message ID (wamid) of the message on which the reaction should appear. The reaction will not be sent if the message is, older than 30 days, a reaction message or has been deleted. Also,if the ID is of a message that has been deleted, the message will not be delivered.
*emoji String Emoji to appear on the message.
    "attachment": {
                      "type": "image",
                      "caption": "Natural Beauty",
                      "url": "https://miro.medium.com/max/780/1*9Wdo1PuiJTZo0Du2A9JLQQ.jpeg"
                  }
Parameter Type Description
*type String Type of the attachment you want to send. Supported Values: image, audio, document, video, sticker.
*url String URL for the attachment. The protocol and URL of the media to be sent. Use only with HTTP/HTTPS URL.
caption String Caption for the attachment. Do not use caption with audio or sticker media.
filename String Use filename only with document.
    "location": {
                    "longitude": 77.6109,
                    "latitude": 12.9379,
                    "name": "KARXX XX  PRIVATE LIMITED",
                    "address": " 30, Hosur Main Road"
                 }
Parameter Type Description
*longitude String Longitude of the Location you wants to send.
*latitude String Longitude of the Location you wants to send.
name String Name of the Location you wants to send.
address String Address of the Location you wants to send. Only displayed if the name is present.
"contacts": [
                {
                    "addresses": [{
                                    "street": "STREET",
                                    "city": "CITY",
                                    "state": "STATE",
                                    "zip": "ZIP",
                                    "country": "COUNTRY",
                                    "country_code": "COUNTRY_CODE",
                                    "type": "HOME"
                                  },
                                  {
                                    "street": "STREET",
                                    "city": "CITY",
                                    "state": "STATE",
                                    "zip": "ZIP",
                                    "country": "COUNTRY",
                                    "country_code": "COUNTRY_CODE",
                                    "type": "WORK"
                                  }],
                    "birthday": "YEAR_MONTH_DAY",
                    "emails": [{
                                  "email": "EMAIL",
                                  "type": "WORK"
                                },
                                {
                                  "email": "EMAIL",
                                  "type": "HOME"
                                }],
                    "name": {
                              "formatted_name": "NAME",
                              "first_name": "FIRST_NAME",
                              "last_name": "LAST_NAME",
                              "middle_name": "MIDDLE_NAME",
                              "suffix": "SUFFIX",
                              "prefix": "PREFIX"
                           },
                    "org": {
                                "company": "COMPANY",
                                "department": "DEPARTMENT",
                                "title": "TITLE"
                            },
                    "phones": [{
                                  "phone": "PHONE_NUMBER",
                                  "type": "HOME"
                                },
                                {
                                  "phone": "PHONE_NUMBER",
                                  "type": "WORK",
                                  "wa_id": "PHONE_OR_WA_ID"
                                }],
                    "urls": [{
                                "url": "URL",
                                "type": "WORK"
                              },
                              {
                                "url": "URL",
                                "type": "HOME"
                            }]
                }
            ]
Parameter Type Description
*name Object Full contact name formatted as a name object.
addresses Array (Object) Full contact address(es) formatted as an addresses object.
birthday String YYYY-MM-DD formatted string.
emails Array (Object) Contact email address(es) formatted as an emails object.
org Object Contact organization information formatted as an org object.
phones Array (Object) Contact phone number(s) formatted as a phone object.
urls Array (Object) Contact URL(s) formatted as a urls object.

Parameter Type Description
*formatted_name String Full name, as it normally appears. At least one of the optional parameters needs to be included along with the formatted_name parameter.
first_name String First name of the contact you wants to send.
last_name String Last name of the contact you wants to send.
middle_name String Middle name of the contact you wants to send.
suffix String Name suffix.
prefix String Name prefix.
Parameter Type Description
street String Street number and name.
city String City name.
state String State abbreviation.
zip String Zip Code
country String Full country name.
country_code String Two-letter country abbreviation.
type String Standard values are HOME and WORK.
Parameter Type Description
email String Email Address.
type String Supported values are HOME and WORK.
Parameter Type Description
company String Name of the contact's company.
department String Name of the contact's department.
title String Contact's business title.
Parameter Type Description
phone String Automatically populated with the wa_id value as a formatted phone number.
type String Standard Values are CELL, MAIN, IPHONE, HOME, and WORK.
wa_id String WhatsApp ID.
Parameter Type Description
url String URL.
type String Supported values are HOME and WORK.

See Interactive object details here

Parameter Type Description
*type String The type of interactive message you want to send. Supported values: button, list
*body Object The body object contains text parameter. Its required if body is present. The content of the message. Emojis and markdown are supported. Maximum length: 1024 characters.
footer Object 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 Object Optional. Header content displayed on top of a message.
*action Object Action you want the user to perform after reading the message.
Parameter Type Description
type String 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 Object Required if type is set to document. Contains two parameters filename and link.
image Object Required if type is set to image. Contains only link parameter.
text String Required if type is set to text. Text for the header. Formatting allows emojis, but not markdown. Maximum length: 60 characters.
video Object Required if type is set to video. Contains only link parameter.
Parameter Type Description
button String 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 Array(Object) 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.
Parameter Type Description
buttons Array(Object) 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.

CTA URL buttons allow you to map any URL to a button so you don't have to include the raw URL in the interactive message body.

Parameter Type Description
parameters Array(Object) Required for Call-to-Action Buttons. You can have up to one button. Parameters Object should contain the following parameters:
display_text: Button text.
url: URL to load in the device's default web browser when tapped by the WhatsApp user.

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.

200 - Success
{
    "request_id": "d9835609-a4e0-10ea-a26a-eeafbe700fef",
    "status": "accepted",
    "created_at": "2001-08-05T12:52:38.393Z"
}
401 - Unauthorized
{ 
    "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."
    } 
} 
422 - Validation Error
{
    "detail": [
        {
            "loc": [
            "string"
            ],
        "msg": "string",
        "type": "string"
        }
    ]
} 
404 - Not Found
    {
        "detail": [
            {
                "code": "INVALID_WHATSAPP_ORIGINATOR",
                "message": "Invalid Originator configured"
            }
        ]
    }

Response Parameters

Parameter Value / Pattern
request_id Unique id for each Whatsapp message request. This request_id is required to check delivery status of your Whatsapp message.
status The status of Whatsapp message request. Possible request status are accepted and rejected
created_at Date and time of the Whatsapp message request.

Programing Examples:

1. Text message

 curl --location 'https://apialpha.d7networks.com/whatsapp/v2/send' \
 --header 'Content-Type: application/json' \
 --header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc' \
 --data '{
      "messages": [
          {
              "originator": "{registered phone_number}",
              "content": {
                  "message_type": "TEXT",
                  "text":{
                      "preview_url": true,
                      "body": "Hi, How can I help you?"
                  }
              },
              "recipients": [{
                  "recipient": "{recipient}",
                  "recipient_type": "individual"
              }],
              "report_url": "https://webhook.site/4235f691-13ab-448e-b100-74a3a627927f"
          }
      ]
 }'
npm i direct7
1
2
3
4
5
6
7
const Client = require('direct7')

const client = new Client(apiToken="Your API token")

const response = await client.whatsapp.sendWhatsAppFreeformMessage({originator: "{registered_phonenumber}", recipient: "{recipient}", message_type: "TEXT", body: "Hi, How can I help you?"});

console.log(response);
pip install direct7
1
2
3
4
5
from direct7 import Client

client = Client(api_token="Your API token")

client.whatsapp.send_whatsapp_freeform_message(originator="{registered_phonenumber}", recipient="{recipient}", message_type="TEXT", body="Hi, How can I help you?")    

composer require direct7/direct7-php
require_once 'vendor/autoload.php';
require_once __DIR__ . '/vendor/autoload.php';

use direct7\Direct7\Client;

$client = new Client(api_token="Your API token")

$body_parameter_values = ["0" => 'first_parameter_in_your_template', "1" => 'second_parameter_in_your_template']

$response = $direct7->whatsapp->sendWhatsAppFreeformMessage(originator:"{registered_phonenumber}", recipient:"{recipient}", message_type:"TEXT", body: "Hi");
var_dump($response);
go get -u github.com/d7networks/direct7-go-sdk
import (
"github.com/d7networks/direct7-go-sdk/direct7"
)
apiToken := "Your Api Token"
client := direct7.NewClient(apiToken)
originator := "{registered_phonenumber}"
recipient := "{recipient}"
messageType := "TEXT"
optParams := &OptionalParams{
    body: "Hi",
}
response, err := whatsapp.SendWhatsAppFreeformMessage(originator, recipient, messageType, optParams)
 OkHttpClient client = new OkHttpClient().newBuilder().build();
 MediaType mediaType = MediaType.parse("application/json");
 RequestBody body = RequestBody.create(mediaType, "{\n    \"messages\": [\n        {\n            \"originator\": \"{registered phone_number}\",\n            \"content\": {\n                \"message_type\": \"TEXT\",\n                \"text\":{\n                    \"preview_url\": true,\n                    \"body\": \"Hi, How can I help you?\"\n                }\n            },\n            \"recipients\": [{\n                \"recipient\": \"{recipient}\",\n                \"recipient_type\": \"individual\"\n            }],\n            \"report_url\": \"https://webhook.site/4235f691-13ab-448e-b100-74a3a627927f\"\n        }\n    ]\n}");
 Request request = new Request.Builder()
 .url("https://apialpha.d7networks.com/whatsapp/v2/send")
 .method("POST", body)
 .addHeader("Content-Type", "application/json")
 .addHeader("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc")
 .build();
 Response response = client.newCall(request).execute();
 var headers = {
 'Content-Type': 'application/json',
 'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc'
 };
 var request = http.Request('POST', Uri.parse('https://apialpha.d7networks.com/whatsapp/v2/send'));
 request.body = json.encode({
 "messages": [
 {
 "originator": "{registered phone_number}",
 "content": {
 "message_type": "TEXT",
 "text": {
 "preview_url": true,
 "body": "Hi, How can I help you?"
 }
 },
 "recipients": [
 {
 "recipient": "{recipient}",
 "recipient_type": "individual"
 }
 ],
 "report_url": "https://webhook.site/4235f691-13ab-448e-b100-74a3a627927f"
 }
 ]
 });
 request.headers.addAll(headers);

 http.StreamedResponse response = await request.send();

 if (response.statusCode == 200) {
 print(await response.stream.bytesToString());
 }
 else {
 print(response.reasonPhrase);
 }     
  $headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
  $headers.Add("Content-Type", "application/json")
  $headers.Add("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc")

  $body = @"
  {
  `"messages`": [
  {
  `"originator`": `"{registered phone_number}`",
  `"content`": {
  `"message_type`": `"TEXT`",
  `"text`":{
  `"preview_url`": true,
  `"body`": `"Hi, How can I help you?`"
  }
  },
  `"recipients`": [{
  `"recipient`": `"{recipient}`",
  `"recipient_type`": `"individual`"
  }],
  `"report_url`": `"https://webhook.site/4235f691-13ab-448e-b100-74a3a627927f`"
  }
  ]
  }
  "@

  $response = Invoke-RestMethod 'https://apialpha.d7networks.com/whatsapp/v2/send' -Method 'POST' -Headers $headers -Body $body
  $response | ConvertTo-Json
gem install direct7
1
2
3
4
5
require 'direct7'

client = Direct7::Client.new('Your API token')

client.whatsapp.send_whatsapp_freeform_message(originator = "91906152XXXX", recipient = "91999999XXXX", message_type= "TEXT",body= "Hi, How can I help you?")
1
2
3
4
5
6
7
8
  var client = new HttpClient();
  var request = new HttpRequestMessage(HttpMethod.Post, "https://apialpha.d7networks.com/whatsapp/v2/send");
  request.Headers.Add("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc");
  var content = new StringContent("{\n    \"messages\": [\n        {\n            \"originator\": \"{registered phone_number}\",\n            \"content\": {\n                \"message_type\": \"TEXT\",\n                \"text\":{\n                    \"preview_url\": true,\n                    \"body\": \"Hi, How can I help you?\"\n                }\n            },\n            \"recipients\": [{\n                \"recipient\": \"{recipient}\",\n                \"recipient_type\": \"individual\"\n            }],\n            \"report_url\": \"https://webhook.site/4235f691-13ab-448e-b100-74a3a627927f\"\n        }\n    ]\n}", null, "application/json");
  request.Content = content;
  var response = await client.SendAsync(request);
  response.EnsureSuccessStatusCode();
  Console.WriteLine(await response.Content.ReadAsStringAsync());

2. Reaction message

 curl --location 'https://apialpha.d7networks.com/whatsapp/v2/send' \
 --header 'Content-Type: application/json' \
 --header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc' \
 --data '{
     "messages": [
         {
             "originator": "{registered phone_number}",
             "content": {
                 "message_type": "REACTION",
                 "reaction": {
                     "message_id": "6847c2ea-b52f-11ee-8fa2-0242ac190007",
                     "emoji": "\uD83D\uDE00"
                 }
             },
             "recipients": [
                 {
                     "recipient": "{recipient}",
                     "recipient_type": "individual"
                 }
             ],
             "report_url": "https://webhook.site/4235f691-13ab-448e-b100-74a3a627927f"
         }
     ]
 }'
const axios = require('axios');
let data = JSON.stringify({
  "messages": [
    {
      "originator": "+918129643147",
      "content": {
        "message_type": "REACTION",
        "reaction": {
          "message_id": "6847c2ea-b52f-11ee-8fa2-0242ac190007",
          "emoji": "😀"
        }
      },
      "recipients": [
        {
          "recipient": "{recipient}",
          "recipient_type": "individual"
        }
      ],
      "report_url": "https://webhook.site/4235f691-13ab-448e-b100-74a3a627927f"
    }
  ]
});

let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url: 'https://apialpha.d7networks.com/whatsapp/v2/send',
  headers: { 
    'Content-Type': 'application/json', 
    'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc'
  },
  data : data
};

axios.request(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});
import http.client
import json
conn = http.client.HTTPSConnection("apialpha.d7networks.com")
payload = json.dumps({
  "messages": [
    {
      "originator": "{registered_phonenumber}",
      "content": {
        "message_type": "REACTION",
        "reaction": {
          "message_id": "6847c2ea-b52f-11ee-8fa2-0242ac190007",
          "emoji": "😀"
        }
      },
      "recipients": [
        {
          "recipient": "{recipient}",
          "recipient_type": "individual"
        }
      ],
      "report_url": "https://webhook.site/4235f691-13ab-448e-b100-74a3a627927f"
    }
  ]
})
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc'
}
conn.request("POST", "/whatsapp/v2/send", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://apialpha.d7networks.com/whatsapp/v2/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 =>'{
    "messages": [
        {
            "originator": "{registered_phonenumber}",
            "content": {
                "message_type": "REACTION",
                "reaction": {
                    "message_id": "6847c2ea-b52f-11ee-8fa2-0242ac190007",
                    "emoji": "\\uD83D\\uDE00"
                }
            },
            "recipients": [
                {
                    "recipient": "{recipient}",
                    "recipient_type": "individual"
                }
            ],
            "report_url": "https://webhook.site/4235f691-13ab-448e-b100-74a3a627927f"
        }
    ]
}',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
package main
import (
  "fmt"
  "strings"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://apialpha.d7networks.com/whatsapp/v2/send"
  method := "POST"

  payload := strings.NewReader(`{
    "messages": [
        {
            "originator": "{registered_phonenumber}",
            "content": {
                "message_type": "REACTION",
                "reaction": {
                    "message_id": "6847c2ea-b52f-11ee-8fa2-0242ac190007",
                    "emoji": "\uD83D\uDE00"
                }
            },
            "recipients": [
                {
                    "recipient": "{recipient}",
                    "recipient_type": "individual"
                }
            ],
            "report_url": "https://webhook.site/4235f691-13ab-448e-b100-74a3a627927f"
        }
    ]
}`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
 OkHttpClient client = new OkHttpClient().newBuilder().build();
 MediaType mediaType = MediaType.parse("application/json");
 RequestBody body = RequestBody.create(mediaType, "{\n    \"messages\": [\n        {\n            \"originator\": \"{registered phone_number}\",\n            \"content\": {\n                \"message_type\": \"REACTION\",\n                \"reaction\": {\n                    \"message_id\": \"6847c2ea-b52f-11ee-8fa2-0242ac190007\",\n                    \"emoji\": \"\\uD83D\\uDE00\"\n                }\n            },\n            \"recipients\": [\n                {\n                    \"recipient\": \"{recipient}\",\n                    \"recipient_type\": \"individual\"\n                }\n            ],\n            \"report_url\": \"https://webhook.site/4235f691-13ab-448e-b100-74a3a627927f\"\n        }\n    ]\n}");
 Request request = new Request.Builder()
   .url("https://apialpha.d7networks.com/whatsapp/v2/send")
   .method("POST", body)
   .addHeader("Content-Type", "application/json")
   .addHeader("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc")
   .build();
 Response response = client.newCall(request).execute();
 var headers = {
   'Content-Type': 'application/json',
   'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc'
 };
 var request = http.Request('POST', Uri.parse('https://apialpha.d7networks.com/whatsapp/v2/send'));
 request.body = json.encode({
   "messages": [
     {
       "originator": "{registered phone_number}",
       "content": {
         "message_type": "REACTION",
         "reaction": {
           "message_id": "6847c2ea-b52f-11ee-8fa2-0242ac190007",
           "emoji": "😀"
         }
       },
       "recipients": [
         {
           "recipient": "{recipient}",
           "recipient_type": "individual"
         }
       ],
       "report_url": "https://webhook.site/4235f691-13ab-448e-b100-74a3a627927f"
     }
   ]
 });
 request.headers.addAll(headers);

 http.StreamedResponse response = await request.send();

 if (response.statusCode == 200) {
   print(await response.stream.bytesToString());
 }
 else {
   print(response.reasonPhrase);
 }
 $headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
 $headers.Add("Content-Type", "application/json")
 $headers.Add("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc")

 $body = @"
 {
     `"messages`": [
         {
             `"originator`": `"{registered phone_number}`",
             `"content`": {
                 `"message_type`": `"REACTION`",
                 `"reaction`": {
                     `"message_id`": `"6847c2ea-b52f-11ee-8fa2-0242ac190007`",
                     `"emoji`": `"`\uD83D`\uDE00`"
                 }
             },
             `"recipients`": [
                 {
                     `"recipient`": `"{recipient}`",
                     `"recipient_type`": `"individual`"
                 }
             ],
             `"report_url`": `"https://webhook.site/4235f691-13ab-448e-b100-74a3a627927f`"
         }
     ]
 }
 "@

 $response = Invoke-RestMethod 'https://apialpha.d7networks.com/whatsapp/v2/send' -Method 'POST' -Headers $headers -Body $body
 $response | ConvertTo-Json
require "uri"
require "json"
require "net/http"

url = URI("https://apialpha.d7networks.com/whatsapp/v2/send")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc"
request.body = JSON.dump({
  "messages": [
    {
      "originator": "{registered_phonenumber}",
      "content": {
        "message_type": "REACTION",
        "reaction": {
          "message_id": "6847c2ea-b52f-11ee-8fa2-0242ac190007",
          "emoji": "😀"
        }
      },
      "recipients": [
        {
          "recipient": "{recipient}",
          "recipient_type": "individual"
        }
      ],
      "report_url": "https://webhook.site/4235f691-13ab-448e-b100-74a3a627927f"
    }
  ]
})

response = https.request(request)
puts response.read_body
1
2
3
4
5
6
7
8
  var client = new HttpClient();
  var request = new HttpRequestMessage(HttpMethod.Post, "https://apialpha.d7networks.com/whatsapp/v2/send");
  request.Headers.Add("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc");
  var content = new StringContent("{\n    \"messages\": [\n        {\n            \"originator\": \"{registered phone_number}\",\n            \"content\": {\n                \"message_type\": \"REACTION\",\n                \"reaction\": {\n                    \"message_id\": \"6847c2ea-b52f-11ee-8fa2-0242ac190007\",\n                    \"emoji\": \"\\uD83D\\uDE00\"\n                }\n            },\n            \"recipients\": [\n                {\n                    \"recipient\": \"{recipient}\",\n                    \"recipient_type\": \"individual\"\n                }\n            ],\n            \"report_url\": \"https://webhook.site/4235f691-13ab-448e-b100-74a3a627927f\"\n        }\n    ]\n}", null, "application/json");
  request.Content = content;
  var response = await client.SendAsync(request);
  response.EnsureSuccessStatusCode();
  Console.WriteLine(await response.Content.ReadAsStringAsync());

3. Media message

Media type: Image
 curl --location 'https://apialpha.d7networks.com/whatsapp/v2/send' \
 --header 'Content-Type: application/json' \
 --header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc' \
 --data '{
     "messages": [
         {
             "originator": "{registered phone_number}",
             "content": {
                 "message_type": "ATTACHMENT",
                 "attachment": {
                     "type": "image",
                     "caption": "Natural Beauty",
                     "url": "https://miro.medium.com/max/780/1*9Wdo1PuiJTZo0Du2A9JLQQ.jpeg"
                 }
             },
             "recipients": [
                 {
                     "recipient": "{recipient}",
                     "recipient_type": "individual"
                 }
             ],
             "report_url": "https://webhook.site/4235f691-13ab-448e-b100-74a3a627927f"
         }
     ]
 }'
npm i direct7
1
2
3
4
5
6
7
const Client = require('direct7')

const client = new Client(apiToken="Your API token")

const response = await client.whatsapp.sendWhatsAppFreeformMessage({originator: "{registered_phonenumber}", recipient: "{recipient}",message_type: "ATTACHMENT", type: "image", url: "https://miro.medium.com/max/780/1*9Wdo1PuiJTZo0Du2A9JLQQ.jpeg", caption: "Natural Beauty"});

console.log(response);
pip install direct7
1
2
3
4
5
from direct7 import Client

client = Client(api_token="Your API token")

client.whatsapp.send_whatsapp_freeform_message(originator="91906152XXXX", recipient="91906152XXXX", message_type="ATTACHMENT", type="image", url="https://miro.medium.com/max/780/1*9Wdo1PuiJTZo0Du2A9JLQQ.jpeg" ,caption="Natural Beauty")

composer require direct7/direct7-php
require_once 'vendor/autoload.php';
1
2
3
4
5
6
7
8
require_once __DIR__ . '/vendor/autoload.php';

use direct7\Direct7\Client;

$client = new Client(api_token="Your API token")

$response = $direct7->whatsapp->sendWhatsAppFreeformMessage(originator:"{registered_phonenumber}", recipient:"{recipient}", message_type:"ATTACHMENT", type: "image", url: "https://miro.medium.com/max/780/1*9Wdo1PuiJTZo0Du2A9JLQQ.jpeg" ,caption:"Natural Beauty");
var_dump($response);
go get -u github.com/d7networks/direct7-go-sdk
import (
"github.com/d7networks/direct7-go-sdk/direct7"
)
apiToken := "Your Api Token"
client := direct7.NewClient(apiToken)
whatsapp := direct7.NewWhatsApp(client)
originator := "{registered_phonenumber}"
recipient := "{recipient}"
messageType := "ATTACHMENT"
optParams := &OptionalParams{
                "attachmentType":"image",
                "attachmentURL": "https://miro.medium.com/max/780/1*9Wdo1PuiJTZo0Du2A9JLQQ.jpeg",
                "attachmentCaption": "Natural Beauty"
            }
response, err := whatsapp.SendWhatsAppFreeformMessage(originator, recipient, messageType, optParams)
  OkHttpClient client = new OkHttpClient().newBuilder().build();
  MediaType mediaType = MediaType.parse("application/json");
  RequestBody body = RequestBody.create(mediaType, "{\n    \"messages\": [\n        {\n            \"originator\": \"{registered phone_number}\",\n            \"content\": {\n                \"message_type\": \"ATTACHMENT\",\n                \"attachment\": {\n                    \"type\": \"image\",\n                    \"caption\": \"Natural Beauty\",\n                    \"url\": \"https://miro.medium.com/max/780/1*9Wdo1PuiJTZo0Du2A9JLQQ.jpeg\"\n                }\n            },\n            \"recipients\": [\n                {\n                    \"recipient\": \"{recipient}\",\n                    \"recipient_type\": \"individual\"\n                }\n            ],\n            \"report_url\": \"https://webhook.site/4235f691-13ab-448e-b100-74a3a627927f\"\n        }\n    ]\n}");
  Request request = new Request.Builder()
  .url("https://apialpha.d7networks.com/whatsapp/v2/send")
  .method("POST", body)
  .addHeader("Content-Type", "application/json")
  .addHeader("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc")
  .build();
  Response response = client.newCall(request).execute();
 var headers = {
 'Content-Type': 'application/json',
 'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc'
 };
 var request = http.Request('POST', Uri.parse('https://apialpha.d7networks.com/whatsapp/v2/send'));
 request.body = json.encode({
 "messages": [
 {
 "originator": "{registered phone_number}",
 "content": {
 "message_type": "ATTACHMENT",
 "attachment": {
 "type": "image",
 "caption": "Natural Beauty",
 "url": "https://miro.medium.com/max/780/1*9Wdo1PuiJTZo0Du2A9JLQQ.jpeg"
 }
 },
 "recipients": [
 {
 "recipient": "{recipient}",
 "recipient_type": "individual"
 }
 ],
 "report_url": "https://webhook.site/4235f691-13ab-448e-b100-74a3a627927f"
 }
 ]
 });
 request.headers.addAll(headers);

 http.StreamedResponse response = await request.send();

 if (response.statusCode == 200) {
 print(await response.stream.bytesToString());
 }
 else {
 print(response.reasonPhrase);
 }
 $headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
 $headers.Add("Content-Type", "application/json")
 $headers.Add("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc")

 $body = @"
 {
 `"messages`": [
 {
 `"originator`": `"{registered phone_number}`",
 `"content`": {
 `"message_type`": `"ATTACHMENT`",
 `"attachment`": {
 `"type`": `"image`",
 `"caption`": `"Natural Beauty`",
 `"url`": `"https://miro.medium.com/max/780/1*9Wdo1PuiJTZo0Du2A9JLQQ.jpeg`"
 }
 },
 `"recipients`": [
 {
 `"recipient`": `"{recipient}`",
 `"recipient_type`": `"individual`"
 }
 ],
 `"report_url`": `"https://webhook.site/4235f691-13ab-448e-b100-74a3a627927f`"
 }
 ]
 }
 "@

 $response = Invoke-RestMethod 'https://apialpha.d7networks.com/whatsapp/v2/send' -Method 'POST' -Headers $headers -Body $body
 $response | ConvertTo-Json
gem install direct7
1
2
3
4
5
require 'direct7'

client = Direct7::Client.new('Your API token')

client.whatsapp.send_whatsapp_freeform_message(originator = "91906152XXXX", recipient = "91999999XXXX", message_type= "ATTACHMENT", type= "image", url= "https://miro.medium.com/max/780/1*9Wdo1PuiJTZo0Du2A9JLQQ.jpeg", caption= "Natural Beauty")
1
2
3
4
5
6
7
8
 var client = new HttpClient();
 var request = new HttpRequestMessage(HttpMethod.Post, "https://apialpha.d7networks.com/whatsapp/v2/send");
 request.Headers.Add("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc");
 var content = new StringContent("{\n    \"messages\": [\n        {\n            \"originator\": \"{registered phone_number}\",\n            \"content\": {\n                \"message_type\": \"ATTACHMENT\",\n                \"attachment\": {\n                    \"type\": \"image\",\n                    \"caption\": \"Natural Beauty\",\n                    \"url\": \"https://miro.medium.com/max/780/1*9Wdo1PuiJTZo0Du2A9JLQQ.jpeg\"\n                }\n            },\n            \"recipients\": [\n                {\n                    \"recipient\": \"{recipient}\",\n                    \"recipient_type\": \"individual\"\n                }\n            ],\n            \"report_url\": \"https://webhook.site/4235f691-13ab-448e-b100-74a3a627927f\"\n        }\n    ]\n}", null, "application/json");
 request.Content = content;
 var response = await client.SendAsync(request);
 response.EnsureSuccessStatusCode();
 Console.WriteLine(await response.Content.ReadAsStringAsync());
Media type: Video
 curl --location 'https://apialpha.d7networks.com/whatsapp/v2/send' \
 --header 'Content-Type: application/json' \
 --header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc' \
 --data-raw '{
     "messages": [
         {
             "originator": "{registered phone_number}",
             "content": {
                 "message_type": "ATTACHMENT",
                 "attachment": {
                     "type": "video",
                     "url": "http://www.onirikal.com/videos/mp4/nestlegold.mp4",
                     "caption": "D7 Video Test"
                 }
             },
             "recipients": [
                 {
                     "recipient": "{recipient}",
                     "recipient_type": "individual",
                     "cust_ref": "[email protected]",
                     "message_tag1": "chatbot1234",
                     "conversation_id": "conv1234"
                 }
             ],
             "report_url": "https://webhook.site/f2615b62-1f28-4215-963d-117280cc6c4e"
         }
     ]
 }'
npm i direct7
1
2
3
4
5
6
7
const Client = require('direct7')

const client = new Client(apiToken="Your API token")

const response = await client.whatsapp.sendWhatsAppFreeformMessage({originator="91906152XXXX", recipient="91906152XXXX",message_type: "ATTACHMENT", type: "video", "http://www.onirikal.com/videos/mp4/nestlegold.mp4",caption="D7 Video Test"});

console.log(response);
pip install direct7
1
2
3
4
5
from direct7 import Client

client = Client(api_token="Your API token")

client.whatsapp.send_whatsapp_freeform_message(originator="91906152XXXX", recipient="91906152XXXX", message_type="ATTACHMENT", type="video", url="http://www.onirikal.com/videos/mp4/nestlegold.mp4",caption="D7 Video Test")

composer require direct7/direct7-php
require_once 'vendor/autoload.php';
1
2
3
4
5
6
7
8
9
require_once __DIR__ . '/vendor/autoload.php';

use direct7\Direct7\Client;

$client = new Client(api_token="Your API token")

$response = $direct7->whatsapp->sendWhatsAppFreeformMessage(originator:"{registered_phonenumber}", recipient:"{recipient}", message_type:"ATTACHMENT", type: "image", url: "https://upload.wikimedia.org", caption: "test");

var_dump($response);
go get -u github.com/d7networks/direct7-go-sdk
import (
"github.com/d7networks/direct7-go-sdk/direct7"
)
apiToken := "Your Api Token"
client := direct7.NewClient(apiToken)
whatsapp := direct7.NewWhatsApp(client)
originator := "{registered_phonenumber}"
recipient := "{recipient}"
messageType := "ATTACHMENT"
optParams := &OptionalParams{
                "attachmentType":"video",
                "attachmentURL": "http://www.onirikal.com/videos/mp4/nestlegold.mp4",
                "attachmentCaption": "D7 Video Test"
            }
response, err := whatsapp.SendWhatsAppFreeformMessage(originator, recipient, messageType, optParams)
 OkHttpClient client = new OkHttpClient().newBuilder().build();
 MediaType mediaType = MediaType.parse("application/json");
 RequestBody body = RequestBody.create(mediaType, "{\n    \"messages\": [\n        {\n            \"originator\": \"{registered phone_number}\",\n            \"content\": {\n                \"message_type\": \"ATTACHMENT\",\n                \"attachment\": {\n                    \"type\": \"video\",\n                    \"url\": \"http://www.onirikal.com/videos/mp4/nestlegold.mp4\",\n                    \"caption\": \"D7 Video Test\"\n                }\n            },\n            \"recipients\": [\n                {\n                    \"recipient\": \"{recipient}\",\n                    \"recipient_type\": \"individual\",\n                    \"cust_ref\": \"[email protected]\",\n                    \"message_tag1\": \"chatbot1234\",\n                    \"conversation_id\": \"conv1234\"\n                }\n            ],\n            \"report_url\": \"https://webhook.site/f2615b62-1f28-4215-963d-117280cc6c4e\"\n        }\n    ]\n}");
 Request request = new Request.Builder()
 .url("https://apialpha.d7networks.com/whatsapp/v2/send")
 .method("POST", body)
 .addHeader("Content-Type", "application/json")
 .addHeader("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc")
 .build();
 Response response = client.newCall(request).execute();
var headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc'
};
var request = http.Request('POST', Uri.parse('https://apialpha.d7networks.com/whatsapp/v2/send'));
request.body = json.encode({
"messages": [
{
"originator": "{registered phone_number}",
"content": {
"message_type": "ATTACHMENT",
"attachment": {
"type": "video",
"url": "http://www.onirikal.com/videos/mp4/nestlegold.mp4",
"caption": "D7 Video Test"
}
},
"recipients": [
{
"recipient": "{recipient}",
"recipient_type": "individual",
"cust_ref": "[email protected]",
"message_tag1": "chatbot1234",
"conversation_id": "conv1234"
}
],
"report_url": "https://webhook.site/f2615b62-1f28-4215-963d-117280cc6c4e"
}
]
});
request.headers.addAll(headers);

http.StreamedResponse response = await request.send();

if (response.statusCode == 200) {
print(await response.stream.bytesToString());
}
else {
print(response.reasonPhrase);
}
 $headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
 $headers.Add("Content-Type", "application/json")
 $headers.Add("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc")

 $body = @"
 {
 `"messages`": [
 {
 `"originator`": `"{registered phone_number}`",
 `"content`": {
 `"message_type`": `"ATTACHMENT`",
 `"attachment`": {
 `"type`": `"video`",
 `"url`": `"http://www.onirikal.com/videos/mp4/nestlegold.mp4`",
 `"caption`": `"D7 Video Test`"
 }
 },
 `"recipients`": [
 {
 `"recipient`": `"{recipient}`",
 `"recipient_type`": `"individual`",
 `"cust_ref`": `"[email protected]`",
 `"message_tag1`": `"chatbot1234`",
 `"conversation_id`": `"conv1234`"
 }
 ],
 `"report_url`": `"https://webhook.site/f2615b62-1f28-4215-963d-117280cc6c4e`"
 }
 ]
 }
 "@

 $response = Invoke-RestMethod 'https://apialpha.d7networks.com/whatsapp/v2/send' -Method 'POST' -Headers $headers -Body $body
 $response | ConvertTo-Json
gem install direct7
1
2
3
4
5
require 'direct7'

client = Direct7::Client.new('Your API token')

client.whatsapp.send_whatsapp_freeform_message(originator = "91906152XXXX", recipient = "91999999XXXX",message_type= "ATTACHMENT", type= "video", url= "http://www.onirikal.com/videos/mp4/nestlegold.mp4", caption= "D7 Video Test")
1
2
3
4
5
6
7
8
 var client = new HttpClient();
 var request = new HttpRequestMessage(HttpMethod.Post, "https://apialpha.d7networks.com/whatsapp/v2/send");
 request.Headers.Add("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc");
 var content = new StringContent("{\n    \"messages\": [\n        {\n            \"originator\": \"{registered phone_number}\",\n            \"content\": {\n                \"message_type\": \"ATTACHMENT\",\n                \"attachment\": {\n                    \"type\": \"video\",\n                    \"url\": \"http://www.onirikal.com/videos/mp4/nestlegold.mp4\",\n                    \"caption\": \"D7 Video Test\"\n                }\n            },\n            \"recipients\": [\n                {\n                    \"recipient\": \"{recipient}\",\n                    \"recipient_type\": \"individual\",\n                    \"cust_ref\": \"[email protected]\",\n                    \"message_tag1\": \"chatbot1234\",\n                    \"conversation_id\": \"conv1234\"\n                }\n            ],\n            \"report_url\": \"https://webhook.site/f2615b62-1f28-4215-963d-117280cc6c4e\"\n        }\n    ]\n}", null, "application/json");
 request.Content = content;
 var response = await client.SendAsync(request);
 response.EnsureSuccessStatusCode();
 Console.WriteLine(await response.Content.ReadAsStringAsync());
Media type: Document
 curl --location 'https://apialpha.d7networks.com/whatsapp/v2/send' \
 --header 'Content-Type: application/json' \
 --header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc' \
 --data-raw '{
     "messages": [
         {
             "originator": "{registered phone_number}",
             "content": {
                 "message_type": "ATTACHMENT",
                 "attachment": {
                     "type": "document",
                     "url": "http://www.africau.edu/images/default/sample.pdf",
                     "caption": "flight-ticket.pdf"
                 }
             },
             "recipients": [
                 {
                     "recipient": "{recipient}",
                     "recipient_type": "individual",
                     "cust_ref": "[email protected]",
                     "message_tag1": "chatbot1234",
                     "conversation_id": "conv1234"
                 }
             ],
             "report_url": "https://webhook.site/804c7071-fefc-4887-a252-a9b73da7a60e"
         }
     ]
 }'
npm i direct7
1
2
3
4
5
6
7
const Client = require('direct7')

const client = new Client(apiToken="Your API token")

const response = await client.whatsapp.sendWhatsAppFreeformMessage({originator: "{registered_phonenumber}", recipient: "{recipient}",message_type: "ATTACHMENT", type: "document", url: "http://www.africau.edu/images/default/sample.pdf", caption: "flight-ticket.pdf"});

console.log(response);
pip install direct7
1
2
3
4
5
from direct7 import Client

client = Client(api_token="Your API token")

client.whatsapp.send_whatsapp_freeform_message(originator="{registered_phonenumber}", recipient="{recipient}", message_type="ATTACHMENT", type="document", url="http://www.africau.edu/images/default/sample.pdf", caption="flight-ticket.pdf")

composer require direct7/direct7-php
require_once 'vendor/autoload.php';
1
2
3
4
5
6
7
8
9
require_once __DIR__ . '/vendor/autoload.php';

use direct7\Direct7\Client;

$client = new Client(api_token="Your API token")

$response = $direct7->whatsapp->sendWhatsAppFreeformMessage(originator:"{registered_phonenumber}", recipient:"{recipient}", message_type:"ATTACHMENT", type: "document", url: "http://www.africau.edu/images/default/sample.pdf", caption: "flight-ticket.pdf");

var_dump($response);
go get -u github.com/d7networks/direct7-go-sdk
import (
"github.com/d7networks/direct7-go-sdk/direct7"
)
apiToken := "Your Api Token"
client := direct7.NewClient(apiToken)
whatsapp := direct7.NewWhatsApp(client)
originator := "{registered_phonenumber}"
recipient := "{recipient}"
messageType := "ATTACHMENT"
optParams := &OptionalParams{
                "attachmentType":"document",
                "attachmentURL": "http://www.africau.edu/images/default/sample.pdf",
                "attachmentCaption": "flight-ticket.pdf"
            }
response, err := whatsapp.SendWhatsAppFreeformMessage(originator, recipient, messageType, optParams)
 OkHttpClient client = new OkHttpClient().newBuilder().build();
 MediaType mediaType = MediaType.parse("application/json");
 RequestBody body = RequestBody.create(mediaType, "{\n    \"messages\": [\n        {\n            \"originator\": \"{registered phone_number}\",\n            \"content\": {\n                \"message_type\": \"ATTACHMENT\",\n                \"attachment\": {\n                    \"type\": \"document\",\n                    \"url\": \"http://www.africau.edu/images/default/sample.pdf\",\n                    \"caption\": \"flight-ticket.pdf\"\n                }\n            },\n            \"recipients\": [\n                {\n                    \"recipient\": \"{recipient}\",\n                    \"recipient_type\": \"individual\",\n                    \"cust_ref\": \"[email protected]\",\n                    \"message_tag1\": \"chatbot1234\",\n                    \"conversation_id\": \"conv1234\"\n                }\n            ],\n            \"report_url\": \"https://webhook.site/804c7071-fefc-4887-a252-a9b73da7a60e\"\n        }\n    ]\n}");
 Request request = new Request.Builder()
   .url("https://apialpha.d7networks.com/whatsapp/v2/send")
   .method("POST", body)
   .addHeader("Content-Type", "application/json")
   .addHeader("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc")
   .build();
 Response response = client.newCall(request).execute();
 var headers = {
   'Content-Type': 'application/json',
   'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc'
 };
 var request = http.Request('POST', Uri.parse('https://apialpha.d7networks.com/whatsapp/v2/send'));
 request.body = json.encode({
   "messages": [
     {
       "originator": "{registered phone_number}",
       "content": {
         "message_type": "ATTACHMENT",
         "attachment": {
           "type": "document",
           "url": "http://www.africau.edu/images/default/sample.pdf",
           "caption": "flight-ticket.pdf"
         }
       },
       "recipients": [
         {
           "recipient": "{recipient}",
           "recipient_type": "individual",
           "cust_ref": "[email protected]",
           "message_tag1": "chatbot1234",
           "conversation_id": "conv1234"
         }
       ],
       "report_url": "https://webhook.site/804c7071-fefc-4887-a252-a9b73da7a60e"
     }
   ]
 });
 request.headers.addAll(headers);

 http.StreamedResponse response = await request.send();

 if (response.statusCode == 200) {
   print(await response.stream.bytesToString());
 }
 else {
   print(response.reasonPhrase);
 }
 $headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
 $headers.Add("Content-Type", "application/json")
 $headers.Add("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc")

 $body = @"
 {
     `"messages`": [
         {
             `"originator`": `"{registered phone_number}`",
             `"content`": {
                 `"message_type`": `"ATTACHMENT`",
                 `"attachment`": {
                     `"type`": `"document`",
                     `"url`": `"http://www.africau.edu/images/default/sample.pdf`",
                     `"caption`": `"flight-ticket.pdf`"
                 }
             },
             `"recipients`": [
                 {
                     `"recipient`": `"{recipient}`",
                     `"recipient_type`": `"individual`",
                     `"cust_ref`": `"[email protected]`",
                     `"message_tag1`": `"chatbot1234`",
                     `"conversation_id`": `"conv1234`"
                 }
             ],
             `"report_url`": `"https://webhook.site/804c7071-fefc-4887-a252-a9b73da7a60e`"
         }
     ]
 }
 "@

 $response = Invoke-RestMethod 'https://apialpha.d7networks.com/whatsapp/v2/send' -Method 'POST' -Headers $headers -Body $body
 $response | ConvertTo-Json
gem install direct7
1
2
3
4
5
require 'direct7'

client = Direct7::Client.new('Your API token')

client.whatsapp.send_whatsapp_freeform_message(originator = "91906152XXXX", recipient = "91999999XXXX",message_type= "ATTACHMENT", type= "document", url= "http://www.africau.edu/images/default/sample.pdf", caption= "flight-ticket.pdf")
1
2
3
4
5
6
7
8
 var client = new HttpClient();
 var request = new HttpRequestMessage(HttpMethod.Post, "https://apialpha.d7networks.com/whatsapp/v2/send");
 request.Headers.Add("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc");
 var content = new StringContent("{\n    \"messages\": [\n        {\n            \"originator\": \"{registered phone_number}\",\n            \"content\": {\n                \"message_type\": \"ATTACHMENT\",\n                \"attachment\": {\n                    \"type\": \"document\",\n                    \"url\": \"http://www.africau.edu/images/default/sample.pdf\",\n                    \"caption\": \"flight-ticket.pdf\"\n                }\n            },\n            \"recipients\": [\n                {\n                    \"recipient\": \"{recipient}\",\n                    \"recipient_type\": \"individual\",\n                    \"cust_ref\": \"[email protected]\",\n                    \"message_tag1\": \"chatbot1234\",\n                    \"conversation_id\": \"conv1234\"\n                }\n            ],\n            \"report_url\": \"https://webhook.site/804c7071-fefc-4887-a252-a9b73da7a60e\"\n        }\n    ]\n}", null, "application/json");
 request.Content = content;
 var response = await client.SendAsync(request);
 response.EnsureSuccessStatusCode();
 Console.WriteLine(await response.Content.ReadAsStringAsync());
Media type: Audio
 curl --location 'https://apialpha.d7networks.com/whatsapp/v2/send' \
 --header 'Content-Type: application/json' \
 --header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc' \
 --data '{
     "messages": [
         {
             "originator": "{registered phone_number",
             "content": {
                 "message_type": "ATTACHMENT",
                 "attachment": {
                     "type":"audio",
                     "url":  "http://fate-suite.ffmpeg.org/mpegaudio/extra_overread.mp3"
                 }
             },
             "recipients": [{
                 "recipient": "{recipient}",
                 "recipient_type": "individual",
                 "cust_ref":"abc"
             }],
             "report_url": "https://webhook.site/804c7071-fefc-4887-a252-a9b73da7a60e"
         }
     ]
 }'
npm i direct7
1
2
3
4
5
6
7
const Client = require('direct7')

const client = new Client(apiToken="Your API token")

const response = await client.whatsapp.sendWhatsAppFreeformMessage({originator: "{registered_phonenumber}", recipient: "{recipient}", message_type: "ATTACHMENT", type: "audio", url: "http://fate-suite.ffmpeg.org/mpegaudio/extra_overread.mp3"});

console.log(response);
pip install direct7
1
2
3
4
5
from direct7 import Client

client = Client(api_token="Your API token")

client.whatsapp.send_whatsapp_freeform_message(originator="91906152XXXX", recipient="91906152XXXX", message_type="ATTACHMENT", type="audio", url="http://fate-suite.ffmpeg.org/mpegaudio/extra_overread.mp3")

composer require direct7/direct7-php
require_once 'vendor/autoload.php';
1
2
3
4
5
6
7
8
9
require_once __DIR__ . '/vendor/autoload.php';

use direct7\Direct7\Client;

$client = new Client(api_token="Your API token")

$$response = $direct7->whatsapp->sendWhatsAppFreeformMessage(originator:"{registered_phonenumber}", recipient:"{recipient}", message_type:"ATTACHMENT", type: "audio", url: "http://fate-suite.ffmpeg.org/mpegaudio/extra_overread.mp3");

var_dump($response);
go get -u github.com/d7networks/direct7-go-sdk
import (
"github.com/d7networks/direct7-go-sdk/direct7"
)
apiToken := "Your Api Token"
client := direct7.NewClient(apiToken)
whatsapp := direct7.NewWhatsApp(client)
originator := "{registered_phonenumber}"
recipient := "{recipient}"
messageType := "ATTACHMENT"
optParams := &OptionalParams{
                "attachmentType":"audio",
                "attachmentURL": "http://fate-suite.ffmpeg.org/mpegaudio/extra_overread.mp3"
            }
response, err := whatsapp.SendWhatsAppFreeformMessage(originator, recipient, messageType, optParams)
 OkHttpClient client = new OkHttpClient().newBuilder().build();
 MediaType mediaType = MediaType.parse("application/json");
 RequestBody body = RequestBody.create(mediaType, "{\n    \"messages\": [\n        {\n            \"originator\": \"{registered phone_number\",\n            \"content\": {\n                \"message_type\": \"ATTACHMENT\",\n                \"attachment\": {\n                    \"type\":\"audio\",\n                    \"url\":  \"http://fate-suite.ffmpeg.org/mpegaudio/extra_overread.mp3\"\n                }\n            },\n            \"recipients\": [{\n                \"recipient\": \"{recipient}\",\n                \"recipient_type\": \"individual\",\n                \"cust_ref\":\"abc\"\n            }],\n            \"report_url\": \"https://webhook.site/804c7071-fefc-4887-a252-a9b73da7a60e\"\n        }\n    ]\n}");
 Request request = new Request.Builder()
   .url("https://apialpha.d7networks.com/whatsapp/v2/send")
   .method("POST", body)
   .addHeader("Content-Type", "application/json")
   .addHeader("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc")
   .build();
 Response response = client.newCall(request).execute();
 var headers = {
   'Content-Type': 'application/json',
   'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc'
 };
 var request = http.Request('POST', Uri.parse('https://apialpha.d7networks.com/whatsapp/v2/send'));
 request.body = json.encode({
   "messages": [
     {
       "originator": "{registered phone_number",
       "content": {
         "message_type": "ATTACHMENT",
         "attachment": {
           "type": "audio",
           "url": "http://fate-suite.ffmpeg.org/mpegaudio/extra_overread.mp3"
         }
       },
       "recipients": [
         {
           "recipient": "{recipient}",
           "recipient_type": "individual",
           "cust_ref": "abc"
         }
       ],
       "report_url": "https://webhook.site/804c7071-fefc-4887-a252-a9b73da7a60e"
     }
   ]
 });
 request.headers.addAll(headers);

 http.StreamedResponse response = await request.send();

 if (response.statusCode == 200) {
   print(await response.stream.bytesToString());
 }
 else {
   print(response.reasonPhrase);
 }
 $headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
 $headers.Add("Content-Type", "application/json")
 $headers.Add("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc")

 $body = @"
 {
     `"messages`": [
         {
             `"originator`": `"{registered phone_number`",
             `"content`": {
                 `"message_type`": `"ATTACHMENT`",
                 `"attachment`": {
                     `"type`":`"audio`",
                     `"url`":  `"http://fate-suite.ffmpeg.org/mpegaudio/extra_overread.mp3`"
                 }
             },
             `"recipients`": [{
                 `"recipient`": `"{recipient}`",
                 `"recipient_type`": `"individual`",
                 `"cust_ref`":`"abc`"
             }],
             `"report_url`": `"https://webhook.site/804c7071-fefc-4887-a252-a9b73da7a60e`"
         }
     ]
 }
 "@

 $response = Invoke-RestMethod 'https://apialpha.d7networks.com/whatsapp/v2/send' -Method 'POST' -Headers $headers -Body $body
 $response | ConvertTo-Json
gem install direct7
1
2
3
4
5
require 'direct7'

client = Direct7::Client.new('Your API token')

client.whatsapp.send_whatsapp_freeform_message(originator = "91906152XXXX", recipient = "91999999XXXX",message_type= "ATTACHMENT", type= "audio", url= "http://fate-suite.ffmpeg.org/mpegaudio/extra_overread.mp3")
1
2
3
4
5
6
7
8
 var client = new HttpClient();
 var request = new HttpRequestMessage(HttpMethod.Post, "https://apialpha.d7networks.com/whatsapp/v2/send");
 request.Headers.Add("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc");
 var content = new StringContent("{\n    \"messages\": [\n        {\n            \"originator\": \"{registered phone_number\",\n            \"content\": {\n                \"message_type\": \"ATTACHMENT\",\n                \"attachment\": {\n                    \"type\":\"audio\",\n                    \"url\":  \"http://fate-suite.ffmpeg.org/mpegaudio/extra_overread.mp3\"\n                }\n            },\n            \"recipients\": [{\n                \"recipient\": \"{recipient}\",\n                \"recipient_type\": \"individual\",\n                \"cust_ref\":\"abc\"\n            }],\n            \"report_url\": \"https://webhook.site/804c7071-fefc-4887-a252-a9b73da7a60e\"\n        }\n    ]\n}", null, "application/json");
 request.Content = content;
 var response = await client.SendAsync(request);
 response.EnsureSuccessStatusCode();
 Console.WriteLine(await response.Content.ReadAsStringAsync());
Media type: Sticker
 curl --location 'https://apialpha.d7networks.com/whatsapp/v2/send' \
 --header 'Content-Type: application/json' \
 --header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc' \
 --data-raw '{
     "messages": [
         {
             "originator": "{registered phone_number}",
             "content": {
                 "message_type": "ATTACHMENT",
                 "attachment": {
                     "type": "sticker",
                     "url": "https://raw.githubusercontent.com/sagarbhavsar4328/dummys3bucket/master/sample3.webp"
                 }
             },
             "recipients": [
                 {
                     "recipient": "{recipient}",
                     "recipient_type": "individual",
                     "cust_ref": "[email protected]",
                     "message_tag1": "chatbot1234",
                     "conversation_id": "conv1234"
                 }
             ],
             "report_url": "https://webhook.site/804c7071-fefc-4887-a252-a9b73da7a60e"
         }
     ]
 }'
npm i direct7
1
2
3
4
5
const Client = require('direct7')

const client = new Client(apiToken="Your API token")

const response = await client.whatsapp.sendWhatsAppFreeformMessage({originator: "{registered_phonenumber}", recipient: "{recipient}", type: "sticker", url: "https://raw.githubusercontent.com/sagarbhavsar4328/dummys3bucket/master/sample3.webp"});
pip install direct7
1
2
3
4
5
from direct7 import Client

client = Client(api_token="Your API token")

client.whatsapp.send_whatsapp_freeform_message(originator="91906152XXXX", recipient="91906152XXXX", message_type="ATTACHMENT", type="sticker", url="https://raw.githubusercontent.com/sagarbhavsar4328/dummys3bucket/master/sample3.webp")

composer require direct7/direct7-php
require_once 'vendor/autoload.php';
require_once __DIR__ . '/vendor/autoload.php';

use direct7\Direct7\Client;

$client = new Client(api_token="Your API token")

$body_parameter_values = ["0" => 'first_parameter_in_your_template', "1" => 'second_parameter_in_your_template']

$response = $direct7->whatsapp->sendWhatsAppFreeformMessage(originator:"{registered_phonenumber}", recipient:"{recipient}", message_type:"ATTACHMENT", type: "sticker", url: "https://raw.githubusercontent.com/sagarbhavsar4328/dummys3bucket/master/sample3.webp");

var_dump($response);
go get -u github.com/d7networks/direct7-go-sdk
import (
"github.com/d7networks/direct7-go-sdk/direct7"
)
apiToken := "Your Api Token"
client := direct7.NewClient(apiToken)
whatsapp := direct7.NewWhatsApp(client)
originator := "{registered_phonenumber}"
recipient := "{recipient}"
messageType := "ATTACHMENT"
optParams := &OptionalParams{
                "attachmentType":"sticker",
                "attachmentURL": "https://raw.githubusercontent.com/sagarbhavsar4328/dummys3bucket/master/sample3.webp"
            }
response, err := whatsapp.SendWhatsAppFreeformMessage(originator, recipient, messageType, optParams)
 OkHttpClient client = new OkHttpClient().newBuilder().build();
 MediaType mediaType = MediaType.parse("application/json");
 RequestBody body = RequestBody.create(mediaType, "{\n    \"messages\": [\n        {\n            \"originator\": \"{registered phone_number}\",\n            \"content\": {\n                \"message_type\": \"ATTACHMENT\",\n                \"attachment\": {\n                    \"type\": \"sticker\",\n                    \"url\": \"https://raw.githubusercontent.com/sagarbhavsar4328/dummys3bucket/master/sample3.webp\"\n                }\n            },\n            \"recipients\": [\n                {\n                    \"recipient\": \"{recipient}\",\n                    \"recipient_type\": \"individual\",\n                    \"cust_ref\": \"[email protected]\",\n                    \"message_tag1\": \"chatbot1234\",\n                    \"conversation_id\": \"conv1234\"\n                }\n            ],\n            \"report_url\": \"https://webhook.site/804c7071-fefc-4887-a252-a9b73da7a60e\"\n        }\n    ]\n}");
 Request request = new Request.Builder()
   .url("https://apialpha.d7networks.com/whatsapp/v2/send")
   .method("POST", body)
   .addHeader("Content-Type", "application/json")
   .addHeader("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc")
   .build();
 Response response = client.newCall(request).execute(); 
 var headers = {
   'Content-Type': 'application/json',
   'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc'
 };
 var request = http.Request('POST', Uri.parse('https://apialpha.d7networks.com/whatsapp/v2/send'));
 request.body = json.encode({
   "messages": [
     {
       "originator": "{registered phone_number}",
       "content": {
         "message_type": "ATTACHMENT",
         "attachment": {
           "type": "sticker",
           "url": "https://raw.githubusercontent.com/sagarbhavsar4328/dummys3bucket/master/sample3.webp"
         }
       },
       "recipients": [
         {
           "recipient": "{recipient}",
           "recipient_type": "individual",
           "cust_ref": "[email protected]",
           "message_tag1": "chatbot1234",
           "conversation_id": "conv1234"
         }
       ],
       "report_url": "https://webhook.site/804c7071-fefc-4887-a252-a9b73da7a60e"
     }
   ]
 });
 request.headers.addAll(headers);

 http.StreamedResponse response = await request.send();

 if (response.statusCode == 200) {
   print(await response.stream.bytesToString());
 }
 else {
   print(response.reasonPhrase);
 }
 $headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
 $headers.Add("Content-Type", "application/json")
 $headers.Add("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc")

 $body = @"
 {
     `"messages`": [
         {
             `"originator`": `"{registered phone_number}`",
             `"content`": {
                 `"message_type`": `"ATTACHMENT`",
                 `"attachment`": {
                     `"type`": `"sticker`",
                     `"url`": `"https://raw.githubusercontent.com/sagarbhavsar4328/dummys3bucket/master/sample3.webp`"
                 }
             },
             `"recipients`": [
                 {
                     `"recipient`": `"{recipient}`",
                     `"recipient_type`": `"individual`",
                     `"cust_ref`": `"[email protected]`",
                     `"message_tag1`": `"chatbot1234`",
                     `"conversation_id`": `"conv1234`"
                 }
             ],
             `"report_url`": `"https://webhook.site/804c7071-fefc-4887-a252-a9b73da7a60e`"
         }
     ]
 }
 "@

 $response = Invoke-RestMethod 'https://apialpha.d7networks.com/whatsapp/v2/send' -Method 'POST' -Headers $headers -Body $body
 $response | ConvertTo-Json
gem install direct7
1
2
3
4
5
require 'direct7'

client = Direct7::Client.new('Your API token')

 client.whatsapp.send_whatsapp_freeform_message(originator = "91906152XXXX", recipient = "91999999XXXX",message_type= "ATTACHMENT", type= "sticker", url= "https://raw.githubusercontent.com/sagarbhavsar4328/dummys3bucket/master/sample3.webp")
1
2
3
4
5
6
7
8
 var client = new HttpClient();
 var request = new HttpRequestMessage(HttpMethod.Post, "https://apialpha.d7networks.com/whatsapp/v2/send");
 request.Headers.Add("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc");
 var content = new StringContent("{\n    \"messages\": [\n        {\n            \"originator\": \"{registered phone_number}\",\n            \"content\": {\n                \"message_type\": \"ATTACHMENT\",\n                \"attachment\": {\n                    \"type\": \"sticker\",\n                    \"url\": \"https://raw.githubusercontent.com/sagarbhavsar4328/dummys3bucket/master/sample3.webp\"\n                }\n            },\n            \"recipients\": [\n                {\n                    \"recipient\": \"{recipient}\",\n                    \"recipient_type\": \"individual\",\n                    \"cust_ref\": \"[email protected]\",\n                    \"message_tag1\": \"chatbot1234\",\n                    \"conversation_id\": \"conv1234\"\n                }\n            ],\n            \"report_url\": \"https://webhook.site/804c7071-fefc-4887-a252-a9b73da7a60e\"\n        }\n    ]\n}", null, "application/json");
 request.Content = content;
 var response = await client.SendAsync(request);
 response.EnsureSuccessStatusCode();
 Console.WriteLine(await response.Content.ReadAsStringAsync());

4. Location message

 curl --location 'https://apialpha.d7networks.com/whatsapp/v2/send' \
 --header 'Content-Type: application/json' \
 --header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc' \
 --data-raw '{
     "messages": [
         {
             "originator": "{registered phone_number}",
             "content": {
                 "message_type": "LOCATION",
                 "location": {
                     "longitude": 77.6109,
                     "latitude": 12.9379,
                     "name": "KARIxx PRIVATE LIMITED",
                     "address": " 30, Hosur Main Road"
                 }
             },
             "recipients": [
                 {
                     "recipient": "{recipient}",
                     "recipient_type": "individual",
                     "cust_ref": "[email protected]",
                     "message_tag1": "chatbot1234",
                     "conversation_id": "conv1234"
                 }
             ],
             "report_url": "https://webhook.site/e8839c21-2de3-499f-90a9-be31fd0cddb7"
         }
     ]
 }'
npm i direct7
1
2
3
4
5
6
7
8
9
const Client = require('direct7')

const client = new Client(apiToken="Your API token")

const response = await client.whatsapp.sendWhatsAppFreeformMessage({
            originator : "{registered_phonenumber}", recipient : "{recipient}", message_type: "LOCATION",  longitude : "77.6109", latitude:"12.9379", address:"Address", name:"Name"
        });

console.log(response);
pip install direct7
1
2
3
4
5
from direct7 import Client

client = Client(api_token="Your API token")

client.whatsapp.send_whatsapp_freeform_message(originator="91906152XXXX", recipient="91906152XXXX", message_type="LOCATION", longitude= "77.6109", latitude="12.9379,name="KARIxx PRIVATE LIMITED", address="30, Hosur Main Road")

composer require direct7/direct7-php
require_once 'vendor/autoload.php';
require_once __DIR__ . '/vendor/autoload.php';

use direct7\Direct7\Client;

$client = new Client(api_token="Your API token")

$body_parameter_values = ["0" => 'first_parameter_in_your_template', "1" => 'second_parameter_in_your_template']

$response = $direct7->whatsapp->sendWhatsAppFreeformMessage(originator:"{registered_phonenumber}", recipient:"{recipient}", message_type:"LOCATION", latitude: "12.93803129081362", longitude: "77.61088653615994", name: "Pvt Ltd", address: "Bengaluru, Karnataka");

var_dump($response);
go get -u github.com/d7networks/direct7-go-sdk
import (
"github.com/d7networks/direct7-go-sdk/direct7"
)
apiToken := "Your Api Token"
client := direct7.NewClient(apiToken)
whatsapp := direct7.NewWhatsApp(client)
originator := "{registered_phonenumber}"
recipient := "{recipient}"
messageType := "LOCATION"
optParams := &OptionalParams{
                "longitude": 77.1249,
                "latitude": 12.8779,
                "name": "NameOfLocation",
                "address": "AddressOfLocation"
            }
response, err := whatsapp.SendWhatsAppFreeformMessage(originator, recipient, messageType, optParams)
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n    \"messages\": [\n        {\n            \"originator\": \"{registered phone_number}\",\n            \"content\": {\n                \"message_type\": \"LOCATION\",\n                \"location\": {\n                    \"longitude\": 77.6109,\n                    \"latitude\": 12.9379,\n                    \"name\": \"KARIxx PRIVATE LIMITED\",\n                    \"address\": \" 30, Hosur Main Road\"\n                }\n            },\n            \"recipients\": [\n                {\n                    \"recipient\": \"{recipient}\",\n                    \"recipient_type\": \"individual\",\n                    \"cust_ref\": \"[email protected]\",\n                    \"message_tag1\": \"chatbot1234\",\n                    \"conversation_id\": \"conv1234\"\n                }\n            ],\n            \"report_url\": \"https://webhook.site/e8839c21-2de3-499f-90a9-be31fd0cddb7\"\n        }\n    ]\n}");
Request request = new Request.Builder()
  .url("https://apialpha.d7networks.com/whatsapp/v2/send")
  .method("POST", body)
  .addHeader("Content-Type", "application/json")
  .addHeader("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc")
  .build();
Response response = client.newCall(request).execute();
var headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc'
};
var request = http.Request('POST', Uri.parse('https://apialpha.d7networks.com/whatsapp/v2/send'));
request.body = json.encode({
  "messages": [
    {
      "originator": "{registered phone_number}",
      "content": {
        "message_type": "LOCATION",
        "location": {
          "longitude": 77.6109,
          "latitude": 12.9379,
          "name": "KARIxx PRIVATE LIMITED",
          "address": " 30, Hosur Main Road"
        }
      },
      "recipients": [
        {
          "recipient": "{recipient}",
          "recipient_type": "individual",
          "cust_ref": "[email protected]",
          "message_tag1": "chatbot1234",
          "conversation_id": "conv1234"
        }
      ],
      "report_url": "https://webhook.site/e8839c21-2de3-499f-90a9-be31fd0cddb7"
    }
  ]
});
request.headers.addAll(headers);

http.StreamedResponse response = await request.send();

if (response.statusCode == 200) {
  print(await response.stream.bytesToString());
}
else {
  print(response.reasonPhrase);
}
 $headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
 $headers.Add("Content-Type", "application/json")
 $headers.Add("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc")

 $body = @"
 {
 `"messages`": [
 {
 `"originator`": `"{registered phone_number}`",
 `"content`": {
 `"message_type`": `"LOCATION`",
 `"location`": {
 `"longitude`": 77.6109,
 `"latitude`": 12.9379,
 `"name`": `"KARIxx PRIVATE LIMITED`",
 `"address`": `" 30, Hosur Main Road`"
 }
 },
 `"recipients`": [
 {
 `"recipient`": `"{recipient}`",
 `"recipient_type`": `"individual`",
 `"cust_ref`": `"[email protected]`",
 `"message_tag1`": `"chatbot1234`",
 `"conversation_id`": `"conv1234`"
 }
 ],
 `"report_url`": `"https://webhook.site/e8839c21-2de3-499f-90a9-be31fd0cddb7`"
 }
 ]
 }
 "@

 $response = Invoke-RestMethod 'https://apialpha.d7networks.com/whatsapp/v2/send' -Method 'POST' -Headers $headers -Body $body
 $response | ConvertTo-Json
gem install direct7
1
2
3
4
5
require 'direct7'

client = Direct7::Client.new('Your API token')

client.whatsapp.send_whatsapp_freeform_message(originator = "91906152XXXX", recipient = "91999999XXXX", message_type= "LOCATION",  longitude = "77.6109", latitude="12.9379", location_address="Address", location_name="Name")
1
2
3
4
5
6
7
8
 var client = new HttpClient();
 var request = new HttpRequestMessage(HttpMethod.Post, "https://apialpha.d7networks.com/whatsapp/v2/send");
 request.Headers.Add("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc");
 var content = new StringContent("{\n    \"messages\": [\n        {\n            \"originator\": \"{registered phone_number}\",\n            \"content\": {\n                \"message_type\": \"LOCATION\",\n                \"location\": {\n                    \"longitude\": 77.6109,\n                    \"latitude\": 12.9379,\n                    \"name\": \"KARIxx PRIVATE LIMITED\",\n                    \"address\": \" 30, Hosur Main Road\"\n                }\n            },\n            \"recipients\": [\n                {\n                    \"recipient\": \"{recipient}\",\n                    \"recipient_type\": \"individual\",\n                    \"cust_ref\": \"[email protected]\",\n                    \"message_tag1\": \"chatbot1234\",\n                    \"conversation_id\": \"conv1234\"\n                }\n            ],\n            \"report_url\": \"https://webhook.site/e8839c21-2de3-499f-90a9-be31fd0cddb7\"\n        }\n    ]\n}", null, "application/json");
 request.Content = content;
 var response = await client.SendAsync(request);
 response.EnsureSuccessStatusCode();
 Console.WriteLine(await response.Content.ReadAsStringAsync());

5. Contact message

curl --location 'https://apialpha.d7networks.com/whatsapp/v2/send' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc' \
--data-raw '{
    "messages": [
        {
            "originator": "{registered phone_number}",
            "content": {
                "message_type": "CONTACTS",
                "contacts": [{
                    "name": {
                        "first_name": "Alice",
                        "last_name": "Jane",
                        "formatted_name": "Alice Jane"},
                    "birthday":"1994-12-12",
                    "phones": [{"phone": "{recipient}"}, {"phone": "+91815678xxxx"}],
                    "emails":[{"email": "[email protected]"}],
                    "urls":[{"url": "https://d7networks.com"}]
                }]
            },
            "recipients": [{
                "recipient": "{recipient}",
                "recipient_type": "individual",
                "cust_ref":"abc"
            }]
        }
    ]
}'
npm i direct7
const Client = require('direct7')

const client = new Client(apiToken="Your API token")

const response = await client.whatsapp.sendWhatsAppFreeformMessage({
    originator: "{registered_phonenumber}",
    recipient: "{recipient}",
    message_type: "CONTACTS",
    first_name: "Alice",
    last_name: "Jane",
    formatted_name: "Alice Jane",
    phones: ["9181XXXXXXXX", "9181XXXXXXXX"],
    emails: ["[email protected]", "[email protected]"]
});
console.log(response);
pip install direct7
1
2
3
4
5
6
from direct7 import Client

client = Client(api_token="Your API token")

client.whatsapp.send_whatsapp_freeform_message(originator="91906152XXXX", recipient="91906152XXXX", message_type="CONTACTS", first_name="Alice", last_name="Jane",
birthday="1994-12-12", phones= ["{recipient}", "+91815678xxxx"], "emails":["[email protected]"],"urls":["https://d7networks.com"]    

composer require direct7/direct7-php
require_once 'vendor/autoload.php';
1
2
3
4
5
6
7
8
9
require_once __DIR__ . '/vendor/autoload.php';

use direct7\Direct7\Client;

$client = new Client(api_token="Your API token")

$response = $direct7->whatsapp->sendWhatsAppFreeformMessage(originator:"{registered_phonenumber}", recipient:"{recipient}", message_type:"CONTACTS", first_name:"Alice", last_name:"Jane", formatted_name:"Alice Jane", phones:["91906152XXXX", "91906152XXXX"], emails : ["[email protected]","[email protected]"]);

var_dump($response);
go get -u github.com/d7networks/direct7-go-sdk
import (
"github.com/d7networks/direct7-go-sdk/direct7"
)
apiToken := "Your Api Token"
client := direct7.NewClient(apiToken)
whatsapp := direct7.NewWhatsApp(client)
originator := "{registered_phonenumber}"
recipient := "{recipient}"
messageType := "CONTACTS"
optParams := &OptionalParams{
    firstName:     "Alice",
    lastName:      "Jane",
    formattedName: "Alice Jane",
    phones:  []map[string]string{{"phone": "9181XXXXXXXX"}, {"phone": "9181XXXXXXXX"}},
    emails:  []map[string]string{{"email": "[email protected]"}, {"email": "[email protected]"}},
}
response, err := client.whatsapp.SendWhatsAppFreeformMessage(originator, recipient, messageType, optParams)
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n    \"messages\": [\n        {\n            \"originator\": \"{registered phone_number}\",\n            \"content\": {\n                \"message_type\": \"CONTACTS\",\n                \"contacts\": [{\n                    \"name\": {\n                        \"first_name\": \"Alice\",\n                        \"last_name\": \"Jane\",\n                        \"formatted_name\": \"Alice Jane\"},\n                    \"birthday\":\"1994-12-12\",\n                    \"phones\": [{\"phone\": \"{recipient}\"}, {\"phone\": \"+91815678xxxx\"}],\n                    \"emails\":[{\"email\": \"[email protected]\"}],\n                    \"urls\":[{\"url\": \"https://d7networks.com\"}]\n                }]\n            },\n            \"recipients\": [{\n                \"recipient\": \"{recipient}\",\n                \"recipient_type\": \"individual\",\n                \"cust_ref\":\"abc\"\n            }]\n        }\n    ]\n}");
Request request = new Request.Builder()
  .url("https://apialpha.d7networks.com/whatsapp/v2/send")
  .method("POST", body)
  .addHeader("Content-Type", "application/json")
  .addHeader("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc")
  .build();
Response response = client.newCall(request).execute();
  var headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc'
  };
  var request = http.Request('POST', Uri.parse('https://apialpha.d7networks.com/whatsapp/v2/send'));
  request.body = json.encode({
  "messages": [
  {
  "originator": "{registered phone_number}",
  "content": {
  "message_type": "CONTACTS",
  "contacts": [
  {
  "name": {
  "first_name": "Alice",
  "last_name": "Jane",
  "formatted_name": "Alice Jane"
  },
  "birthday": "1994-12-12",
  "phones": [
  {
  "phone": "{recipient}"
  },
  {
  "phone": "+91815678xxxx"
  }
  ],
  "emails": [
  {
  "email": "[email protected]"
  }
  ],
  "urls": [
  {
  "url": "https://d7networks.com"
  }
  ]
  }
  ]
  },
  "recipients": [
  {
  "recipient": "{recipient}",
  "recipient_type": "individual",
  "cust_ref": "abc"
  }
  ]
  }
  ]
  });
  request.headers.addAll(headers);

  http.StreamedResponse response = await request.send();

  if (response.statusCode == 200) {
  print(await response.stream.bytesToString());
  }
  else {
  print(response.reasonPhrase);
  }
 $headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
 $headers.Add("Content-Type", "application/json")
 $headers.Add("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc")

 $body = @"
 {
     `"messages`": [
         {
             `"originator`": `"{registered phone_number}`",
             `"content`": {
                 `"message_type`": `"CONTACTS`",
                 `"contacts`": [{
                     `"name`": {
                         `"first_name`": `"Alice`",
                         `"last_name`": `"Jane`",
                         `"formatted_name`": `"Alice Jane`"},
                     `"birthday`":`"1994-12-12`",
                     `"phones`": [{`"phone`": `"{recipient}`"}, {`"phone`": `"+91815678xxxx`"}],
                     `"emails`":[{`"email`": `"[email protected]`"}],
                     `"urls`":[{`"url`": `"https://d7networks.com`"}]
                 }]
             },
             `"recipients`": [{
                 `"recipient`": `"{recipient}`",
                 `"recipient_type`": `"individual`",
                 `"cust_ref`":`"abc`"
             }]
         }
     ]
 }
 "@

 $response = Invoke-RestMethod 'https://apialpha.d7networks.com/whatsapp/v2/send' -Method 'POST' -Headers $headers -Body $body
 $response | ConvertTo-Json
gem install direct7
1
2
3
4
5
require 'direct7'

client = Direct7::Client.new('Your API token')

client.whatsapp.send_whatsapp_freeform_message(originator="91906152XXXX", recipient="91906152XXXX", message_type="CONTACTS", first_name="Alice", last_name="Jane", display_name="Alice Jane", phone="91906152XXXX", email = "[email protected]")
1
2
3
4
5
6
7
8
 var client = new HttpClient();
 var request = new HttpRequestMessage(HttpMethod.Post, "https://apialpha.d7networks.com/whatsapp/v2/send");
 request.Headers.Add("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc");
 var content = new StringContent("{\n    \"messages\": [\n        {\n            \"originator\": \"{registered phone_number}\",\n            \"content\": {\n                \"message_type\": \"CONTACTS\",\n                \"contacts\": [{\n                    \"name\": {\n                        \"first_name\": \"Alice\",\n                        \"last_name\": \"Jane\",\n                        \"formatted_name\": \"Alice Jane\"},\n                    \"birthday\":\"1994-12-12\",\n                    \"phones\": [{\"phone\": \"{recipient}\"}, {\"phone\": \"+91815678xxxx\"}],\n                    \"emails\":[{\"email\": \"[email protected]\"}],\n                    \"urls\":[{\"url\": \"https://d7networks.com\"}]\n                }]\n            },\n            \"recipients\": [{\n                \"recipient\": \"{recipient}\",\n                \"recipient_type\": \"individual\",\n                \"cust_ref\":\"abc\"\n            }]\n        }\n    ]\n}", null, "application/json");
 request.Content = content;
 var response = await client.SendAsync(request);
 response.EnsureSuccessStatusCode();
 Console.WriteLine(await response.Content.ReadAsStringAsync());

6. Interactive message

Interactive messages can be categorized into three, based on action object as follows:

Interactive message with type- cta_url and button can have subtypes according to the header object. Header object can be: text, image, video or document

The Interactive message with type list can only have header type text.

Header Object

   "header": {
                "type": "text",
                "text": "Payment$ for D7 Whatsapp Service"
            }
    "header": {
                "type": "image",
                "image": {
                    "link": "https://karix.s3.ap-south-1.amazonaws.com/English-4.jpg"
                }
            }
   "header": {
                "type": "video",
                "video": {
                    "link": "http://www.onirikal.com/videos/mp4/nestlegold.mp4"
                }
            }
     "header": {
                "type": "document",
                "document": {
                    "filename": "faq.pdf",
                    "link": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
                }
            }
Interactive message with type- cta_url
curl --location 'https://apialpha.d7networks.com/whatsapp/v2/send' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc' \
--data '{
    "messages": [
        {
            "originator": "{registered phone_number}",
            "content": {
                "message_type": "INTERACTIVE",
            "interactive": {
                "type": "cta_url",
                "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": {
                    "parameters": {
                      "display_text": "Visit Alpha",
                      "url": "https://www.luckyshrub.com?clickID=kqDGWd24Q5TRwoEQTICY7W1JKoXvaZOXWAS7h1P76s0R7Paec4"
                    }
                }
            }
            },
            "recipients": [{
                "recipient": "{recipient}",
                "recipient_type": "individual"
            }],
            "report_url": "https://webhook.site/4235f691-13ab-448e-b100-74a3a627927f"
        }
    ]
}'
const axios = require('axios');
let data = JSON.stringify({
  "messages": [
    {
      "originator": "{registered_phonenumber",
      "content": {
        "message_type": "INTERACTIVE",
        "interactive": {
          "type": "cta_url",
          "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": {
            "parameters": {
              "display_text": "Visit Alpha",
              "url": "https://www.luckyshrub.com?clickID=kqDGWd24Q5TRwoEQTICY7W1JKoXvaZOXWAS7h1P76s0R7Paec4"
            }
          }
        }
      },
      "recipients": [
        {
          "recipient": "{recipient}",
          "recipient_type": "individual"
        }
      ],
      "report_url": "https://webhook.site/4235f691-13ab-448e-b100-74a3a627927f"
    }
  ]
});

let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url: 'https://apialpha.d7networks.com/whatsapp/v2/send',
  headers: { 
    'Content-Type': 'application/json', 
    'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc'
  },
  data : data
};

axios.request(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});
import http.client
import json

conn = http.client.HTTPSConnection("apialpha.d7networks.com")
payload = json.dumps({
  "messages": [
    {
      "originator": "{registered phone_number}",
      "content": {
        "message_type": "INTERACTIVE",
        "interactive": {
          "type": "cta_url",
          "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": {
            "parameters": {
              "display_text": "Visit Alpha",
              "url": "https://www.luckyshrub.com?clickID=kqDGWd24Q5TRwoEQTICY7W1JKoXvaZOXWAS7h1P76s0R7Paec4"
            }
          }
        }
      },
      "recipients": [
        {
          "recipient": "{recipient}",
          "recipient_type": "individual"
        }
      ],
      "report_url": "https://webhook.site/4235f691-13ab-448e-b100-74a3a627927f"
    }
  ]
})
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc'
}
conn.request("POST", "/whatsapp/v2/send", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://apialpha.d7networks.com/whatsapp/v2/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 =>'{
    "messages": [
        {
            "originator": "{registered_phonenumber",
            "content": {
                "message_type": "INTERACTIVE",
            "interactive": {
                "type": "cta_url",
                "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": {
                    "parameters": {
                      "display_text": "Visit Alpha",
                      "url": "https://www.luckyshrub.com?clickID=kqDGWd24Q5TRwoEQTICY7W1JKoXvaZOXWAS7h1P76s0R7Paec4"
                    }
                }
            }
            },
            "recipients": [{
                "recipient": "{recipient}",
                "recipient_type": "individual"
            }],
            "report_url": "https://webhook.site/4235f691-13ab-448e-b100-74a3a627927f"
        }
    ]
}',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
   package main

import (
  "fmt"
  "strings"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://apialpha.d7networks.com/whatsapp/v2/send"
  method := "POST"

  payload := strings.NewReader(`{
    "messages": [
        {
            "originator": "{registered_phonenumber",
            "content": {
                "message_type": "INTERACTIVE",
            "interactive": {
                "type": "cta_url",
                "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": {
                    "parameters": {
                      "display_text": "Visit Alpha",
                      "url": "https://www.luckyshrub.com?clickID=kqDGWd24Q5TRwoEQTICY7W1JKoXvaZOXWAS7h1P76s0R7Paec4"
                    }
                }
            }
            },
            "recipients": [{
                "recipient": "{recipient}",
                "recipient_type": "individual"
            }],
            "report_url": "https://webhook.site/4235f691-13ab-448e-b100-74a3a627927f"
        }
    ]
}`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n    \"messages\": [\n        {\n            \"originator\": \"{registered phone_number}\",\n            \"content\": {\n                \"message_type\": \"INTERACTIVE\",\n            \"interactive\": {\n                \"type\": \"cta_url\",\n                \"header\": {\n                    \"type\": \"text\",\n                    \"text\": \"Payment$ for D7 Whatsapp Service\"\n                },\n                \"body\": {\n                    \"text\": \"Direct7 Networks is a messaging service provider that specializes in helping organizations efficiently communicate with their customers.\"\n                },\n                \"footer\": {\n                    \"text\": \"Thank You\"\n                },\n                \"action\": {\n                    \"parameters\": {\n                      \"display_text\": \"Visit Alpha\",\n                      \"url\": \"https://www.luckyshrub.com?clickID=kqDGWd24Q5TRwoEQTICY7W1JKoXvaZOXWAS7h1P76s0R7Paec4\"\n                    }\n                }\n            }\n            },\n            \"recipients\": [{\n                \"recipient\": \"{recipient}\",\n                \"recipient_type\": \"individual\"\n            }],\n            \"report_url\": \"https://webhook.site/4235f691-13ab-448e-b100-74a3a627927f\"\n        }\n    ]\n}");
Request request = new Request.Builder()
  .url("https://apialpha.d7networks.com/whatsapp/v2/send")
  .method("POST", body)
  .addHeader("Content-Type", "application/json")
  .addHeader("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc")
  .build();
Response response = client.newCall(request).execute();
  var headers = {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc'
  };
  var request = http.Request('POST', Uri.parse('https://apialpha.d7networks.com/whatsapp/v2/send'));
  request.body = json.encode({
    "messages": [
      {
        "originator": "{registered phone_number}",
        "content": {
          "message_type": "INTERACTIVE",
          "interactive": {
            "type": "cta_url",
            "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": {
              "parameters": {
                "display_text": "Visit Alpha",
                "url": "https://www.luckyshrub.com?clickID=kqDGWd24Q5TRwoEQTICY7W1JKoXvaZOXWAS7h1P76s0R7Paec4"
              }
            }
          }
        },
        "recipients": [
          {
            "recipient": "{recipient}",
            "recipient_type": "individual"
          }
        ],
        "report_url": "https://webhook.site/4235f691-13ab-448e-b100-74a3a627927f"
      }
    ]
  });
  request.headers.addAll(headers);

  http.StreamedResponse response = await request.send();

  if (response.statusCode == 200) {
    print(await response.stream.bytesToString());
  }
  else {
    print(response.reasonPhrase);
  }
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Content-Type", "application/json")
$headers.Add("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc")

$body = @"
{
`"messages`": [
{
`"originator`": `"{registered phone_number}`",
`"content`": {
`"message_type`": `"INTERACTIVE`",
`"interactive`": {
`"type`": `"cta_url`",
`"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`": {
`"parameters`": {
`"display_text`": `"Visit Alpha`",
`"url`": `"https://www.luckyshrub.com?clickID=kqDGWd24Q5TRwoEQTICY7W1JKoXvaZOXWAS7h1P76s0R7Paec4`"
}
}
}
},
`"recipients`": [{
`"recipient`": `"{recipient}`",
`"recipient_type`": `"individual`"
}],
`"report_url`": `"https://webhook.site/4235f691-13ab-448e-b100-74a3a627927f`"
}
]
}
"@

$response = Invoke-RestMethod 'https://apialpha.d7networks.com/whatsapp/v2/send' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
require "uri"
require "json"
require "net/http"

url = URI("https://apialpha.d7networks.com/whatsapp/v2/send")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc"
request.body = JSON.dump({
  "messages": [
    {
      "originator": "{registered_phonenumber",
      "content": {
        "message_type": "INTERACTIVE",
        "interactive": {
          "type": "cta_url",
          "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": {
            "parameters": {
              "display_text": "Visit Alpha",
              "url": "https://www.luckyshrub.com?clickID=kqDGWd24Q5TRwoEQTICY7W1JKoXvaZOXWAS7h1P76s0R7Paec4"
            }
          }
        }
      },
      "recipients": [
        {
          "recipient": "{recipient}",
          "recipient_type": "individual"
        }
      ],
      "report_url": "https://webhook.site/4235f691-13ab-448e-b100-74a3a627927f"
    }
  ]
})

response = https.request(request)
puts response.read_body
1
2
3
4
5
6
7
8
 var client = new HttpClient();
 var request = new HttpRequestMessage(HttpMethod.Post, "https://apialpha.d7networks.com/whatsapp/v2/send");
 request.Headers.Add("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc");
 var content = new StringContent("{\n    \"messages\": [\n        {\n            \"originator\": \"{registered phone_number}\",\n            \"content\": {\n                \"message_type\": \"INTERACTIVE\",\n            \"interactive\": {\n                \"type\": \"cta_url\",\n                \"header\": {\n                    \"type\": \"text\",\n                    \"text\": \"Payment$ for D7 Whatsapp Service\"\n                },\n                \"body\": {\n                    \"text\": \"Direct7 Networks is a messaging service provider that specializes in helping organizations efficiently communicate with their customers.\"\n                },\n                \"footer\": {\n                    \"text\": \"Thank You\"\n                },\n                \"action\": {\n                    \"parameters\": {\n                      \"display_text\": \"Visit Alpha\",\n                      \"url\": \"https://www.luckyshrub.com?clickID=kqDGWd24Q5TRwoEQTICY7W1JKoXvaZOXWAS7h1P76s0R7Paec4\"\n                    }\n                }\n            }\n            },\n            \"recipients\": [{\n                \"recipient\": \"{recipient}\",\n                \"recipient_type\": \"individual\"\n            }],\n            \"report_url\": \"https://webhook.site/4235f691-13ab-448e-b100-74a3a627927f\"\n        }\n    ]\n}", null, "application/json");
 request.Content = content;
 var response = await client.SendAsync(request);
 response.EnsureSuccessStatusCode();
 Console.WriteLine(await response.Content.ReadAsStringAsync());
Interactive message with type- button
curl --location 'https://apialpha.d7networks.com/whatsapp/v2/send' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc' \
--data '{
    "messages": [
        {
            "originator": "{registered phone_number}",
            "content": {
                "message_type": "INTERACTIVE",
            "interactive": {
                "type": "button",
                "header": {
                    "type": "image",
                    "image": {
                        "link": "https://karix.s3.ap-south-1.amazonaws.com/English-4.jpg"
                    }
                },
                "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": "{recipient}",
                "recipient_type": "individual"
            }],
            "report_url": "https://webhook.site/e8839c21-2de3-499f-90a9-be31fd0cddb7"
        }
    ]
}'
const axios = require('axios');
let data = JSON.stringify({
  "messages": [
    {
      "originator": "{registered phone_number}",
      "content": {
        "message_type": "INTERACTIVE",
        "interactive": {
          "type": "button",
          "header": {
            "type": "image",
            "image": {
              "link": "https://karix.s3.ap-south-1.amazonaws.com/English-4.jpg"
            }
          },
          "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": "{recipient}",
          "recipient_type": "individual"
        }
      ],
      "report_url": "https://webhook.site/e8839c21-2de3-499f-90a9-be31fd0cddb7"
    }
  ]
});

let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url: 'https://apialpha.d7networks.com/whatsapp/v2/send',
  headers: { 
    'Content-Type': 'application/json', 
    'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc'
  },
  data : data
};

axios.request(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});
import http.client
import json

conn = http.client.HTTPSConnection("apialpha.d7networks.com")
payload = json.dumps({
  "messages": [
    {
      "originator": "{registered phone_number}",
      "content": {
        "message_type": "INTERACTIVE",
        "interactive": {
          "type": "button",
          "header": {
            "type": "image",
            "image": {
              "link": "https://karix.s3.ap-south-1.amazonaws.com/English-4.jpg"
            }
          },
          "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": "{recipient}",
          "recipient_type": "individual"
        }
      ],
      "report_url": "https://webhook.site/e8839c21-2de3-499f-90a9-be31fd0cddb7"
    }
  ]
})
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc'
}
conn.request("POST", "/whatsapp/v2/send", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://apialpha.d7networks.com/whatsapp/v2/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 =>'{
    "messages": [
        {
            "originator": "{registered phone_number}",
            "content": {
                "message_type": "INTERACTIVE",
            "interactive": {
                "type": "button",
                "header": {
                    "type": "image",
                    "image": {
                        "link": "https://karix.s3.ap-south-1.amazonaws.com/English-4.jpg"
                    }
                },
                "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": "{recipient}",
                "recipient_type": "individual"
            }],
            "report_url": "https://webhook.site/e8839c21-2de3-499f-90a9-be31fd0cddb7"
        }
    ]
}',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
package main
import (
  "fmt"
  "strings"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://apialpha.d7networks.com/whatsapp/v2/send"
  method := "POST"

  payload := strings.NewReader(`{
    "messages": [
        {
            "originator": "{registered phone_number}",
            "content": {
                "message_type": "INTERACTIVE",
            "interactive": {
                "type": "button",
                "header": {
                    "type": "image",
                    "image": {
                        "link": "https://karix.s3.ap-south-1.amazonaws.com/English-4.jpg"
                    }
                },
                "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": "{recipient}",
                "recipient_type": "individual"
            }],
            "report_url": "https://webhook.site/e8839c21-2de3-499f-90a9-be31fd0cddb7"
        }
    ]
}`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n    \"messages\": [\n        {\n            \"originator\": \"{registered phone_number}\",\n            \"content\": {\n                \"message_type\": \"INTERACTIVE\",\n            \"interactive\": {\n                \"type\": \"button\",\n                \"header\": {\n                    \"type\": \"image\",\n                    \"image\": {\n                        \"link\": \"https://karix.s3.ap-south-1.amazonaws.com/English-4.jpg\"\n                    }\n                },\n                \"body\": {\n                    \"text\": \"Direct7 Networks is a messaging service provider that specializes in helping organizations efficiently communicate with their customers.\"\n                },\n                \"footer\": {\n                    \"text\": \"Thank You\"\n                },\n                \"action\": {\n                    \"buttons\": [\n                        {\n                            \"type\": \"reply\",\n                            \"reply\": {\n                                \"id\": \"1\",\n                                \"title\": \"Debit Card\"\n                            }\n                        },\n                        {\n                            \"type\": \"reply\",\n                            \"reply\": {\n                                \"id\": \"2\",\n                                \"title\": \"Credit Card\"\n                            }\n                        },\n                                                {\n                            \"type\": \"reply\",\n                            \"reply\": {\n                                \"id\": \"3\",\n                                \"title\": \"Cash\"\n                            }\n                        }\n                    ]\n                }\n            }\n            },\n            \"recipients\": [{\n                \"recipient\": \"{recipient}\",\n                \"recipient_type\": \"individual\"\n            }],\n            \"report_url\": \"https://webhook.site/e8839c21-2de3-499f-90a9-be31fd0cddb7\"\n        }\n    ]\n}");
Request request = new Request.Builder()
  .url("https://apialpha.d7networks.com/whatsapp/v2/send")
  .method("POST", body)
  .addHeader("Content-Type", "application/json")
  .addHeader("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc")
  .build();
Response response = client.newCall(request).execute();
  var headers = {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc'
  };
  var request = http.Request('POST', Uri.parse('https://apialpha.d7networks.com/whatsapp/v2/send'));
  request.body = json.encode({
    "messages": [
      {
        "originator": "{registered phone_number}",
        "content": {
          "message_type": "INTERACTIVE",
          "interactive": {
            "type": "button",
            "header": {
              "type": "image",
              "image": {
                "link": "https://karix.s3.ap-south-1.amazonaws.com/English-4.jpg"
              }
            },
            "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": "{recipient}",
            "recipient_type": "individual"
          }
        ],
        "report_url": "https://webhook.site/e8839c21-2de3-499f-90a9-be31fd0cddb7"
      }
    ]
  });
  request.headers.addAll(headers);

  http.StreamedResponse response = await request.send();

  if (response.statusCode == 200) {
    print(await response.stream.bytesToString());
  }
  else {
    print(response.reasonPhrase);
  }
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Content-Type", "application/json")
$headers.Add("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc")

$body = @"
{
    `"messages`": [
        {
            `"originator`": `"{registered phone_number}`",
            `"content`": {
                `"message_type`": `"INTERACTIVE`",
            `"interactive`": {
                `"type`": `"button`",
                `"header`": {
                    `"type`": `"image`",
                    `"image`": {
                        `"link`": `"https://karix.s3.ap-south-1.amazonaws.com/English-4.jpg`"
                    }
                },
                `"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`": `"{recipient}`",
                `"recipient_type`": `"individual`"
            }],
            `"report_url`": `"https://webhook.site/e8839c21-2de3-499f-90a9-be31fd0cddb7`"
        }
    ]
}
"@

$response = Invoke-RestMethod 'https://apialpha.d7networks.com/whatsapp/v2/send' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
require "uri"
require "json"
require "net/http"

url = URI("https://apialpha.d7networks.com/whatsapp/v2/send")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc"
request.body = JSON.dump({
  "messages": [
    {
      "originator": "{registered phone_number}",
      "content": {
        "message_type": "INTERACTIVE",
        "interactive": {
          "type": "button",
          "header": {
            "type": "image",
            "image": {
              "link": "https://karix.s3.ap-south-1.amazonaws.com/English-4.jpg"
            }
          },
          "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": "{recipient}",
          "recipient_type": "individual"
        }
      ],
      "report_url": "https://webhook.site/e8839c21-2de3-499f-90a9-be31fd0cddb7"
    }
  ]
})

response = https.request(request)
puts response.read_body
1
2
3
4
5
6
7
8
 var client = new HttpClient();
 var request = new HttpRequestMessage(HttpMethod.Post, "https://apialpha.d7networks.com/whatsapp/v2/send");
 request.Headers.Add("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc");
 var content = new StringContent("{\n    \"messages\": [\n        {\n            \"originator\": \"{registered phone_number}\",\n            \"content\": {\n                \"message_type\": \"INTERACTIVE\",\n            \"interactive\": {\n                \"type\": \"button\",\n                \"header\": {\n                    \"type\": \"image\",\n                    \"image\": {\n                        \"link\": \"https://karix.s3.ap-south-1.amazonaws.com/English-4.jpg\"\n                    }\n                },\n                \"body\": {\n                    \"text\": \"Direct7 Networks is a messaging service provider that specializes in helping organizations efficiently communicate with their customers.\"\n                },\n                \"footer\": {\n                    \"text\": \"Thank You\"\n                },\n                \"action\": {\n                    \"buttons\": [\n                        {\n                            \"type\": \"reply\",\n                            \"reply\": {\n                                \"id\": \"1\",\n                                \"title\": \"Debit Card\"\n                            }\n                        },\n                        {\n                            \"type\": \"reply\",\n                            \"reply\": {\n                                \"id\": \"2\",\n                                \"title\": \"Credit Card\"\n                            }\n                        },\n                                                {\n                            \"type\": \"reply\",\n                            \"reply\": {\n                                \"id\": \"3\",\n                                \"title\": \"Cash\"\n                            }\n                        }\n                    ]\n                }\n            }\n            },\n            \"recipients\": [{\n                \"recipient\": \"{recipient}\",\n                \"recipient_type\": \"individual\"\n            }],\n            \"report_url\": \"https://webhook.site/e8839c21-2de3-499f-90a9-be31fd0cddb7\"\n        }\n    ]\n}", null, "application/json");
 request.Content = content;
 var response = await client.SendAsync(request);
 response.EnsureSuccessStatusCode();
 Console.WriteLine(await response.Content.ReadAsStringAsync());
Interactive message with type- list
 curl --location 'https://apialpha.d7networks.com/whatsapp/v2/send' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc' \
--data '{
    "messages": [
        {
            "originator": "{registered phone_number}",
            "content": {
                "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": "{recipient}",
                "recipient_type": "individual"
            }],
            "report_url": "https://webhook.site/4235f691-13ab-448e-b100-74a3a627927f"
        }
    ]
}'
const axios = require('axios');
let data = JSON.stringify({
  "messages": [
    {
      "originator": "{registered phone_number}",
      "content": {
        "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": "{recipient}",
          "recipient_type": "individual"
        }
      ],
      "report_url": "https://webhook.site/4235f691-13ab-448e-b100-74a3a627927f"
    }
  ]
});

let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url: 'https://apialpha.d7networks.com/whatsapp/v2/send',
  headers: { 
    'Content-Type': 'application/json', 
    'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc'
  },
  data : data
};

axios.request(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});
import http.client
import json

conn = http.client.HTTPSConnection("apialpha.d7networks.com")
payload = json.dumps({
  "messages": [
    {
      "originator": "{registered phone_number}",
      "content": {
        "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": "{recipient}",
          "recipient_type": "individual"
        }
      ],
      "report_url": "https://webhook.site/4235f691-13ab-448e-b100-74a3a627927f"
    }
  ]
})
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc'
}
conn.request("POST", "/whatsapp/v2/send", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
<?php
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://apialpha.d7networks.com/whatsapp/v2/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 =>'{
    "messages": [
        {
            "originator": "{registered phone_number}",
            "content": {
                "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": "{recipient}",
                "recipient_type": "individual"
            }],
            "report_url": "https://webhook.site/4235f691-13ab-448e-b100-74a3a627927f"
        }
    ]
}',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
package main
import (
  "fmt"
  "strings"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://apialpha.d7networks.com/whatsapp/v2/send"
  method := "POST"

  payload := strings.NewReader(`{
    "messages": [
        {
            "originator": "{registered phone_number}",
            "content": {
                "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": "{recipient}",
                "recipient_type": "individual"
            }],
            "report_url": "https://webhook.site/4235f691-13ab-448e-b100-74a3a627927f"
        }
    ]
}`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n    \"messages\": [\n        {\n            \"originator\": \"{registered phone_number}\",\n            \"content\": {\n                \"message_type\": \"INTERACTIVE\",\n            \"interactive\": {\n                \"type\": \"list\",\n                \"header\": {\n                    \"type\": \"text\",\n                    \"text\": \"Direct7 Networks\"\n                },\n                \"body\": {\n                    \"text\": \"Choose one of our service\"\n                },\n                \"footer\": {\n                    \"text\": \"Thank you\"\n                },\n                \"action\": {\n                    \"button\": \"Choose Service\",\n                    \"sections\": [\n                        {\n                            \"title\": \"SMS Messaging\",\n                            \"rows\": [\n                                {\n                                    \"id\": \"1\",\n                                    \"title\": \"Normal SMS\",\n                                    \"description\": \"Signup for free at the D7 platform to use our Messaging APIs.\"\n                                },\n                                {\n                                    \"id\": \"2\",\n                                    \"title\": \"Verify\",\n                                    \"description\": \"D7 Verify API is to applications requires SMS based OTP authentications.\"\n                                }\n                            ]\n                        },\n                        {\n                            \"title\": \"Whatsapp\",\n                            \"rows\": [\n                                {\n                                    \"id\": \"3\",\n                                    \"title\": \"WhatsApp Messages\",\n                                    \"description\": \"D7 Whatsapp API is to applications requires pre-registration.\"\n                                }\n                            ]\n                        }\n                    ]\n                }\n            }\n            },\n            \"recipients\": [{\n                \"recipient\": \"{recipient}\",\n                \"recipient_type\": \"individual\"\n            }],\n            \"report_url\": \"https://webhook.site/4235f691-13ab-448e-b100-74a3a627927f\"\n        }\n    ]\n}");
Request request = new Request.Builder()
  .url("https://apialpha.d7networks.com/whatsapp/v2/send")
  .method("POST", body)
  .addHeader("Content-Type", "application/json")
  .addHeader("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc")
  .build();
Response response = client.newCall(request).execute();
 var headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc'
};
var request = http.Request('POST', Uri.parse('https://apialpha.d7networks.com/whatsapp/v2/send'));
request.body = json.encode({
  "messages": [
    {
      "originator": "{registered phone_number}",
      "content": {
        "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": "{recipient}",
          "recipient_type": "individual"
        }
      ],
      "report_url": "https://webhook.site/4235f691-13ab-448e-b100-74a3a627927f"
    }
  ]
});
request.headers.addAll(headers);

http.StreamedResponse response = await request.send();

if (response.statusCode == 200) {
  print(await response.stream.bytesToString());
}
else {
  print(response.reasonPhrase);
}
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Content-Type", "application/json")
$headers.Add("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc")

$body = @"
{
`"messages`": [
{
`"originator`": `"{registered phone_number}`",
`"content`": {
`"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`": `"{recipient}`",
`"recipient_type`": `"individual`"
}],
`"report_url`": `"https://webhook.site/4235f691-13ab-448e-b100-74a3a627927f`"
}
]
}
"@

$response = Invoke-RestMethod 'https://apialpha.d7networks.com/whatsapp/v2/send' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
require "uri"
require "json"
require "net/http"

url = URI("https://apialpha.d7networks.com/whatsapp/v2/send")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc"
request.body = JSON.dump({
  "messages": [
    {
      "originator": "{registered phone_number}",
      "content": {
        "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": "{recipient}",
          "recipient_type": "individual"
        }
      ],
      "report_url": "https://webhook.site/4235f691-13ab-448e-b100-74a3a627927f"
    }
  ]
})

response = https.request(request)
puts response.read_body
1
2
3
4
5
6
7
8
 var client = new HttpClient();
 var request = new HttpRequestMessage(HttpMethod.Post, "https://apialpha.d7networks.com/whatsapp/v2/send");
 request.Headers.Add("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc");
 var content = new StringContent("{\n    \"messages\": [\n        {\n            \"originator\": \"{registered phone_number}\",\n            \"content\": {\n                \"message_type\": \"INTERACTIVE\",\n            \"interactive\": {\n                \"type\": \"list\",\n                \"header\": {\n                    \"type\": \"text\",\n                    \"text\": \"Direct7 Networks\"\n                },\n                \"body\": {\n                    \"text\": \"Choose one of our service\"\n                },\n                \"footer\": {\n                    \"text\": \"Thank you\"\n                },\n                \"action\": {\n                    \"button\": \"Choose Service\",\n                    \"sections\": [\n                        {\n                            \"title\": \"SMS Messaging\",\n                            \"rows\": [\n                                {\n                                    \"id\": \"1\",\n                                    \"title\": \"Normal SMS\",\n                                    \"description\": \"Signup for free at the D7 platform to use our Messaging APIs.\"\n                                },\n                                {\n                                    \"id\": \"2\",\n                                    \"title\": \"Verify\",\n                                    \"description\": \"D7 Verify API is to applications requires SMS based OTP authentications.\"\n                                }\n                            ]\n                        },\n                        {\n                            \"title\": \"Whatsapp\",\n                            \"rows\": [\n                                {\n                                    \"id\": \"3\",\n                                    \"title\": \"WhatsApp Messages\",\n                                    \"description\": \"D7 Whatsapp API is to applications requires pre-registration.\"\n                                }\n                            ]\n                        }\n                    ]\n                }\n            }\n            },\n            \"recipients\": [{\n                \"recipient\": \"{recipient}\",\n                \"recipient_type\": \"individual\"\n            }],\n            \"report_url\": \"https://webhook.site/4235f691-13ab-448e-b100-74a3a627927f\"\n        }\n    ]\n}", null, "application/json");
 request.Content = content;
 var response = await client.SendAsync(request);
 response.EnsureSuccessStatusCode();
 Console.WriteLine(await response.Content.ReadAsStringAsync());