Skip to content

Send Free-form Whatsapp Messages

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

Note:

All of these types, can be sent as a reply to a previous message. That means these type of messages can be send only when a customer service window exists..

See Also: 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}"
              }
          ]
      }
{
  "messages": [
    {
                  "originator": "{registered phone_number 1}",
                  "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}"
              },
    {
                  "originator": "{registered phone_number 2}",
                  "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}"
              }
  ]
}
{
  "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}"
              }
  ],
  "message_globals": {  // Global message parameters for all message objects
    "schedule_time": "2021-08-05T12:52+05:30",
  }
}

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. See Text Messages.
* reaction REACTION object If message type is REACTION, then add text object. See Reaction Messages.
* attachment MEDIA object If message type is ATTACHMENT, then add media objects. See Media Messages
* location LOCATION object If message type is LOCATION, then add location object. See Location Messages
* contacts CONTACTS object If message type is CONTACTS, then add contacts object. See Contacts Messages
* interactive INTERACTIVE object If message type is INTERACTIVE, then add interactive object. See Interactive Messages
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
schedule_time String Schedule request to send at specific time .format: YYYY-MM-DDTHH:MM+HH:MM, must be specified inside message_globals object

Recipient Objects

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
    "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"
                }
            }
        ],

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:

One to One Message (Text Message)

 curl --location 'https://api.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}", recipients : [{"recipient": "{recipient}", "recipient_type": "individual"}], 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}", recipients=[{"recipient": "{recipient}", "recipient_type": "individual"}], message_type="TEXT", body="Hi, How can I help you?")    

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}", recipients: [["recipient" => "{recipient}", "recipient_type" => "individual"]], 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}"
recipients := []map[string]string{
    "recipient": "{recipient}",
    "recipient_type": "individual",
}
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://api.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://api.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://api.d7networks.com/whatsapp/v2/send' -Method 'POST' -Headers $headers -Body $body
  $response | ConvertTo-Json
gem install direct7
require 'direct7'

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

client.whatsapp.send_whatsapp_freeform_message(
    originator='{originator}',
    recipient='{recipient}',
    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://api.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());

One to Many Message (Text Message)

curl --location --request POST 'https://api.d7networks.com/whatsapp/v2/send' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {{api_access_token}}' \
--data-raw '{
    "messages": [
        {
            "originator": "{registered phone_number}",
              "content": {
                  "message_type": "TEXT",
                  "text":{
                      "preview_url": true,
                      "body": "Hi, How can I help you?"
                  }
            },
            "recipients": [
                {
                    "recipient": "{{recipient1}}",
                    "recipient_type": "individual",
                    "reference": {
                        "cust_ref": "[email protected]",
                        "messageTag1": "SomeMessageTag",
                        "conversationId": "ConversationId"
                    }
                },
                {
                    "recipient": "{{recipient2}}",
                    "recipient_type": "individual",
                    "reference": {
                        "cust_ref": "[email protected]",
                        "messageTag1": "SomeMessageTag",
                        "conversationId": "ConversationId"
                    }
                }
            ],
            "report_url": "https://the_url_to_recieve_delivery_report.com"
        }
    ]
}'
var axios = require('axios');
var data = JSON.stringify({
    "messages": [
        {
            "originator": "{registered phone_number}",
              "content": {
                  "message_type": "TEXT",
                  "text":{
                      "preview_url": true,
                      "body": "Hi, How can I help you?"
                  }
            },
            "recipients": [
                {
                    "recipient": "{{recipient1}}",
                    "recipient_type": "individual",
                    "reference": {
                        "cust_ref": "[email protected]",
                        "messageTag1": "SomeMessageTag",
                        "conversationId": "ConversationId"
                    }
                },
                {
                    "recipient": "{{recipient2}}",
                    "recipient_type": "individual",
                    "reference": {
                        "cust_ref": "[email protected]",
                        "messageTag1": "SomeMessageTag",
                        "conversationId": "ConversationId"
                    }
                }
            ],
            "report_url": "https://the_url_to_recieve_delivery_report.com"
        }
    ]
});

var config = {
method: 'post',
url: 'https://api.d7networks.com/whatsapp/v2/send',
headers: {
    'Content-Type': 'application/json',
    'Accept': 'application/json',
    'Authorization': 'Bearer {{api_access_token}}'
},
data : data
};

axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
import requests
import json

url = "https://api.d7networks.com/whatsapp/v2/send"

payload = json.dumps({
    "messages": [
        {
            "originator": "{registered phone_number}",
              "content": {
                  "message_type": "TEXT",
                  "text":{
                      "preview_url": true,
                      "body": "Hi, How can I help you?"
                  }
            },
            "recipients": [
                {
                    "recipient": "{{recipient1}}",
                    "recipient_type": "individual",
                    "reference": {
                        "cust_ref": "[email protected]",
                        "messageTag1": "SomeMessageTag",
                        "conversationId": "ConversationId"
                    }
                },
                {
                    "recipient": "{{recipient2}}",
                    "recipient_type": "individual",
                    "reference": {
                        "cust_ref": "[email protected]",
                        "messageTag1": "SomeMessageTag",
                        "conversationId": "ConversationId"
                    }
                }
            ],
            "report_url": "https://the_url_to_recieve_delivery_report.com"
        }
    ]
})
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer {{api_access_token}}'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
<?php
$curl = curl_init();
$token = {{api_access_token}}; // Replace it with your API Token


$payload = '{
    "originator": "{{originator}}",
    "recipients": [
        {
            "recipient": "{{recipient1}}",
            "recipient_type": "individual",
            "reference": {
                "cust_ref": "[email protected]",
                "messageTag1": "SomeMessageTag",
                "conversationId": "ConversationId"
            }
        },
        {
            "recipient": "{{recipient2}}",
            "recipient_type": "individual",
            "reference": {
                "cust_ref": "[email protected]",
                "messageTag1": "SomeMessageTag",
                "conversationId": "ConversationId"
            }
        }
    ],
    "content": {
        "message_type": "TEXT",
        "text": {
            "preview_url": True,
            "body": "Hi
        }
    },
    "report_url": "https://the_url_to_recieve_delivery_report.com"
}' ;

curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.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 =>$payload,
CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Accept: application/json',
    'Authorization: Bearer '.$token
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
// Add custom code to save the response in database and use it later to track the delivery report
?>
    package main

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

    func main() {

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

    payload := strings.NewReader(`{
        "messages": [
            {
                "originator": "{registered phone_number}",
                "content": {
                    "message_type": "TEXT",
                    "text":{
                        "preview_url": true,
                        "body": "Hi, How can I help you?"
                    }
                },
                "recipients": [
                    {
                        "recipient": "{{recipient1}}",
                        "recipient_type": "individual",
                        "reference": {
                            "cust_ref": "[email protected]",
                            "messageTag1": "SomeMessageTag",
                            "conversationId": "ConversationId"
                        }
                    },
                    {
                        "recipient": "{{recipient2}}",
                        "recipient_type": "individual",
                        "reference": {
                            "cust_ref": "[email protected]",
                            "messageTag1": "SomeMessageTag",
                            "conversationId": "ConversationId"
                        }
                    }
                ],
                "report_url": "https://the_url_to_recieve_delivery_report.com"
            }
        ]
    }`)

    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 {{api_access_token}}")

    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\": \"TEXT\",\n                  \"text\":{\n                      \"preview_url\": true,\n                      \"body\": \"Hi, How can I help you?\"\n                  }\n            },\n            \"recipients\": [\n                {\n                    \"recipient\": \"{{recipient1}}\",\n                    \"recipient_type\": \"individual\",\n                    \"reference\": {\n                        \"cust_ref\": \"[email protected]\",\n                        \"messageTag1\": \"SomeMessageTag\",\n                        \"conversationId\": \"ConversationId\"\n                    }\n                },\n                {\n                    \"recipient\": \"{{recipient2}}\",\n                    \"recipient_type\": \"individual\",\n                    \"reference\": {\n                        \"cust_ref\": \"[email protected]\",\n                        \"messageTag1\": \"SomeMessageTag\",\n                        \"conversationId\": \"ConversationId\"\n                    }\n                }\n            ],\n            \"report_url\": \"https://the_url_to_recieve_delivery_report.com\"\n        }\n    ]\n}");
    Request request = new Request.Builder()
    .url("https://api.d7networks.com/whatsapp/v2/send")
    .method("POST", body)
    .addHeader("Content-Type", "application/json")
    .addHeader("Authorization", "Bearer {{api_access_token}}")
    .build();
    Response response = client.newCall(request).execute();
    var headers = {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer {{api_access_token}}'
    };
    var request = http.Request('POST', Uri.parse('https://api.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": "{{recipient1}}",
            "recipient_type": "individual",
            "reference": {
                "cust_ref": "[email protected]",
                "messageTag1": "SomeMessageTag",
                "conversationId": "ConversationId"
            }
            },
            {
            "recipient": "{{recipient2}}",
            "recipient_type": "individual",
            "reference": {
                "cust_ref": "[email protected]",
                "messageTag1": "SomeMessageTag",
                "conversationId": "ConversationId"
            }
            }
        ],
        "report_url": "https://the_url_to_recieve_delivery_report.com"
        }
    ]
    });
    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 {{api_access_token}}")

    $body = @"
    {
        `"messages`": [
            {
                `"originator`": `"{registered phone_number}`",
                `"content`": {
                    `"message_type`": `"TEXT`",
                    `"text`":{
                        `"preview_url`": true,
                        `"body`": `"Hi, How can I help you?`"
                    }
                },
                `"recipients`": [
                    {
                        `"recipient`": `"{{recipient1}}`",
                        `"recipient_type`": `"individual`",
                        `"reference`": {
                            `"cust_ref`": `"[email protected]`",
                            `"messageTag1`": `"SomeMessageTag`",
                            `"conversationId`": `"ConversationId`"
                        }
                    },
                    {
                        `"recipient`": `"{{recipient2}}`",
                        `"recipient_type`": `"individual`",
                        `"reference`": {
                            `"cust_ref`": `"[email protected]`",
                            `"messageTag1`": `"SomeMessageTag`",
                            `"conversationId`": `"ConversationId`"
                        }
                    }
                ],
                `"report_url`": `"https://the_url_to_recieve_delivery_report.com`"
            }
        ]
    }
    "@

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

    url = URI("https://api.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 {{api_access_token}}"
    request.body = JSON.dump({
    "messages": [
        {
        "originator": "{registered phone_number}",
        "content": {
            "message_type": "TEXT",
            "text": {
            "preview_url": true,
            "body": "Hi, How can I help you?"
            }
        },
        "recipients": [
            {
            "recipient": "{{recipient1}}",
            "recipient_type": "individual",
            "reference": {
                "cust_ref": "[email protected]",
                "messageTag1": "SomeMessageTag",
                "conversationId": "ConversationId"
            }
            },
            {
            "recipient": "{{recipient2}}",
            "recipient_type": "individual",
            "reference": {
                "cust_ref": "[email protected]",
                "messageTag1": "SomeMessageTag",
                "conversationId": "ConversationId"
            }
            }
        ],
        "report_url": "https://the_url_to_recieve_delivery_report.com"
        }
    ]
    })

    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://api.d7networks.com/whatsapp/v2/send");
    request.Headers.Add("Authorization", "Bearer {{api_access_token}}");
    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                {\n                    \"recipient\": \"{{recipient1}}\",\n                    \"recipient_type\": \"individual\",\n                    \"reference\": {\n                        \"cust_ref\": \"[email protected]\",\n                        \"messageTag1\": \"SomeMessageTag\",\n                        \"conversationId\": \"ConversationId\"\n                    }\n                },\n                {\n                    \"recipient\": \"{{recipient2}}\",\n                    \"recipient_type\": \"individual\",\n                    \"reference\": {\n                        \"cust_ref\": \"[email protected]\",\n                        \"messageTag1\": \"SomeMessageTag\",\n                        \"conversationId\": \"ConversationId\"\n                    }\n                }\n            ],\n            \"report_url\": \"https://the_url_to_recieve_delivery_report.com\"\n        }\n    ]\n}", null, "application/json");
    request.Content = content;
    var response = await client.SendAsync(request);
    response.EnsureSuccessStatusCode();
    Console.WriteLine(await response.Content.ReadAsStringAsync());

Many to Many Message (Text Messages)

    curl --location 'https://api.d7networks.com/whatsapp/v2/send' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Bearer {{api_access_token}}' \
    --data-raw '{
        "messages": [
            {
                "originator": "{registered phone_number}",
                "content": {
                    "message_type": "TEXT",
                    "text":{
                        "preview_url": true,
                        "body": "Hi, How can I help you?"
                    }
                },
                "recipients": [
                    {
                        "recipient": "{{recipient1}}",
                        "recipient_type": "individual",
                        "reference": {
                            "cust_ref": "[email protected]",
                            "messageTag1": "SomeMessageTag",
                            "conversationId": "ConversationId"
                        }
                    },
                    {
                        "recipient": "{{recipient2}}",
                        "recipient_type": "individual",
                        "reference": {
                            "cust_ref": "[email protected]",
                            "messageTag1": "SomeMessageTag",
                            "conversationId": "ConversationId"
                        }
                    }
                ],
                "report_url": "https://the_url_to_recieve_delivery_report.com"
            },
            {
                "originator": "{registered phone_number}",
                "content": {
                    "message_type": "TEXT",
                    "text":{
                        "preview_url": true,
                        "body": "Hi, How can I help you?"
                    }
                },
                "recipients": [
                    {
                        "recipient": "{{recipient1}}",
                        "recipient_type": "individual",
                        "reference": {
                            "cust_ref": "[email protected]",
                            "messageTag1": "SomeMessageTag",
                            "conversationId": "ConversationId"
                        }
                    },
                    {
                        "recipient": "{{recipient2}}",
                        "recipient_type": "individual",
                        "reference": {
                            "cust_ref": "[email protected]",
                            "messageTag1": "SomeMessageTag",
                            "conversationId": "ConversationId"
                        }
                    }
                ],
                "report_url": "https://the_url_to_recieve_delivery_report.com"
            }
        ]
    }'
    const axios = require('axios');
    let data = JSON.stringify({
    "messages": [
        {
        "originator": "{registered phone_number}",
        "content": {
            "message_type": "TEXT",
            "text": {
            "preview_url": true,
            "body": "Hi, How can I help you?"
            }
        },
        "recipients": [
            {
            "recipient": "{{recipient1}}",
            "recipient_type": "individual",
            "reference": {
                "cust_ref": "[email protected]",
                "messageTag1": "SomeMessageTag",
                "conversationId": "ConversationId"
            }
            },
            {
            "recipient": "{{recipient2}}",
            "recipient_type": "individual",
            "reference": {
                "cust_ref": "[email protected]",
                "messageTag1": "SomeMessageTag",
                "conversationId": "ConversationId"
            }
            }
        ],
        "report_url": "https://the_url_to_recieve_delivery_report.com"
        },
        {
        "originator": "{registered phone_number}",
        "content": {
            "message_type": "TEXT",
            "text": {
            "preview_url": true,
            "body": "Hi, How can I help you?"
            }
        },
        "recipients": [
            {
            "recipient": "{{recipient1}}",
            "recipient_type": "individual",
            "reference": {
                "cust_ref": "[email protected]",
                "messageTag1": "SomeMessageTag",
                "conversationId": "ConversationId"
            }
            },
            {
            "recipient": "{{recipient2}}",
            "recipient_type": "individual",
            "reference": {
                "cust_ref": "[email protected]",
                "messageTag1": "SomeMessageTag",
                "conversationId": "ConversationId"
            }
            }
        ],
        "report_url": "https://the_url_to_recieve_delivery_report.com"
        }
    ]
    });

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

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

    url = "https://api.d7networks.com/whatsapp/v2/send"

    payload = json.dumps({
    "messages": [
        {
        "originator": "{registered phone_number}",
        "content": {
            "message_type": "TEXT",
            "text": {
            "preview_url": True,
            "body": "Hi, How can I help you?"
            }
        },
        "recipients": [
            {
            "recipient": "{{recipient1}}",
            "recipient_type": "individual",
            "reference": {
                "cust_ref": "[email protected]",
                "messageTag1": "SomeMessageTag",
                "conversationId": "ConversationId"
            }
            },
            {
            "recipient": "{{recipient2}}",
            "recipient_type": "individual",
            "reference": {
                "cust_ref": "[email protected]",
                "messageTag1": "SomeMessageTag",
                "conversationId": "ConversationId"
            }
            }
        ],
        "report_url": "https://the_url_to_recieve_delivery_report.com"
        },
        {
        "originator": "{registered phone_number}",
        "content": {
            "message_type": "TEXT",
            "text": {
            "preview_url": True,
            "body": "Hi, How can I help you?"
            }
        },
        "recipients": [
            {
            "recipient": "{{recipient1}}",
            "recipient_type": "individual",
            "reference": {
                "cust_ref": "[email protected]",
                "messageTag1": "SomeMessageTag",
                "conversationId": "ConversationId"
            }
            },
            {
            "recipient": "{{recipient2}}",
            "recipient_type": "individual",
            "reference": {
                "cust_ref": "[email protected]",
                "messageTag1": "SomeMessageTag",
                "conversationId": "ConversationId"
            }
            }
        ],
        "report_url": "https://the_url_to_recieve_delivery_report.com"
        }
    ]
    })
    headers = {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer {{api_access_token}}'
    }

    response = requests.request("POST", url, headers=headers, data=payload)

    print(response.text)
    <?php

    $curl = curl_init();

    curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://api.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": "TEXT",
                    "text":{
                        "preview_url": true,
                        "body": "Hi, How can I help you?"
                    }
                },
                "recipients": [
                    {
                        "recipient": "{{recipient1}}",
                        "recipient_type": "individual",
                        "reference": {
                            "cust_ref": "[email protected]",
                            "messageTag1": "SomeMessageTag",
                            "conversationId": "ConversationId"
                        }
                    },
                    {
                        "recipient": "{{recipient2}}",
                        "recipient_type": "individual",
                        "reference": {
                            "cust_ref": "[email protected]",
                            "messageTag1": "SomeMessageTag",
                            "conversationId": "ConversationId"
                        }
                    }
                ],
                "report_url": "https://the_url_to_recieve_delivery_report.com"
            },
            {
                "originator": "{registered phone_number}",
                "content": {
                    "message_type": "TEXT",
                    "text":{
                        "preview_url": true,
                        "body": "Hi, How can I help you?"
                    }
                },
                "recipients": [
                    {
                        "recipient": "{{recipient1}}",
                        "recipient_type": "individual",
                        "reference": {
                            "cust_ref": "[email protected]",
                            "messageTag1": "SomeMessageTag",
                            "conversationId": "ConversationId"
                        }
                    },
                    {
                        "recipient": "{{recipient2}}",
                        "recipient_type": "individual",
                        "reference": {
                            "cust_ref": "[email protected]",
                            "messageTag1": "SomeMessageTag",
                            "conversationId": "ConversationId"
                        }
                    }
                ],
                "report_url": "https://the_url_to_recieve_delivery_report.com"
            }
        ]
    }',
    CURLOPT_HTTPHEADER => array(
        'Content-Type: application/json',
        'Authorization: Bearer {{api_access_token}}'
    ),
    ));

    $response = curl_exec($curl);

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

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

    func main() {

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

    payload := strings.NewReader(`{
        "messages": [
            {
                "originator": "{registered phone_number}",
                "content": {
                    "message_type": "TEXT",
                    "text":{
                        "preview_url": true,
                        "body": "Hi, How can I help you?"
                    }
                },
                "recipients": [
                    {
                        "recipient": "{{recipient1}}",
                        "recipient_type": "individual",
                        "reference": {
                            "cust_ref": "[email protected]",
                            "messageTag1": "SomeMessageTag",
                            "conversationId": "ConversationId"
                        }
                    },
                    {
                        "recipient": "{{recipient2}}",
                        "recipient_type": "individual",
                        "reference": {
                            "cust_ref": "[email protected]",
                            "messageTag1": "SomeMessageTag",
                            "conversationId": "ConversationId"
                        }
                    }
                ],
                "report_url": "https://the_url_to_recieve_delivery_report.com"
            },
            {
                "originator": "{registered phone_number}",
                "content": {
                    "message_type": "TEXT",
                    "text":{
                        "preview_url": true,
                        "body": "Hi, How can I help you?"
                    }
                },
                "recipients": [
                    {
                        "recipient": "{{recipient1}}",
                        "recipient_type": "individual",
                        "reference": {
                            "cust_ref": "[email protected]",
                            "messageTag1": "SomeMessageTag",
                            "conversationId": "ConversationId"
                        }
                    },
                    {
                        "recipient": "{{recipient2}}",
                        "recipient_type": "individual",
                        "reference": {
                            "cust_ref": "[email protected]",
                            "messageTag1": "SomeMessageTag",
                            "conversationId": "ConversationId"
                        }
                    }
                ],
                "report_url": "https://the_url_to_recieve_delivery_report.com"
            }
        ]
    }`)

    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 {{api_access_token}}")

    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\": \"TEXT\",\n                  \"text\":{\n                      \"preview_url\": true,\n                      \"body\": \"Hi, How can I help you?\"\n                  }\n            },\n            \"recipients\": [\n                {\n                    \"recipient\": \"{{recipient1}}\",\n                    \"recipient_type\": \"individual\",\n                    \"reference\": {\n                        \"cust_ref\": \"[email protected]\",\n                        \"messageTag1\": \"SomeMessageTag\",\n                        \"conversationId\": \"ConversationId\"\n                    }\n                },\n                {\n                    \"recipient\": \"{{recipient2}}\",\n                    \"recipient_type\": \"individual\",\n                    \"reference\": {\n                        \"cust_ref\": \"[email protected]\",\n                        \"messageTag1\": \"SomeMessageTag\",\n                        \"conversationId\": \"ConversationId\"\n                    }\n                }\n            ],\n            \"report_url\": \"https://the_url_to_recieve_delivery_report.com\"\n        },\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                {\n                    \"recipient\": \"{{recipient1}}\",\n                    \"recipient_type\": \"individual\",\n                    \"reference\": {\n                        \"cust_ref\": \"[email protected]\",\n                        \"messageTag1\": \"SomeMessageTag\",\n                        \"conversationId\": \"ConversationId\"\n                    }\n                },\n                {\n                    \"recipient\": \"{{recipient2}}\",\n                    \"recipient_type\": \"individual\",\n                    \"reference\": {\n                        \"cust_ref\": \"[email protected]\",\n                        \"messageTag1\": \"SomeMessageTag\",\n                        \"conversationId\": \"ConversationId\"\n                    }\n                }\n            ],\n            \"report_url\": \"https://the_url_to_recieve_delivery_report.com\"\n        }\n    ]\n}");
    Request request = new Request.Builder()
    .url("https://api.d7networks.com/whatsapp/v2/send")
    .method("POST", body)
    .addHeader("Content-Type", "application/json")
    .addHeader("Authorization", "Bearer {{api_access_token}}")
    .build();
    Response response = client.newCall(request).execute();
    var headers = {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer {{api_access_token}}'
    };
    var request = http.Request('POST', Uri.parse('https://api.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": "{{recipient1}}",
            "recipient_type": "individual",
            "reference": {
                "cust_ref": "[email protected]",
                "messageTag1": "SomeMessageTag",
                "conversationId": "ConversationId"
            }
            },
            {
            "recipient": "{{recipient2}}",
            "recipient_type": "individual",
            "reference": {
                "cust_ref": "[email protected]",
                "messageTag1": "SomeMessageTag",
                "conversationId": "ConversationId"
            }
            }
        ],
        "report_url": "https://the_url_to_recieve_delivery_report.com"
        },
        {
        "originator": "{registered phone_number}",
        "content": {
            "message_type": "TEXT",
            "text": {
            "preview_url": true,
            "body": "Hi, How can I help you?"
            }
        },
        "recipients": [
            {
            "recipient": "{{recipient1}}",
            "recipient_type": "individual",
            "reference": {
                "cust_ref": "[email protected]",
                "messageTag1": "SomeMessageTag",
                "conversationId": "ConversationId"
            }
            },
            {
            "recipient": "{{recipient2}}",
            "recipient_type": "individual",
            "reference": {
                "cust_ref": "[email protected]",
                "messageTag1": "SomeMessageTag",
                "conversationId": "ConversationId"
            }
            }
        ],
        "report_url": "https://the_url_to_recieve_delivery_report.com"
        }
    ]
    });
    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 {{api_access_token}}")

    $body = @"
    {
        `"messages`": [
            {
                `"originator`": `"{registered phone_number}`",
                `"content`": {
                    `"message_type`": `"TEXT`",
                    `"text`":{
                        `"preview_url`": true,
                        `"body`": `"Hi, How can I help you?`"
                    }
                },
                `"recipients`": [
                    {
                        `"recipient`": `"{{recipient1}}`",
                        `"recipient_type`": `"individual`",
                        `"reference`": {
                            `"cust_ref`": `"[email protected]`",
                            `"messageTag1`": `"SomeMessageTag`",
                            `"conversationId`": `"ConversationId`"
                        }
                    },
                    {
                        `"recipient`": `"{{recipient2}}`",
                        `"recipient_type`": `"individual`",
                        `"reference`": {
                            `"cust_ref`": `"[email protected]`",
                            `"messageTag1`": `"SomeMessageTag`",
                            `"conversationId`": `"ConversationId`"
                        }
                    }
                ],
                `"report_url`": `"https://the_url_to_recieve_delivery_report.com`"
            },
            {
                `"originator`": `"{registered phone_number}`",
                `"content`": {
                    `"message_type`": `"TEXT`",
                    `"text`":{
                        `"preview_url`": true,
                        `"body`": `"Hi, How can I help you?`"
                    }
                },
                `"recipients`": [
                    {
                        `"recipient`": `"{{recipient1}}`",
                        `"recipient_type`": `"individual`",
                        `"reference`": {
                            `"cust_ref`": `"[email protected]`",
                            `"messageTag1`": `"SomeMessageTag`",
                            `"conversationId`": `"ConversationId`"
                        }
                    },
                    {
                        `"recipient`": `"{{recipient2}}`",
                        `"recipient_type`": `"individual`",
                        `"reference`": {
                            `"cust_ref`": `"[email protected]`",
                            `"messageTag1`": `"SomeMessageTag`",
                            `"conversationId`": `"ConversationId`"
                        }
                    }
                ],
                `"report_url`": `"https://the_url_to_recieve_delivery_report.com`"
            }
        ]
    }
    "@

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

    url = URI("https://api.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 {{api_access_token}}"
    request.body = JSON.dump({
    "messages": [
        {
        "originator": "{registered phone_number}",
        "content": {
            "message_type": "TEXT",
            "text": {
            "preview_url": true,
            "body": "Hi, How can I help you?"
            }
        },
        "recipients": [
            {
            "recipient": "{{recipient1}}",
            "recipient_type": "individual",
            "reference": {
                "cust_ref": "[email protected]",
                "messageTag1": "SomeMessageTag",
                "conversationId": "ConversationId"
            }
            },
            {
            "recipient": "{{recipient2}}",
            "recipient_type": "individual",
            "reference": {
                "cust_ref": "[email protected]",
                "messageTag1": "SomeMessageTag",
                "conversationId": "ConversationId"
            }
            }
        ],
        "report_url": "https://the_url_to_recieve_delivery_report.com"
        },
        {
        "originator": "{registered phone_number}",
        "content": {
            "message_type": "TEXT",
            "text": {
            "preview_url": true,
            "body": "Hi, How can I help you?"
            }
        },
        "recipients": [
            {
            "recipient": "{{recipient1}}",
            "recipient_type": "individual",
            "reference": {
                "cust_ref": "[email protected]",
                "messageTag1": "SomeMessageTag",
                "conversationId": "ConversationId"
            }
            },
            {
            "recipient": "{{recipient2}}",
            "recipient_type": "individual",
            "reference": {
                "cust_ref": "[email protected]",
                "messageTag1": "SomeMessageTag",
                "conversationId": "ConversationId"
            }
            }
        ],
        "report_url": "https://the_url_to_recieve_delivery_report.com"
        }
    ]
    })

    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://api.d7networks.com/whatsapp/v2/send");
    request.Headers.Add("Authorization", "Bearer {{api_access_token}}");
    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                {\n                    \"recipient\": \"{{recipient1}}\",\n                    \"recipient_type\": \"individual\",\n                    \"reference\": {\n                        \"cust_ref\": \"[email protected]\",\n                        \"messageTag1\": \"SomeMessageTag\",\n                        \"conversationId\": \"ConversationId\"\n                    }\n                },\n                {\n                    \"recipient\": \"{{recipient2}}\",\n                    \"recipient_type\": \"individual\",\n                    \"reference\": {\n                        \"cust_ref\": \"[email protected]\",\n                        \"messageTag1\": \"SomeMessageTag\",\n                        \"conversationId\": \"ConversationId\"\n                    }\n                }\n            ],\n            \"report_url\": \"https://the_url_to_recieve_delivery_report.com\"\n        },\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                {\n                    \"recipient\": \"{{recipient1}}\",\n                    \"recipient_type\": \"individual\",\n                    \"reference\": {\n                        \"cust_ref\": \"[email protected]\",\n                        \"messageTag1\": \"SomeMessageTag\",\n                        \"conversationId\": \"ConversationId\"\n                    }\n                },\n                {\n                    \"recipient\": \"{{recipient2}}\",\n                    \"recipient_type\": \"individual\",\n                    \"reference\": {\n                        \"cust_ref\": \"[email protected]\",\n                        \"messageTag1\": \"SomeMessageTag\",\n                        \"conversationId\": \"ConversationId\"\n                    }\n                }\n            ],\n            \"report_url\": \"https://the_url_to_recieve_delivery_report.com\"\n        }\n    ]\n}", null, "application/json");
    request.Content = content;
    var response = await client.SendAsync(request);
    response.EnsureSuccessStatusCode();
    Console.WriteLine(await response.Content.ReadAsStringAsync());

Send scheduled messages (Text Message)

    curl --location 'https://api.d7networks.com/whatsapp/v2/send' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Bearer {{api_access_token}}' \
    --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"
            }
        ],
        "message_globals": {
            "schedule_time": "2024-06-19T08:14:42+0000"
        }
    }'
    const axios = require('axios');
    let data = JSON.stringify({
    "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"
        }
    ],
    "message_globals": {
        "schedule_time": "2024-06-19T08:14:42+0000"
    }
    });

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

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

    url = "https://api.d7networks.com/whatsapp/v2/send"

    payload = json.dumps({
    "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"
        }
    ],
    "message_globals": {
        "schedule_time": "2024-06-19T08:14:42+0000"
    }
    })
    headers = {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer {{api_access_token}}'
    }

    response = requests.request("POST", url, headers=headers, data=payload)

    print(response.text)
    <?php

    $curl = curl_init();

    curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://api.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": "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"
            }
        ],
        "message_globals": {
            "schedule_time": "2024-06-19T08:14:42+0000"
        }
    }',
    CURLOPT_HTTPHEADER => array(
        'Content-Type: application/json',
        'Authorization: Bearer {{api_access_token}}'
    ),
    ));

    $response = curl_exec($curl);

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

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

    func main() {

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

    payload := strings.NewReader(`{
        "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"
            }
        ],
        "message_globals": {
            "schedule_time": "2024-06-19T08:14:42+0000"
        }
    }`)

    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 {{api_access_token}}")

    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\": \"TEXT\",\n                \"text\": {\n                    \"preview_url\": true,\n                    \"body\": \"Hi, How can I help you?\"\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    \"message_globals\": {\n        \"schedule_time\": \"2024-06-19T08:14:42+0000\"\n    }\n}");
    Request request = new Request.Builder()
    .url("https://api.d7networks.com/whatsapp/v2/send")
    .method("POST", body)
    .addHeader("Content-Type", "application/json")
    .addHeader("Authorization", "Bearer {{api_access_token}}")
    .build();
    Response response = client.newCall(request).execute();
    var headers = {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer {{api_access_token}}'
    };
    var request = http.Request('POST', Uri.parse('https://api.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"
        }
    ],
    "message_globals": {
        "schedule_time": "2024-06-19T08:14:42+0000"
    }
    });
    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 {{api_access_token}}")

    $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`"
            }
        ],
        `"message_globals`": {
            `"schedule_time`": `"2024-06-19T08:14:42+0000`"
        }
    }
    "@

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

    url = URI("https://api.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 {{api_access_token}}"
    request.body = JSON.dump({
    "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"
        }
    ],
    "message_globals": {
        "schedule_time": "2024-06-19T08:14:42+0000"
    }
    })

    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://api.d7networks.com/whatsapp/v2/send");
    request.Headers.Add("Authorization", "Bearer {{api_access_token}}");
    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                {\n                    \"recipient\": \"{recipient}\",\n                    \"recipient_type\": \"individual\"\n                }\n            ],\n            \"report_url\": \"https://webhook.site/4235f691-13ab-448e-b100-74a3a627927f\"\n        }\n    ],\n    \"message_globals\": {\n        \"schedule_time\": \"2024-06-19T08:14:42+0000\"\n    }\n}", null, "application/json");
    request.Content = content;
    var response = await client.SendAsync(request);
    response.EnsureSuccessStatusCode();
    Console.WriteLine(await response.Content.ReadAsStringAsync());