Skip to content

Send SMS

Our Messaging API designed to fullfill most of your use cases and can be easily integrate to any of the system. We can implement single SMS, Personlized batch SMS's, Unicode (language types), Scheduling SMS, etc using this API.

POST
/messages/v1/send

Authentication

AUTHORIZATION: Bearer Token

Request parameters

Parameter Value / Pattern
*originator The Sender/Header of a message. We can use your brand name with a maximum character limit of 11 or your mobile number with your country code. If you would like to register a new Sender ID, you can submit your details here
*recipients Mobile Numbers to send SMS seperated by comma in an array. The recipient's phone number should have a country code prefix. You can also set the Default Country here, and all your messages will be prefixed with the selected country code.
*content The message content is being sent. A long message over 160 characters will be split into multiple messages with 153 characters each and forwarded to telecom. When Unicode messages exceed 70 characters, they are split into multiple messages of 63 characters each. Also, billing will be based on the number of message parts sent
*channel To select the messaging channel that you want to use. (e.g., SMS, WhatsApp, Viber, Telegram, etc.)
num_lookup Type: Boolean. To number lookup every SMS sent from your account. This will help you to send sms only to reachable numbers. Additional charges included for this service. (Default: False). You can also enable Number Lookup here, and all your recipients will be lookup.
report_url To receive delivery status (DLR) for your message, specify the callback server URL where you want to receive the message status updates using the report_url parameter. When the delivery status changes, the status updates will be sent to the specified URL. For information on the format of the DLR message, please refer to the "Receiving DLR" section.
data_coding Set as text for normal GSM 03.38 characters(English, normal characters). Set as unicode for non GSM 03.38 characters (Arabic, Chinese, Hebrew, Greek like regional languages and Unicode characters). Set as auto so we will find the data_coding based on your content.
msg_type text, audio sms, multimedia, image
schedule_time To schedule the message to be sent at a specific date and time, provide the value of the schedule_time parameter in the following format: "YYYY-MM-DDTHH:MM+HH:MM", where "YYYY-MM-DD" represents the date, "HH:MM" represents the time, and "+HH:MM" represents the timezone offset. For example, if your timezone is four hours ahead of Coordinated Universal Time (UTC+04:00), the schedule_time parameter should be set as "2023-04-17T16:18+04:00".

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."
    } 
} 
402 - Payment Required
    {
    "detail": [
        {
            "code": "INSUFFICIENT_CREDIT",
            "message": "It looks like your requests failed due to insufficient credit on our account. Sign in at https://app.d7networks.com and make a payment to resume the messaging service on your account or contact [email protected] to get more test credits."
        }
    ]
}
422 - Validation Error
{
    "detail": [
        {
            "loc": [
            "string"
            ],
        "msg": "string",
        "type": "string"
        }
    ]
} 

Response Parameters

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

Examples:

1. Same content to Multiple recipients

curl --location --request POST 'https://api.d7networks.com/messages/v1/send' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {{api_access_token}}' \
--data-raw '{
"messages": [
    {
        "channel": "sms",
        "recipients": ["{{recipient1}}","{{recipient2}}"],
        "content": "Greetings from D7 API",
        "msg_type": "text",
        "data_coding": "text"
    }
],
"message_globals": {
    "originator": "SignOTP",
    "report_url": "https://the_url_to_recieve_delivery_report.com"
}
}'
npm i direct7
const Client = require('direct7')

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

const response = await client.sms.sendMessage(
        'SignOtp',
        'https://the_url_to_recieve_delivery_report.com',
        {
            recipients: ["+recipient1", "recipient2"],
            content: "Greetings from D7 API",
            unicode: false
        }
    );
console.log(response);
pip install direct7
1
2
3
4
5
6
7
8
9
from direct7 import Client

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

client.sms.send_messages(
    {"recipients": ["+9199xXXXXXXX"],"content": "Greetings from D7 API", "unicode": False},
    originator="Sender",
    report_url="https://the_url_to_receive_delivery_report.com",
    )
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")

$response = $direct7->sms->sendMessage(
    'Sender',
    'https://example.com/callback',
    [
        'recipients' => ["+91999999XXXX"],
        'content' => 'Greetings from D7 API',
        'unicode' => false,
    ]
);

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)
sms := direct7.NewSMS(client)
params := direct7.Message{
    Recipients:  []string{"{{recipient1}}"},
    Content:     "Greetings from D7 API",
    Unicode:     "false",
}
response, err := sms.SendMessages([]direct7.Message{params}, "Sender", "https://the_url_to_receive_delivery_report.com", "")
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n  \"messages\": [\n    {\n        \"channel\": \"sms\",\n        \"recipients\": [\"{{recipient1}}\",\"{{recipient2}}\"],\n        \"content\": \"Greetings from D7 API\",\n        \"msg_type\": \"text\",\n        \"data_coding\": \"text\"\n    }\n  ],\n  \"message_globals\": {\n    \"originator\": \"SignOTP\",\n    \"report_url\": \"https://the_url_to_recieve_delivery_report.com\"\n  }\n}");
Request request = new Request.Builder()
.url("https://api.d7networks.com/messages/v1/send")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer {{api_access_token}}")
.build();
Response response = client.newCall(request).execute();
var headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer {{api_access_token}}'
};
var request = http.Request('POST', Uri.parse('https://api.d7networks.com/messages/v1/send'));
request.body = json.encode({
"messages": [
    {
    "channel": "sms",
    "recipients": [
        "{{recipient1}}",
        "{{recipient2}}"
    ],
    "content": "Greetings from D7 API",
    "msg_type": "text",
    "data_coding": "text"
    }
],
"message_globals": {
    "originator": "SignOTP",
    "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);
}
1
2
3
4
5
6
7
8
9
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Content-Type", "application/json")
$headers.Add("Accept", "application/json")
$headers.Add("Authorization", "Bearer {{api_access_token}}")

$body = "{`n  `"messages`": [`n    {`n        `"channel`": `"sms`",`n        `"recipients`": [`"{{recipient1}}`",`"{{recipient2}}`"],`n        `"content`": `"Greetings from D7 API`",`n        `"msg_type`": `"text`",`n        `"data_coding`": `"text`"`n    }`n  ],`n  `"message_globals`": {`n    `"originator`": `"SignOTP`",`n    `"report_url`": `"https://the_url_to_recieve_delivery_report.com`"`n  }`n}"

$response = Invoke-RestMethod 'https://api.d7networks.com/messages/v1/send' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
gem install direct7
require 'direct7'

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

client.sms.send_message(
    originator='SignOTP',
    report_url='https://the_url_to_recieve_delivery_report.com',
    schedule_time=nil,
    { recipients: ['+991999999XXXX'], content: 'Greetings from D7 API', unicode: false }
)
1
2
3
4
5
6
7
8
9
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://api.d7networks.com/messages/v1/send");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", "Bearer {{api_access_token}}");
var content = new StringContent("{\n  \"messages\": [\n    {\n        \"channel\": \"sms\",\n        \"recipients\": [\"{{recipient1}}\",\"{{recipient2}}\"],\n        \"content\": \"Greetings from D7 API\",\n        \"msg_type\": \"text\",    \n        \"data_coding\": \"text\"  \n    }\n  ],\n  \"message_globals\": {\n    \"originator\": \"SignOTP\",\n    \"report_url\": \"https://the_url_to_recieve_delivery_report.com\" \n  }\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());

2. Different content and Multiple destinations

curl --location --request POST 'https://api.d7networks.com/messages/v1/send' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {{api_access_token}}' \
--data-raw '{
    "messages": [
        {
        "recipients": ["{{recipient1}}","{{recipient2}}"],
        "content": "Greetings from D7 API - First message",
        "msg_type": "text",
        "data_coding": "text"
        },
        {
        "recipients": ["{{recipient3}}","{{recipient4}}"],
        "content": "Greetings from D7 API - Second Message",
        "msg_type": "text",
        "data_coding": "text"
        }
    ],
    "message_globals": {
        "channel": "sms",
        "originator": "SignOTP",
        "report_url": "https://the_url_to_recieve_delivery_report.com"
        }
}'
const Client = require('direct7')
const client = new Client(apiToken="Your API token")

const response = await client.sms.sendMessage(
            'SignOtp',
            'https://the_url_to_recieve_delivery_report.com',
            {recipients: ["+recipient1", "recipient2"], content: 'لوحة المفاتيح العربية!', unicode: true},
            {recipients: ["+recipient1", "recipient2"], content: "Greetings from D7 API", unicode: false},
        );
console.log(response);
pip install direct7
from direct7 import Client

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

client.sms.send_messages(
    {"recipients": ["+9199xXXXXXXX"],"content": "Greetings from D7 API", "unicode": False},
    {"recipients": ["+9199xXXXXXXX"],"content": "D7 API", "unicode": False},
    originator="Sender",
    report_url="https://the_url_to_receive_delivery_report.com",
    )
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")

$response = $direct7->sms->sendMessage(
    'Sender',
    'https://example.com/callback',
    [
        'recipients' => ["+91999999XXXX"],
        'content' => 'Greetings from D7 API',
        'unicode' => false,
    ],
    [
        'recipients' => ["+91999999XXXX"],
        'content' => 'D7 API',
        'unicode' => false,
    ]
);

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)
sms := direct7.NewSMS(client)
params_1 := direct7.Message{
    Recipients:  []string{"{{recipient1}}"},
    Content:     "Greetings from D7 API",
    Unicode:     "false",
}
params_2 := direct7.Message{
    Recipients: []string{"{{recipient2}}"},
    Content:    "Greetings from D7",
    Unicode:    "false",
}
response, err := sms.SendMessages([]direct7.Message{params_1, params_2}, "Sender", "https://the_url_to_receive_delivery_report.com", "")
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n    \"messages\": [\n        {\n        \"recipients\": [\"{{recipient1}}\",\"{{recipient2}}\"],\n        \"content\": \"Greetings from D7 API - First message\",\n        \"msg_type\": \"text\",\n        \"data_coding\": \"text\"\n        },\n        {\n        \"recipients\": [\"{{recipient3}}\",\"{{recipient4}}\"],\n        \"content\": \"Greetings from D7 API - Second Message\",\n        \"msg_type\": \"text\",\n        \"data_coding\": \"text\"\n        }\n    ],\n    \"message_globals\": {\n        \"channel\": \"sms\",\n        \"originator\": \"SignOTP\",\n        \"report_url\": \"https://the_url_to_recieve_delivery_report.com\"\n        }\n}");
Request request = new Request.Builder()
.url("https://api.d7networks.com/messages/v1/send")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer {{api_access_token}}")
.build();
Response response = client.newCall(request).execute();    
var headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer {{api_access_token}}'
};
var request = http.Request('POST', Uri.parse('https://api.d7networks.com/messages/v1/send'));
request.body = json.encode({
"messages": [
    {
    "recipients": [
        "{{recipient1}}",
        "{{recipient2}}"
    ],
    "content": "Greetings from D7 API - First message",
    "msg_type": "text",
    "data_coding": "text"
    },
    {
    "recipients": [
        "{{recipient3}}",
        "{{recipient4}}"
    ],
    "content": "Greetings from D7 API - Second Message",
    "msg_type": "text",
    "data_coding": "text"
    }
],
"message_globals": {
    "channel": "sms",
    "originator": "SignOTP",
    "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);
}
1
2
3
4
5
6
7
8
9
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Content-Type", "application/json")
$headers.Add("Accept", "application/json")
$headers.Add("Authorization", "Bearer {{api_access_token}}")

$body = "{`n    `"messages`": [`n        {`n        `"recipients`": [`"{{recipient1}}`",`"{{recipient2}}`"],`n        `"content`": `"Greetings from D7 API - First message`",`n        `"msg_type`": `"text`",`n        `"data_coding`": `"text`"`n        },`n        {`n        `"recipients`": [`"{{recipient3}}`",`"{{recipient4}}`"],`n        `"content`": `"Greetings from D7 API - Second Message`",`n        `"msg_type`": `"text`",`n        `"data_coding`": `"text`"`n        }`n    ],`n    `"message_globals`": {`n        `"channel`": `"sms`",`n        `"originator`": `"SignOTP`",`n        `"report_url`": `"https://the_url_to_recieve_delivery_report.com`"`n        }`n}"

$response = Invoke-RestMethod 'https://api.d7networks.com/messages/v1/send' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
gem install direct7
require 'direct7'

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

client.sms.send_message(
    originator='SignOTP',
    report_url='https://the_url_to_recieve_delivery_report.com',
    schedule_time=nil,
    { recipients: ['+991999999XXXX'], content: 'Greetings from D7 API', unicode: false },
    { recipients: ['+991999999XXXX'], content: 'D7 API', unicode: false }
)
1
2
3
4
5
6
7
8
9
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://api.d7networks.com/messages/v1/send");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", "Bearer {{api_access_token}}");
var content = new StringContent("{\n    \"messages\": [\n        {\n        \"recipients\": [\"{{recipient1}}\",\"{{recipient2}}\"],\n        \"content\": \"Greetings from D7 API - First message\",\n        \"msg_type\": \"text\",  \n        \"data_coding\": \"text\" \n        },\n        {\n        \"recipients\": [\"{{recipient3}}\",\"{{recipient4}}\"],\n        \"content\": \"Greetings from D7 API - Second Message\",\n        \"msg_type\": \"text\", \n        \"data_coding\": \"text\" \n        }\n    ],\n    \"message_globals\": {\n        \"channel\": \"sms\",\n        \"originator\": \"SignOTP\",\n        \"report_url\": \"https://the_url_to_recieve_delivery_report.com\" \n        }\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());

3. Send Unicode messages

curl --location --request POST 'https://api.d7networks.com/messages/v1/send' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {{api_access_token}}' \
--data-raw '{
"messages": [
    {
        "channel": "sms",
        "recipients": ["{{recipient1}}","{{recipient2}}"],
        "content": "Привет от D7 API, Спасибо за тестирование наших служб обмена сообщениями",
        "msg_type": "text",
        "data_coding": "unicode"
    }
],
"message_globals": {
    "originator": "SignOTP",
    "report_url": "https://the_url_to_recieve_delivery_report.com"
}
}'
npm i direct7
const Client = require('direct7')
const client = new Client(apiToken="Your API token")

const response = await client.sms.sendMessage(
    'SignOtp',
    'https://the_url_to_recieve_delivery_report.com',
    { 
        recipients: ["+91999XXXXXXX"],
        content: 'لوحة المفاتيح العربية!',
        unicode: true 
    }
    );
console.log(response);
pip install direct7
1
2
3
4
5
6
7
8
9
from direct7 import Client

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

client.sms.send_messages(
    {"recipients": ["+9199XXXXXXXXXX"],"content": "مرحبا بالعالم!", "unicode": True},
    originator="Sender",
    report_url="https://the_url_to_receive_delivery_report.com",
    )

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")

$response = $direct7->sms->sendMessage(
    'Sender',
    'https://example.com/callback',
    null,
    [
        'recipients' => ["+919999XXXXXX"],
        'content' => 'لوحة المفاتيح العربية!',
        'unicode' => true,
    ]
);

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)
sms := direct7.NewSMS(client)
params := Message{
    Recipients:  []string{"{{recipient}}"},
    Content:     "مرحبا بالعالم!",
    Unicode:     "true",
}
response, err := sms.SendMessages([]Message{params}, "Sender", "https://the_url_to_receive_delivery_report.com", "")
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n  \"messages\": [\n    {\n        \"channel\": \"sms\",\n        \"recipients\": [\"{{recipient1}}\",\"{{recipient2}}\"],\n        \"content\": \"Привет от D7 API, Спасибо за тестирование наших служб обмена сообщениями\",\n        \"msg_type\": \"text\",\n        \"data_coding\": \"unicode\"\n    }\n  ],\n  \"message_globals\": {\n    \"originator\": \"SignOTP\",\n    \"report_url\": \"https://the_url_to_recieve_delivery_report.com\"\n  }\n}");
Request request = new Request.Builder()
.url("https://api.d7networks.com/messages/v1/send")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer {{api_access_token}}")
.build();
Response response = client.newCall(request).execute();
var headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer {{api_access_token}}'
};
var request = http.Request('POST', Uri.parse('https://api.d7networks.com/messages/v1/send'));
request.body = json.encode({
"messages": [
    {
    "channel": "sms",
    "recipients": [
        "{{recipient1}}",
        "{{recipient2}}"
    ],
    "content": "Привет от D7 API, Спасибо за тестирование наших служб обмена сообщениями",
    "msg_type": "text",
    "data_coding": "unicode"
    }
],
"message_globals": {
    "originator": "SignOTP",
    "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);
}
1
2
3
4
5
6
7
8
9
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Content-Type", "application/json")
$headers.Add("Accept", "application/json")
$headers.Add("Authorization", "Bearer {{api_access_token}}")

$body = "{`n  `"messages`": [`n    {`n        `"channel`": `"sms`",`n        `"recipients`": [`"{{recipient1}}`",`"{{recipient2}}`"],`n        `"content`": `"Привет от D7 API, Спасибо за тестирование наших служб обмена сообщениями`",`n        `"msg_type`": `"text`",`n        `"data_coding`": `"unicode`"`n    }`n  ],`n  `"message_globals`": {`n    `"originator`": `"SignOTP`",`n    `"report_url`": `"https://the_url_to_recieve_delivery_report.com`"`n  }`n}"

$response = Invoke-RestMethod 'https://api.d7networks.com/messages/v1/send' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
gem install direct7
require 'direct7'

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

client.sms.send_message(
    originator='SignOTP',
    report_url='https://the_url_to_recieve_delivery_report.com',
    schedule_time=nil,
    { recipients: ['+919999XXXXXX'], content: "مرحبا بالعالم!", unicode: true }
    )
1
2
3
4
5
6
7
8
9
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://api.d7networks.com/messages/v1/send");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", "Bearer {{api_access_token}}");
var content = new StringContent("{\n  \"messages\": [\n    {\n        \"channel\": \"sms\",\n        \"recipients\": [\"{{recipient1}}\",\"{{recipient2}}\"],\n        \"content\": \"Привет от D7 API, Спасибо за тестирование наших служб обмена сообщениями\",\n        \"msg_type\": \"text\", \n        \"data_coding\": \"unicode\" \n    }\n  ],\n  \"message_globals\": {\n    \"originator\": \"SignOTP\"\n        \n  }\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());

4. Send mixed content (text and unicode) messages

curl --location --request POST 'https://api.d7networks.com/messages/v1/send' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {{api_access_token}}' \
--data-raw '{
"messages": [
    {
        "channel": "sms",
        "recipients": ["{{recipient1}}","{{recipient2}}"],
        "content": "Привет от D7 API, Спасибо за тестирование наших служб обмена сообщениями",
        "msg_type": "text",
        "data_coding": "auto"
    }
],
"message_globals": {
    "originator": "SignOTP",
    "report_url": "https://the_url_to_recieve_delivery_report.com"
}
}'
const Client = require('direct7')
const client = new Client(apiToken="Your API token")

const response = await client.sms.sendMessage(
            'SignOtp',
            'https://the_url_to_recieve_delivery_report.com',
            {
                recipients: ["+recipient1", "recipient2"],
                content: "Привет от D7 API, Спасибо за тестирование наших служб обмена сообщениями",
                unicode: true
            }
        );
console.log(response);
pip install direct7
1
2
3
4
5
6
7
8
9
from direct7 import Client

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

client.sms.send_messages(
    {"recipients": ["+9199xXXXXXXX"],"content": "Привет от D7 API, Спасибо за тестирование наших служб обмена сообщениями", "unicode": True},
    originator="Sender",
    report_url="https://the_url_to_receive_delivery_report.com",
    )
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")

$response = $direct7->sms->sendMessage(
    'Sender',
    'https://example.com/callback',
    [
        'recipients' => ["+91999999XXXX"],
        'content' => 'Привет от D7 API, Спасибо за тестирование наших служб обмена сообщениями',
        'unicode' => true,
    ]
);

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)
sms := direct7.NewSMS(client)
params := Message{
    Recipients:  []string{"{{recipient1}}"},
    Content:     "Привет от D7 API, Спасибо за тестирование наших служб обмена сообщениями",
    Unicode:     "true",
}
response, err := sms.SendMessages([]Message{params}, "Sender", "https://the_url_to_receive_delivery_report.com", "")
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n  \"messages\": [\n    {\n        \"channel\": \"sms\",\n        \"recipients\": [\"{{recipient1}}\",\"{{recipient2}}\"],\n        \"content\": \"Привет от D7 API, Спасибо за тестирование наших служб обмена сообщениями\",\n        \"msg_type\": \"text\",\n        \"data_coding\": \"auto\"\n    }\n  ],\n  \"message_globals\": {\n    \"originator\": \"SignOTP\",\n    \"report_url\": \"https://the_url_to_recieve_delivery_report.com\"\n  }\n}");
Request request = new Request.Builder()
.url("https://api.d7networks.com/messages/v1/send")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer {{api_access_token}}")
.build();
Response response = client.newCall(request).execute();
var headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer {{api_access_token}}'
};
var request = http.Request('POST', Uri.parse('https://api.d7networks.com/messages/v1/send'));
request.body = json.encode({
"messages": [
    {
    "channel": "sms",
    "recipients": [
        "{{recipient1}}",
        "{{recipient2}}"
    ],
    "content": "Привет от D7 API, Спасибо за тестирование наших служб обмена сообщениями",
    "msg_type": "text",
    "data_coding": "auto"
    }
],
"message_globals": {
    "originator": "SignOTP",
    "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);
}
1
2
3
4
5
6
7
8
9
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Content-Type", "application/json")
$headers.Add("Accept", "application/json")
$headers.Add("Authorization", "Bearer {{api_access_token}}")

$body = "{`n  `"messages`": [`n    {`n        `"channel`": `"sms`",`n        `"recipients`": [`"{{recipient1}}`",`"{{recipient2}}`"],`n        `"content`": `"Привет от D7 API, Спасибо за тестирование наших служб обмена сообщениями`",`n        `"msg_type`": `"text`",`n        `"data_coding`": `"auto`"`n    }`n  ],`n  `"message_globals`": {`n    `"originator`": `"SignOTP`",`n    `"report_url`": `"https://the_url_to_recieve_delivery_report.com`"`n  }`n}"

$response = Invoke-RestMethod 'https://api.d7networks.com/messages/v1/send' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
gem install direct7
require 'direct7'

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

client.sms.send_message(
    originator='SignOTP',
    report_url='https://the_url_to_recieve_delivery_report.com',
    schedule_time=nil,
    { recipients: ['+991999999XXXX'], content: 'Привет от D7 API, Спасибо за тестирование наших служб обмена сообщениями', unicode: true }
)
1
2
3
4
5
6
7
8
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://api.d7networks.com/messages/v1/send");
request.Headers.Add("Authorization", "Bearer {{api_access_token}}");
var content = new StringContent("{\n  \"messages\": [\n    {\n        \"channel\": \"sms\",\n        \"recipients\": [\"{{recipient1}}\",\"{{recipient2}}\"],\n        \"content\": \"Привет от D7 API, Спасибо за тестирование наших служб обмена сообщениями\"\n    },\n    {\n        \"channel\": \"sms\",\n        \"recipients\": [\"{{recipient3}}\",\"{{recipient4}}\"],\n        \"content\": \"Hello from D7 API, Thanks for testing our messaging services\"\n    }\n  ],\n  \"message_globals\": {\n    \"originator\": \"D7Web\", \n    \"data_coding\": \"auto\",\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());

4. Send scheduled messages

curl --location 'https://api.d7networks.com/messages/v1/send' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{api_access_token}}' \
--data '{
"messages": [
    {
        "channel": "sms",
        "recipients": ["{{recipient1}}","{{recipient2}}"],
        "content": "Привет от D7 API, Спасибо за тестирование наших служб обмена сообщениями"
    },
    {
        "channel": "sms",
        "recipients": ["{{recipient3}}","{{recipient4}}"],
        "content": "Hello from D7 API, Thanks for testing our messaging services"
    }
],
"message_globals": {
    "originator": "D7Web", 
    "data_coding": "auto",
    "report_url": "https://the_url_to_recieve_delivery_report.com", 
    "schedule_time": "2023-04-19T16:18+04:00" 
    }
}'
const Client = require('direct7')
const client = new Client(apiToken="Your API token")

const response = await client.sms.sendMessage(
        'SignOtp',
        'https://the_url_to_recieve_delivery_report.com',
        '2024-02-05T07:13:13+0000',
        {recipients: ["+recipient1", "recipient2"], content: "Greetings from D7 API", unicode: false},
    );
console.log(response);
pip install direct7
from direct7 import Client

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

client.sms.send_messages(
    {"recipients": ["+9199xXXXXXXX"],"content": "Greetings from D7 API", "unicode": False},
    originator="Sender",
    report_url="https://the_url_to_receive_delivery_report.com",
    schedule_time='2024-02-05T07:13:13+0000'
    )
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")

$response = $direct7->sms->sendMessage(
    'Sender',
    'https://example.com/callback',
    '2024-02-05T10:17:10+0000',
    [
        'recipients' => ["+91999999XXXX"],
        'content' => 'Greetings from D7 API',
        'unicode' => false,
    ]
);

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)
sms := direct7.NewSMS(client)
params := direct7.Message{
    Recipients:  []string{"{{recipient1}}"},
    Content:     "Greetings from D7 API",
    Unicode:     "false",
}
response, err := sms.SendMessages([]direct7.Message{params}, "Sender", "https://the_url_to_receive_delivery_report.com", "2024-02-05T09:48:42+0000")
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n  \"messages\": [\n    {\n        \"channel\": \"sms\",\n        \"recipients\": [\"{{recipient1}}\",\"{{recipient2}}\"],\n        \"content\": \"Привет от D7 API, Спасибо за тестирование наших служб обмена сообщениями\"\n    },\n    {\n        \"channel\": \"sms\",\n        \"recipients\": [\"{{recipient3}}\",\"{{recipient4}}\"],\n        \"content\": \"Hello from D7 API, Thanks for testing our messaging services\"\n    }\n  ],\n  \"message_globals\": {\n    \"originator\": \"D7Web\", \n    \"data_coding\": \"auto\",\n    \"report_url\": \"https://the_url_to_recieve_delivery_report.com\", \n    \"schedule_time\": \"2023-04-19T16:18+04:00\" \n  }\n}");
Request request = new Request.Builder()
.url("https://api.d7networks.com/messages/v1/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/messages/v1/send'));
request.body = json.encode({
"messages": [
    {
    "channel": "sms",
    "recipients": [
        "{{recipient1}}",
        "{{recipient2}}"
    ],
    "content": "Привет от D7 API, Спасибо за тестирование наших служб обмена сообщениями"
    },
    {
    "channel": "sms",
    "recipients": [
        "{{recipient3}}",
        "{{recipient4}}"
    ],
    "content": "Hello from D7 API, Thanks for testing our messaging services"
    }
],
"message_globals": {
    "originator": "D7Web",
    "data_coding": "auto",
    "report_url": "https://the_url_to_recieve_delivery_report.com",
    "schedule_time": "2023-04-19T16:18+04:00"
}
});
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`": [
    {
        `"channel`": `"sms`",
        `"recipients`": [`"{{recipient1}}`",`"{{recipient2}}`"],
        `"content`": `"Привет от D7 API, Спасибо за тестирование наших служб обмена сообщениями`"
    },
    {
        `"channel`": `"sms`",
        `"recipients`": [`"{{recipient3}}`",`"{{recipient4}}`"],
        `"content`": `"Hello from D7 API, Thanks for testing our messaging services`"
    }
],
`"message_globals`": {
    `"originator`": `"D7Web`", 
    `"data_coding`": `"auto`",
    `"report_url`": `"https://the_url_to_recieve_delivery_report.com`", 
    `"schedule_time`": `"2023-04-19T16:18+04:00`" 
}
}
"@

$response = Invoke-RestMethod 'https://api.d7networks.com/messages/v1/send' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
gem install direct7
require 'direct7'

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

client.sms.send_message(
    originator='SignOTP',
    report_url='https://the_url_to_recieve_delivery_report.com',
    schedule_time='2023-04-19T16:18+04:00',
    { recipients: ['+991999999XXXX'], content: 'Greetings from D7 API', unicode: false }
)
1
2
3
4
5
6
7
8
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://api.d7networks.com/messages/v1/send");
request.Headers.Add("Authorization", "Bearer {{api_access_token}}");
var content = new StringContent("{\n  \"messages\": [\n    {\n        \"channel\": \"sms\",\n        \"recipients\": [\"{{recipient1}}\",\"{{recipient2}}\"],\n        \"content\": \"Привет от D7 API, Спасибо за тестирование наших служб обмена сообщениями\"\n    },\n    {\n        \"channel\": \"sms\",\n        \"recipients\": [\"{{recipient3}}\",\"{{recipient4}}\"],\n        \"content\": \"Hello from D7 API, Thanks for testing our messaging services\"\n    }\n  ],\n  \"message_globals\": {\n    \"originator\": \"D7Web\", \n    \"data_coding\": \"auto\",\n    \"report_url\": \"https://the_url_to_recieve_delivery_report.com\", \n    \"schedule_time\": \"2023-04-19T16:18+04:00\" \n  }\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());