API v2 documentation
How it works
- We connect to the system the phone number from which messages will be sent.
- You choose a pricing plan and pay for it in a way convenient for you.
- Using our API, you send out your messages.
Example of sending a message via HTTP:
Code examples:
$data['json_data'] = json_encode([
"method" => "whatsapp_send",
"phone" => "77000000000",
"text" => "Сообщение",
"file_url" => "https://secure.gravatar.com/avatar/7cab71edb0a4c12a1e64bbfdf46a3c64",
"api_id" => "<app id>"
]);
$ch = curl_init("https://api.sendapi.net");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$body = curl_exec($ch);
curl_close($ch);
const data = {
json_data: JSON.stringify({
method: "whatsapp_send",
phone: "77000000000",
text: "Сообщение",
file_url: "https://secure.gravatar.com/avatar/7cab71edb0a4c12a1e64bbfdf46a3c64",
api_id: "<app id>"
})
};
fetch("https://api.sendapi.net", {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
body: new URLSearchParams(data)
})
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.error("Error:", error));
import requests
import json
data = {
'json_data': json.dumps({
'method': 'whatsapp_send',
'phone': '77000000000',
'text': 'Сообщение',
'file_url': 'https://secure.gravatar.com/avatar/7cab71edb0a4c12a1e64bbfdf46a3c64',
'api_id': '<app id>'
})
}
response = requests.post('https://api.sendapi.net', data=data)
result = response.json()
print(result)
- Address:
- https://api.sendapi.net
- Method:
- POST
- Parameters for json_data:
-
Parameter Required Description method whatsapp_send Send a Whatsapp message phone yes Recipient phone number or Whatsapp group ID text yes Message text in UTF-8 encoding api_id yes Your API key - Response to a successful request:
-
A successful request returns the ID of the sent message, which can later be used to get its status.
{ "result":0, "message_id":"1" } - Response to an unsuccessful request (More):
-
{ "result":1, "result_description":"Параметр method не передан." }
Code examples:
$file_path = 'absolute path /12019526947.jpg';
if (function_exists('curl_file_create')) { // php 5.5+
$cFile = curl_file_create($file_path);
} else {
$cFile = '@' . realpath($file_path);
}
$data['json_data'] = json_encode([
'method' => 'whatsapp_send',
'phone' => '77000000000',
'text' => 'файл 3',
'api_id' => '<app id>'
]);
$data['file'] = $cFile;
$ch = curl_init("https://api.sendapi.net");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$body = curl_exec($ch);
curl_close($ch);
const formData = new FormData();
const fileInput = document.getElementById('fileInput'); // HTML input type="file"
formData.append('json_data', JSON.stringify({
method: 'whatsapp_send',
phone: '77000000000',
text: 'файл 3',
api_id: '<app id>'
}));
formData.append('file', fileInput.files[0]);
fetch('https://api.sendapi.net', {
method: 'POST',
body: formData
})
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.error('Error:', error));
import requests
import json
file_path = '/path/to/your/file.jpg'
data = {
'json_data': json.dumps({
'method': 'whatsapp_send',
'phone': '77000000000',
'text': 'файл 3',
'api_id': '<app id>'
})
}
files = {
'file': open(file_path, 'rb')
}
response = requests.post('https://api.sendapi.net', data=data, files=files)
result = response.json()
print(result)
- Address:
- https://api.sendapi.net
- Method:
- POST
- Parameters for file:
-
Data of the transferred file - Parameters for json_data:
-
Parameter Required Description method whatsapp_send Send a Whatsapp message phone yes Recipient phone number text no Message text in UTF-8 encoding api_id yes Your API key - Response to a successful request:
-
A successful request returns the ID of the sent message, which can later be used to get its status.
{ "result":0, "message_id":"1" } - Response to an unsuccessful request (More):
-
{ "result":1, "result_description":"Параметр method не передан." }
Example of sending a message via HTTP:
Code examples:
$data['json_data'] = json_encode([
"method" => "whatsapp_mailing",
"name" => "Рассылка из API",
"text" => "Тестовое сообщение",
"file_url" => "https://api.sendapi.net/img/kp6.png",
"filter" => ["phones" => [77000000000,77000000001]],
"api_id" => "<app id>"
]);
$ch = curl_init("https://api.sendapi.net");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$body = curl_exec($ch);
curl_close($ch);
const data = {
json_data: JSON.stringify({
method: "whatsapp_mailing",
name: "Рассылка из API",
text: "Тестовое сообщение",
file_url: "https://api.sendapi.net/img/kp6.png",
filter: {
phones: [77000000000, 77000000001]
},
api_id: "<app id>"
})
};
fetch("https://api.sendapi.net", {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
body: new URLSearchParams(data)
})
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.error("Error:", error));
import requests
import json
data = {
'json_data': json.dumps({
'method': 'whatsapp_mailing',
'name': 'Рассылка из API',
'text': 'Тестовое сообщение',
'file_url': 'https://api.sendapi.net/img/kp6.png',
'filter': {
'phones': [77000000000, 77000000001]
},
'api_id': '<app id>'
})
}
response = requests.post('https://api.sendapi.net', data=data)
result = response.json()
print(result)
- Address:
- https://api.sendapi.net
- Method:
- GET, POST
- Parameters for json_data:
-
Parameter Required Description method whatsapp_mailing Send a Whatsapp broadcast name yes Broadcast name text yes (required if file_url is not specified) Message text in UTF-8 encoding. Limit: from 10 to 2000 characters file_url yes (required if text is not specified) File link filter yes Filter, data in JSON format, the JSON must not be empty. Available parameters:
• phones - array of phone numbers, minimum 2 numbers: [77010000000,77010000001];
• category - "all" or category id;
• date_registration - date the number was added, in JSON format: {"from":"2019-01-01 00:00:00","to":"2019-01-31 23:59:59"};
• date_active - date of number activity, in JSON format: {"from":"2019-01-01 00:00:00","to":"2019-01-31 23:59:59"};
The phones parameter has priority: if it is specified, other parameters are not used for filtering
The broadcast is sent only to numbers with the Subscribed status
Examples:
{"category":"all","date_registration":{"from":"2019-01-01 00:00:00","to":"2019-01-31 23:59:59"}
{"phones":[77010000000,77010000001]}
{"category":"all"}send_date no Date when the broadcast should be launched [format: 2019-02-03 00:00:00]. If not passed, the broadcast starts immediately api_id yes Your API key - Response to a successful request:
-
A successful request returns the ID of the sent message, which can later be used to get its status.
{ "result":0, "mailing_id":1 } - Response to an unsuccessful request (More):
-
{ "result":1, "result_description":"Параметр method не передан." }
Code examples:
$file_path = 'absolute path /12015426947.jpg';
if (function_exists('curl_file_create')) { // php 5.5+
$cFile = curl_file_create($file_path);
} else {
$cFile = '@' . realpath($file_path);
}
$data['json_data'] = json_encode([
'method' => 'whatsapp_send_contact_card',
'phone' => '77000000000',
'api_id' => '<app id>',
'contact_phone' => '77000000000',
'contact_name' => 'Имя контакта',
'file_url' => 'https://api.sendapi.net/img/kp6.png',
]);
$data['contact_logo_image'] = $cFile;
$ch = curl_init("https://api.sendapi.net");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$body = curl_exec($ch);
curl_close($ch);
const formData = new FormData();
formData.append('json_data', JSON.stringify({
method: 'whatsapp_send_contact_card',
phone: '77000000000',
api_id: '<app id>',
contact_phone: '77000000000',
contact_name: 'Имя контакта',
file_url: 'https://api.sendapi.net/img/kp6.png'
}));
// If there is a contact logo file
const fileInput = document.getElementById('logoInput');
if (fileInput && fileInput.files[0]) {
formData.append('contact_logo_image', fileInput.files[0]);
}
fetch('https://api.sendapi.net', {
method: 'POST',
body: formData
})
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.error('Error:', error));
import requests
import json
data = {
'json_data': json.dumps({
'method': 'whatsapp_send_contact_card',
'phone': '77000000000',
'api_id': '<app id>',
'contact_phone': '77000000000',
'contact_name': 'Имя контакта',
'file_url': 'https://api.sendapi.net/img/kp6.png'
})
}
# If there is a contact logo file
files = {}
logo_path = '/path/to/contact/logo.jpg' # path to the logo file
try:
files['contact_logo_image'] = open(logo_path, 'rb')
except FileNotFoundError:
pass
response = requests.post('https://api.sendapi.net', data=data, files=files)
result = response.json()
print(result)
- Address:
- https://api.sendapi.net
- Method:
- POST
- Parameters for file:
-
Data of the transferred file - Parameters for json_data:
-
Parameter Required Description method whatsapp_send_contact_card Send a Whatsapp message phone yes Recipient phone number contact_phone yes Phone number passed in the contact contact_name yes Contact name logo_id yes, if the contact_logo_image parameter is not specified Logo ID, which becomes known after the logo is uploaded via the contact_logo_image parameter. [Parameter is deprecated, use file_url] file_url yes, if the contact_logo_image parameter is not specified Image URL. Image format: jpg, jpeg, png. Example: https://api.sendapi.net/img/kp6.png api_id yes Your API key - Parameters for contact_logo_image:
-
contact_logo_image yes, if the logo_id parameter is not specified; if logo_id is specified, the uploaded file will be ignored. Attention: only the jpg, jpeg image format is allowed for sending. Parameter into which the file must be uploaded - Response to a successful request:
-
On success, only the sending status is returned.
{ "result":0, } - Response to a successful request when contact_logo_image is passed:
-
On success, the sending status and the logo ID are returned; the ID can then be used in the logo_id parameter.
{ "result":0, "logo_id":"100" } - Response to an unsuccessful request (More):
-
{ "result":1, "result_description":"Параметр method не передан." }
Example of sending a message via HTTP:
Code examples:
$data['json_data'] = json_encode([
"method" => "whatsapp_send_geolocation",
"phone" => "77000000000",
"latitude" => "53.284461",
"longitude" => "69.378938",
"altitude" => "5.5",
"accurate" => "5.5",
"api_id" => "<app id>"
]);
$ch = curl_init("https://api.sendapi.net");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$body = curl_exec($ch);
curl_close($ch);
const data = {
json_data: JSON.stringify({
method: "whatsapp_send_geolocation",
phone: "77000000000",
latitude: "53.284461",
longitude: "69.378938",
altitude: "5.5",
accurate: "5.5",
api_id: "<app id>"
})
};
fetch("https://api.sendapi.net", {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
body: new URLSearchParams(data)
})
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.error("Error:", error));
import requests
import json
data = {
'json_data': json.dumps({
'method': 'whatsapp_send_geolocation',
'phone': '77000000000',
'latitude': '53.284461',
'longitude': '69.378938',
'altitude': '5.5',
'accurate': '5.5',
'api_id': '<app id>'
})
}
response = requests.post('https://api.sendapi.net', data=data)
result = response.json()
print(result)
- Address:
- https://api.sendapi.net
- Method:
- GET, POST
- Parameters for json_data:
-
Parameter Required Description method whatsapp_send Send a Whatsapp message phone yes Recipient phone number text yes Message text in UTF-8 encoding api_id yes Your API key - Response to a successful request:
-
A successful request returns the ID of the sent message, which can later be used to get its status.
{ "result":0, "message_id":"1" } - Response to an unsuccessful request (More):
-
{ "result":1, "result_description":"Параметр method не передан." }
Example of sending a message via HTTP:
PHP example (with the curl module enabled):
$data['json_data'] = json_encode([
"method" => "whatsapp_message_list",
"message_id" => "0",
"limit" => "100",
"api_id" => "<app id>"
]);
$ch = curl_init("https://api.sendapi.net");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$body = curl_exec($ch);
curl_close($ch);
- Address:
- https://api.sendapi.net
- Method:
- GET, POST
- Parameters for json_data:
-
Parameter Required Description method whatsapp_message_list Get the Whatsapp message list message_id no Message ID. Default is 0. phone no Phone number limit no Number of records per request. Default is 50. api_id yes Your API key - Response to a successful request:
-
{ "result":0, "result_data":[{ "message_id":1, "message_route":"inbox", "message_type":"message-chat", "message_text":"123", "message_quoted":null, "phone":"7700****000", "file_url":null, "phone_id":426, "add_date":"2019-11-28 16:44:09", "transport_ph_numb":777****6224, "referral":null}] }referral— a transition from a Click-to-WhatsApp ad: ad ID, click ID and ad data;null— the message is not from an ad. Object fields — as in Webhook. - Response to an unsuccessful request (More):
-
{ "result":1, "result_description":"Параметр method не передан." }
Example of sending a message via HTTP:
PHP example (with the curl module enabled):
$data['json_data'] = json_encode([
"method" => "whatsapp_message_get",
"message_id" => "1",
"api_id" => "<app id>"
]);
$ch = curl_init("https://api.sendapi.net");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$body = curl_exec($ch);
curl_close($ch);
- Address:
- https://api.sendapi.net
- Method:
- GET, POST
- Parameters for json_data:
-
Parameter Required Description method whatsapp_message_get Get the message status message_id yes Message number api_id yes Your API key - Response to a successful request:
-
{ "result":0, "result_data":[data array] }An array element has the same fields as whatsapp_message_list, including
referral— a transition from a Click-to-WhatsApp ad (null— the message is not from an ad; object fields — as in Webhook). - Response to an unsuccessful request:
-
{ "result":1, "result_description":"Параметр method не передан." }
Example of sending a message via HTTP:
PHP example (with the curl module enabled):
$data['json_data'] = json_encode([
"method" => "whatsapp_phone_list",
"phone_id" => "0",
"limit" => "100",
"api_id" => "<app id>"
]);
$ch = curl_init("https://api.sendapi.net");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$body = curl_exec($ch);
curl_close($ch);
- Address:
- https://api.sendapi.net
- Method:
- GET, POST
- Parameters for json_data:
-
Parameter Required Description method whatsapp_phone_list Get the Whatsapp message list phone_id no Phone ID. Default is 0. limit no Number of records per request. Default is 50. api_id yes Your API key - Response to a successful request:
-
{ "result":0, "result_data":[data array] } - Response to an unsuccessful request (More):
-
{ "result":1, "result_description":"Параметр method не передан." }
Example of sending a message via HTTP:
PHP example (with the curl module enabled):
$data['json_data'] = json_encode([
"method" => "whatsapp_phone_add",
"phone" => "77000000000",
"name" => "Имя",
"contact_company" => "0",
"api_id" => "<app id>"
]);
$ch = curl_init("https://api.sendapi.net");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$body = curl_exec($ch);
curl_close($ch);
- Address:
- https://api.sendapi.net
- Method:
- GET, POST
- Parameters for json_data:
-
Parameter Required Description method whatsapp_phone_get Get the message status phone yes Subscriber Number name no Subscriber name contact_company no Whether to send the company contact to the user. 1 - send, 0 - do not send api_id yes Your API key - Response to a successful request:
-
{ "result":0, "result_data":[data array] } - Response to an unsuccessful request (More):
-
{ "result":1, "result_description":"Параметр method не передан." }
Example of sending a message via HTTP:
PHP example (with the curl module enabled):
$data['json_data'] = json_encode([
"method" => "whatsapp_phone_get",
"phone" => "77000000000",
"api_id" => "<app id>"
]);
$ch = curl_init("https://api.sendapi.net");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$body = curl_exec($ch);
curl_close($ch);
- Address:
- https://api.sendapi.net
- Method:
- GET, POST
- Parameters for json_data:
-
Parameter Required Description method whatsapp_phone_get Get the message status phone yes Subscriber Number api_id yes Your API key - Response to a successful request:
-
{ "result":0, "result_data":[data array] } - Response to an unsuccessful request (More):
-
{ "result":1, "result_description":"Параметр method не передан." }
Example of sending a message via HTTP:
PHP example (with the curl module enabled):
$data['json_data'] = json_encode([
"method" => "whatsapp_unsubscribe",
"phone" => "77000000000",
"api_id" => "<app id>"
]);
$ch = curl_init("https://api.sendapi.net");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$body = curl_exec($ch);
curl_close($ch);
- Address:
- https://api.sendapi.net
- Method:
- GET, POST
- Parameters for json_data:
-
Parameter Required Description method whatsapp_unsubscribe Unsubscribe a subscriber from broadcasts phone yes Subscriber Number api_id yes Your API key - Response to a successful request:
-
{ "result":0, "result_description":"Подписчик отписан." } - Response to an unsuccessful request (More):
-
{ "result":1, "result_description":"Параметр method не передан." }
Example of sending a message via HTTP:
PHP example (with the curl module enabled):
$data['json_data'] = json_encode([
"method" => "whatsapp_group_list",
"api_id" => "<app id>"
]);
$ch = curl_init("https://api.sendapi.net");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$body = curl_exec($ch);
curl_close($ch);
- Address:
- https://api.sendapi.net
- Method:
- GET, POST
- Parameters for json_data:
-
Parameter Required Description method whatsapp_group_list Get the list of whatsapp groups api_id yes Your API key - Response to a successful request:
-
{ "result":0, "groups": [ { "adminCheck":false, "admins":["77*********"], "subscribers":["77*********","77*********","77*********"], "group_id":"whatsapp_group_********-********", "name":"Тест группа" } ] } - Response to an unsuccessful request (More):
-
{ "result":1, "result_description":"Параметр method не передан." }
Example of sending a message via HTTP:
PHP example (with the curl module enabled):
$data['json_data'] = json_encode([
"method" => "whatsapp_group_get",
"group_id"=> "whatsapp_group_*******",
"api_id" => "<app id>"
]);
$ch = curl_init("https://api.sendapi.net");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$body = curl_exec($ch);
curl_close($ch);
- Address:
- https://api.sendapi.net
- Method:
- GET, POST
- Parameters for json_data:
-
Parameter Required Description method whatsapp_group_get Get a whatsapp group group_id yes group id api_id yes Your API key - Response to a successful request:
-
{ "result":0, "group":{ "adminCheck":false, "admins":["77*********"], "subscribers":["77*********","77*********","77*********"], "group_id":"whatsapp_group_********-********", "name":"Тест группа" } } - Response to an unsuccessful request (More):
-
{ "result":1, "result_description":"Параметр method не передан." }
PHP example (with the curl module enabled):
$data['json_data'] = json_encode([
"method" => "whatsapp_group_create",
"sp_numb" => "1",
"group_name" => "Тест группа",
"subscribers"=> ['7700*******'],
"api_id" => "<app id>"
]);
$ch = curl_init("https://api.sendapi.net");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$body = curl_exec($ch);
curl_close($ch);
- Address:
- https://api.sendapi.net
- Method:
- GET, POST
- Parameters for json_data:
-
Parameter Required Description method whatsapp_group_create Create a whatsapp group. This method creates a task to create the group. The group appears only after the task is completed. Task execution time depends on the channel load. sp_numb yes channel id, can be obtained via the whatsapp_sender_get method group_name yes Group name subscribers yes Array of subscribers api_id yes Your API key - Response to a successful request:
-
{ "result":0, "result_description":"Задача на создание группы подана успешно. Ожидайте появления группы в списке групп." } - Response to an unsuccessful request (More):
-
{ "result":1, "result_description":"Параметр method не передан." }
PHP example (with the curl module enabled):
$data['json_data'] = json_encode([
"method" => "whatsapp_group_contact_set",
"group_id" => "whatsapp_group_*******",
"subscribers"=> ['7700*******'],
"api_id" => "<app id>"
]);
$ch = curl_init("https://api.sendapi.net");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$body = curl_exec($ch);
curl_close($ch);
- Address:
- https://api.sendapi.net
- Method:
- GET, POST
- Parameters for json_data:
-
Parameter Required Description method whatsapp_group_contact_set This method creates a task to add subscribers to the group. Subscribers appear only after the task is completed. Task execution time depends on the channel load. group_id yes group id subscribers yes Array of subscribers api_id yes Your API key - Response to a successful request:
-
{ "result":0, "result_description":"Задача на добавление контактов в группу подана успешно." } - Response to an unsuccessful request (More):
-
{ "result":1, "result_description":"Параметр method не передан." }
PHP example (with the curl module enabled):
$data['json_data'] = json_encode([
"method" => "whatsapp_group_contact_del",
"group_id" => "whatsapp_group_*******",
"subscribers"=> ['7700*******'],
"api_id" => "<app id>"
]);
$ch = curl_init("https://api.sendapi.net");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$body = curl_exec($ch);
curl_close($ch);
- Address:
- https://api.sendapi.net
- Method:
- GET, POST
- Parameters for json_data:
-
Parameter Required Description method whatsapp_group_contact_del This method creates a task to remove subscribers from the group. Subscribers are removed only after the task is completed. Task execution time depends on the channel load. group_id yes group id subscribers yes Array of subscribers api_id yes Your API key - Response to a successful request:
-
{ "result":0, "result_description":"Задача на удаление контактов из группу подана успешно." } - Response to an unsuccessful request (More):
-
{ "result":1, "result_description":"Параметр method не передан." }
PHP example (with the curl module enabled):
$data['json_data'] = json_encode([
"method" => "whatsapp_group_contact_set_as_admin",
"group_id" => "whatsapp_group_*******",
"subscriber" => "7700*******",
"api_id" => "<app id>"
]);
$ch = curl_init("https://api.sendapi.net");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$body = curl_exec($ch);
curl_close($ch);
- Address:
- https://api.sendapi.net
- Method:
- GET, POST
- Parameters for json_data:
-
Parameter Required Description method whatsapp_group_contact_set_as_admin This method creates a task to grant admin rights to a subscriber in the group. Task execution time depends on the channel load. group_id yes group id subscriber yes Subscriber Number api_id yes Your API key - Response to a successful request:
-
{ "result":0, "result_description":"Задача на добавление прав админа подана успешно." } - Response to an unsuccessful request (More):
-
{ "result":1, "result_description":"Параметр method не передан." }
Example of sending a message via HTTP:
PHP example (with the curl module enabled):
$data['json_data'] = json_encode([
"method" => "contact_add",
"phone" => "77000000000",
"sp_numb" => "0",
"name" => "Имя",
"contact_company" => "0",
"api_id" => "<app id>"
]);
$ch = curl_init("https://api.sendapi.net");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$body = curl_exec($ch);
curl_close($ch);
- Address:
- https://api.sendapi.net
- Method:
- GET, POST
- Parameters for json_data:
-
Parameter Required Description method contact_add Add a subscriber with a specified channel phone yes Subscriber Number sp_numb yes Channel id, can be obtained via the whatsapp_sender_get method name no Subscriber name contact_company no Whether to send the company contact to the user. 1 - send, 0 - do not send api_id yes Your API key - Response to a successful request:
-
{ "result":0, "phone" : "whatsapp_biz_77000000000", // Returns the number in a format depending on the channel "sp_numb" : 0, "result_description" : "Подписчик добавлен." } - Response to an unsuccessful request (More):
-
{ "result":1, "result_description":"Параметр method не передан." }
Example of sending a message via HTTP:
PHP example (with the curl module enabled):
$data['json_data'] = json_encode([
"method" => "whatsapp_sender_get",
"api_id" => "<app id>"
]);
$ch = curl_init("https://api.sendapi.net");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$body = curl_exec($ch);
curl_close($ch);
- Address:
- https://api.sendapi.net
- Method:
- GET, POST
- Parameters for json_data:
-
Parameter Required Description method whatsapp_sender_get Get channel data api_id yes Your API key - Response to a successful request:
-
{ "result":0, "result_data":[] } - Response to an unsuccessful request (More):
-
{ "result":1, "result_description":"Параметр method не передан." }
Example of sending a message via HTTP:
PHP example (with the curl module enabled):
$data['json_data'] = json_encode([
"method" => "chat_work_list",
"api_id" => "<app id>"
]);
$ch = curl_init("https://api.sendapi.net");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$body = curl_exec($ch);
curl_close($ch);
- Address:
- https://api.sendapi.net
- Method:
- GET, POST
- Parameters for json_data:
-
Parameter Required Description method chat_work_list Get the list of contacts in work api_id yes Your API key - Response to a successful request:
-
{ "result":0, "result_data":[] } - Response to an unsuccessful request (More):
-
{ "result":1, "result_description":"Параметр method не передан." }
Example of sending a message via HTTP:
PHP example (with the curl module enabled):
$data['json_data'] = json_encode([
"method" => "chat_work_update",
"phone" => "77000000000",
"operator_id" => "10",
"action" => "chat_in_work"
"api_id" => "<app id>"
]);
$ch = curl_init("https://api.sendapi.net");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$body = curl_exec($ch);
curl_close($ch);
- Address:
- https://api.sendapi.net
- Method:
- GET, POST
- Parameters for json_data:
-
Parameter Required Description method chat_work_update Take or close a dialog phone yes Contact operator_id yes Operator ID action yes chat_in_work - Take into work, chat_out_of_work - close the dialog api_id yes Your API key - Response to a successful request:
-
{ "result":0, } - Response to an unsuccessful request (More):
-
{ "result":1, "result_description":"Параметр method не передан." }
Example of sending a message via HTTP:
PHP example (with the curl module enabled):
$data['json_data'] = json_encode([
"method" => "chat_operator_online",
"api_id" => "<app id>"
]);
$ch = curl_init("https://api.sendapi.net");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$body = curl_exec($ch);
curl_close($ch);
- Address:
- https://api.sendapi.net
- Method:
- GET, POST
- Parameters for json_data:
-
Parameter Required Description method chat_operator_online Get operators online api_id yes Your API key - Response to a successful request:
-
{ "result":0, "result_data":[] } - Response to an unsuccessful request (More):
-
{ "result":1, "result_description":"Параметр method не передан." }
Example of sending a message via HTTP:
PHP example (with the curl module enabled):
$data['json_data'] = json_encode([
"method" => "operation_mode",
"api_id" => "<app id>"
]);
$ch = curl_init("https://api.sendapi.net");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$body = curl_exec($ch);
curl_close($ch);
- Address:
- https://api.sendapi.net
- Method:
- GET, POST
- Parameters for json_data:
-
Parameter Required Description method operation_mode Get the operating mode api_id yes Your API key - Response to a successful request:
-
{ "result":0, "result_data":[] } - Response to an unsuccessful request (More):
-
{ "result":1, "result_description":"Параметр method не передан." }
PHP example (with the curl module enabled):
$data['json_data'] = json_encode([
"method" => "instagram_send_text",
"phone" => "instagram_0000000000",
"text" => "Сообщение",
"api_id" => "<app id>"
]);
$ch = curl_init("https://api.sendapi.net");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$body = curl_exec($ch);
curl_close($ch);
- Address:
- https://api.sendapi.net
- Method:
- GET, POST
- Parameters for json_data:
-
Parameter Required Description method instagram_send_text Send an instagram message phone yes Instagram contact. Format: instagram_0000000000. text yes Message text api_id yes Your API key - Response to a successful request:
-
{ "result":0, "message_id":"1" } - Response to an unsuccessful request (More):
-
{ "result":1, "result_description":"Параметр method не передан." }
1. Sending a file by link. PHP example (with the curl module enabled):
$data['json_data'] = json_encode([
"method" => "instagram_send_file",
"phone" => "instagram_0000000000",
"file_url"=> "https://api.sendapi.net/img/kp6.png",
"api_id" => "<app id>"
]);
$ch = curl_init("https://api.sendapi.net");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$body = curl_exec($ch);
curl_close($ch);
2. Sending as a file. PHP example (with the curl module enabled):
$file_path = 'absolute path /12019526947.jpg';
if (function_exists('curl_file_create')) { // php 5.5+
$cFile = curl_file_create($file_path);
} else {
$cFile = '@' . realpath($file_path);
}
$data['json_data'] = json_encode([
'method' => 'instagram_send_file',
'phone' => 'instagram_0000000000',
'api_id' => '<app id>'
]);
$data['file'] = $cFile;
$ch = curl_init("https://api.sendapi.net");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$body = curl_exec($ch);
curl_close($ch);
- Address:
- https://api.sendapi.net
- Method:
- GET, POST
- Parameters for json_data:
-
Parameter Required Description method instagram_send_file Send an instagram file phone yes Instagram contact. Format: instagram_0000000000. file_url yes File link, required if no file is attached to the request api_id yes Your API key - Response to a successful request:
-
{ "result":0, "message_id":"1" } - Response to an unsuccessful request (More):
-
{ "result":1, "result_description":"Параметр method не передан." }
PHP example (with the curl module enabled):
$data['json_data'] = json_encode([
"method" => "telegram_send_text",
"phone" => "telegram_0000000000",
"text" => "Сообщение",
"api_id" => "<app id>"
]);
$ch = curl_init("https://api.sendapi.net");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$body = curl_exec($ch);
curl_close($ch);
Sending the first message by @username
If the contact is not yet added to the channel, you can specify `tg_login` and `sp_numb` (channel identifier) instead of `phone`. The server will try to resolve `@username` via the Telegram gateway, automatically create/check the subscription in the specified `sp_numb`, and then send the message.
$data['json_data'] = json_encode([
"method" => "telegram_send_text",
"sp_numb" => 123,
"tg_login"=> "@username",
"text" => "Привет! Это первое сообщение.",
"api_id" => "<app id>"
]);
$ch = curl_init("https://api.sendapi.net");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$body = curl_exec($ch);
curl_close($ch);
Notes:
- Validation of `tg_login`: the login must match the pattern
^@[a-zA-Z][a-zA-Z0-9_]{4,31}$. - sp_numb is the channel identifier (phone_id / smap id). The specified channel must have a configured Telegram slot (tg_v2_slot_id).
- If the message is not sent and an error code is returned, check that `tg_login` is correct, that the Telegram gateway is available, and that `sp_numb` is present.
- Address:
- https://api.sendapi.net
- Method:
- GET, POST
- Parameters for json_data:
-
Parameter Required Description method telegram_send_text Send a telegram message phone yes Telegram contact. Format: telegram_0000000000. text yes Message text api_id yes Your API key - Response to a successful request:
-
{ "result":0, "message_id":"1" } - Response to an unsuccessful request (More):
-
{ "result":1, "result_description":"Параметр method не передан." }
1. Sending a file by link. PHP example (with the curl module enabled):
$data['json_data'] = json_encode([
"method" => "telegram_send_file",
"phone" => "telegram_0000000000",
"file_url"=> "https://api.sendapi.net/img/kp6.png",
"api_id" => "<app id>"
]);
$ch = curl_init("https://api.sendapi.net");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$body = curl_exec($ch);
curl_close($ch);
2. Sending as a file. PHP example (with the curl module enabled):
$file_path = 'absolute path /12019526947.jpg';
if (function_exists('curl_file_create')) { // php 5.5+
$cFile = curl_file_create($file_path);
} else {
$cFile = '@' . realpath($file_path);
}
$data['json_data'] = json_encode([
'method' => 'telegram_send_file',
'phone' => 'telegram_0000000000',
'api_id' => '<app id>'
]);
$data['file'] = $cFile;
$ch = curl_init("https://api.sendapi.net");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$body = curl_exec($ch);
curl_close($ch);
- Address:
- https://api.sendapi.net
- Method:
- GET, POST
- Parameters for json_data:
-
Parameter Required Description method telegram_send_file Send a telegram file phone yes Telegram contact. Format: telegram_0000000000. file_url yes File link, required if no file is attached to the request api_id yes Your API key - Response to a successful request:
-
{ "result":0, "message_id":"1" } - Response to an unsuccessful request (More):
-
{ "result":1, "result_description":"Параметр method не передан." }
PHP example (with the curl module enabled):
$data['json_data'] = json_encode([
"method" => "vk_send_text",
"phone" => "vk_0000000000",
"text" => "Сообщение",
"api_id" => "<app id>"
]);
$ch = curl_init("https://api.sendapi.net");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$body = curl_exec($ch);
curl_close($ch);
- Address:
- https://api.sendapi.net
- Method:
- GET, POST
- Parameters for json_data:
-
Parameter Required Description method vk_send_text Send vk message phone yes vk contact. Format: vk_0000000000. text yes Message text api_id yes Your API key - Response to a successful request:
-
{ "result":0, "message_id":"1" } - Response to an unsuccessful request (More):
-
{ "result":1, "result_description":"Параметр method не передан." }
1. Sending a file by link. PHP example (with the curl module enabled):
$data['json_data'] = json_encode([
"method" => "vk_send_file",
"phone" => "vk_0000000000",
"file_url"=> "https://api.sendapi.net/img/kp6.png",
"api_id" => "<app id>"
]);
$ch = curl_init("https://api.sendapi.net");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$body = curl_exec($ch);
curl_close($ch);
2. Sending as a file. PHP example (with the curl module enabled):
$file_path = 'absolute path /12019526947.jpg';
if (function_exists('curl_file_create')) { // php 5.5+
$cFile = curl_file_create($file_path);
} else {
$cFile = '@' . realpath($file_path);
}
$data['json_data'] = json_encode([
'method' => 'vk_send_file',
'phone' => 'vk_0000000000',
'api_id' => '<app id>'
]);
$data['file'] = $cFile;
$ch = curl_init("https://api.sendapi.net");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$body = curl_exec($ch);
curl_close($ch);
- Address:
- https://api.sendapi.net
- Method:
- GET, POST
- Parameters for json_data:
-
Parameter Required Description method vk_send_file Send vk file phone yes vk contact. Format: vk_0000000000. file_url yes File link, required if no file is attached to the request api_id yes Your API key - Response to a successful request:
-
{ "result":0, "message_id":"1" } - Response to an unsuccessful request (More):
-
{ "result":1, "result_description":"Параметр method не передан." }
PHP example (with the curl module enabled):
$data['json_data'] = json_encode([
"method" => "facebook_send_text",
"phone" => "facebook_0000000000",
"text" => "Сообщение",
"api_id" => "<app id>"
]);
$ch = curl_init("https://api.sendapi.net");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$body = curl_exec($ch);
curl_close($ch);
- Address:
- https://api.sendapi.net
- Method:
- GET, POST
- Parameters for json_data:
-
Parameter Required Description method facebook_send_text Send facebook message phone yes facebook contact. Format: facebook_0000000000. text yes Message text api_id yes Your API key - Response to a successful request:
-
{ "result":0, "message_id":"1" } - Response to an unsuccessful request (More):
-
{ "result":1, "result_description":"Параметр method не передан." }
1. Sending a file by link. PHP example (with the curl module enabled):
$data['json_data'] = json_encode([
"method" => "facebook_send_file",
"phone" => "facebook_0000000000",
"file_url"=> "https://api.sendapi.net/img/kp6.png",
"api_id" => "<app id>"
]);
$ch = curl_init("https://api.sendapi.net");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$body = curl_exec($ch);
curl_close($ch);
2. Sending as a file. PHP example (with the curl module enabled):
$file_path = 'absolute path /12019526947.jpg';
if (function_exists('curl_file_create')) { // php 5.5+
$cFile = curl_file_create($file_path);
} else {
$cFile = '@' . realpath($file_path);
}
$data['json_data'] = json_encode([
'method' => 'facebook_send_file',
'phone' => 'facebook_0000000000',
'api_id' => '<app id>'
]);
$data['file'] = $cFile;
$ch = curl_init("https://api.sendapi.net");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$body = curl_exec($ch);
curl_close($ch);
- Address:
- https://api.sendapi.net
- Method:
- GET, POST
- Parameters for json_data:
-
Parameter Required Description method facebook_send_file Send facebook file phone yes facebook contact. Format: facebook_0000000000. file_url yes File link, required if no file is attached to the request api_id yes Your API key - Response to a successful request:
-
{ "result":0, "message_id":"1" } - Response to an unsuccessful request (More):
-
{ "result":1, "result_description":"Параметр method не передан." }
PHP example (with the curl module enabled):
$data['json_data'] = json_encode([
"method" => "yandex_send_text",
"phone" => "yandex_0000000000",
"text" => "Сообщение",
"api_id" => "<app id>"
]);
$ch = curl_init("https://api.sendapi.net");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$body = curl_exec($ch);
curl_close($ch);
- Address:
- https://api.sendapi.net
- Method:
- GET, POST
- Parameters for json_data:
-
Parameter Required Description method yandex_send_text Send yandex message phone yes yandex contact. Format: yandex_0000000000. text yes Message text api_id yes Your API key - Response to a successful request:
-
{ "result":0, "message_id":"1" } - Response to an unsuccessful request (More):
-
{ "result":1, "result_description":"Параметр method не передан." }
1. Sending a file by link. PHP example (with the curl module enabled):
$data['json_data'] = json_encode([
"method" => "yandex_send_file",
"phone" => "yandex_0000000000",
"file_url"=> "https://api.sendapi.net/img/kp6.png",
"api_id" => "<app id>"
]);
$ch = curl_init("https://api.sendapi.net");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$body = curl_exec($ch);
curl_close($ch);
2. Sending as a file. PHP example (with the curl module enabled):
$file_path = 'absolute path /12019526947.jpg';
if (function_exists('curl_file_create')) { // php 5.5+
$cFile = curl_file_create($file_path);
} else {
$cFile = '@' . realpath($file_path);
}
$data['json_data'] = json_encode([
'method' => 'yandex_send_file',
'phone' => 'yandex_0000000000',
'api_id' => '<app id>'
]);
$data['file'] = $cFile;
$ch = curl_init("https://api.sendapi.net");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$body = curl_exec($ch);
curl_close($ch);
- Address:
- https://api.sendapi.net
- Method:
- GET, POST
- Parameters for json_data:
-
Parameter Required Description method yandex_send_file Send yandex file phone yes yandex contact. Format: yandex_0000000000. file_url yes File link, required if no file is attached to the request api_id yes Your API key - Response to a successful request:
-
{ "result":0, "message_id":"1" } - Response to an unsuccessful request (More):
-
{ "result":1, "result_description":"Параметр method не передан." }
PHP example (with the curl module enabled):
$data['json_data'] = json_encode([
"method" => "viber_bot_send_text",
"phone" => "viber_bot_0000000000",
"text" => "Сообщение",
"api_id" => "<app id>"
]);
$ch = curl_init("https://api.sendapi.net");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$body = curl_exec($ch);
curl_close($ch);
- Address:
- https://api.sendapi.net
- Method:
- GET, POST
- Parameters for json_data:
-
Parameter Required Description method viber_bot_send_text Send viber_bot message phone yes viber_bot contact. Format: viber_bot_0000000000. text yes Message text api_id yes Your API key - Response to a successful request:
-
{ "result":0, "message_id":"1" } - Response to an unsuccessful request (More):
-
{ "result":1, "result_description":"Параметр method не передан." }
1. Sending a file by link. PHP example (with the curl module enabled):
$data['json_data'] = json_encode([
"method" => "viber_bot_send_file",
"phone" => "viber_bot_0000000000",
"file_url"=> "https://api.sendapi.net/img/kp6.png",
"api_id" => "<app id>"
]);
$ch = curl_init("https://api.sendapi.net");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$body = curl_exec($ch);
curl_close($ch);
2. Sending as a file. PHP example (with the curl module enabled):
$file_path = 'absolute path /12019526947.jpg';
if (function_exists('curl_file_create')) { // php 5.5+
$cFile = curl_file_create($file_path);
} else {
$cFile = '@' . realpath($file_path);
}
$data['json_data'] = json_encode([
'method' => 'viber_bot_send_file',
'phone' => 'viber_bot_0000000000',
'api_id' => '<app id>'
]);
$data['file'] = $cFile;
$ch = curl_init("https://api.sendapi.net");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$body = curl_exec($ch);
curl_close($ch);
- Address:
- https://api.sendapi.net
- Method:
- GET, POST
- Parameters for json_data:
-
Parameter Required Description method viber_bot_send_file Send viber_bot file phone yes viber_bot contact. Format: viber_bot_0000000000. file_url yes File link, required if no file is attached to the request api_id yes Your API key - Response to a successful request:
-
{ "result":0, "message_id":"1" } - Response to an unsuccessful request (More):
-
{ "result":1, "result_description":"Параметр method не передан." }
PHP example (with the curl module enabled):
$data['json_data'] = json_encode([
"method" => "sendapi_send_text",
"phone" => "sendapi_0000000000",
"text" => "Сообщение",
"api_id" => "<app id>"
]);
$ch = curl_init("https://api.sendapi.net");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$body = curl_exec($ch);
curl_close($ch);
- Address:
- https://api.sendapi.net
- Method:
- GET, POST
- Parameters for json_data:
-
Parameter Required Description method sendapi_send_text Send sendapi message phone yes sendapi contact. Format: sendapi_0000000000. text yes Message text api_id yes Your API key - Response to a successful request:
-
{ "result":0, "message_id":"1" } - Response to an unsuccessful request (More):
-
{ "result":1, "result_description":"Параметр method не передан." }
1. Sending a file by link. PHP example (with the curl module enabled):
$data['json_data'] = json_encode([
"method" => "sendapi_send_file",
"phone" => "sendapi_0000000000",
"file_url"=> "https://api.sendapi.net/img/kp6.png",
"api_id" => "<app id>"
]);
$ch = curl_init("https://api.sendapi.net");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$body = curl_exec($ch);
curl_close($ch);
2. Sending as a file. PHP example (with the curl module enabled):
$file_path = 'absolute path /12019526947.jpg';
if (function_exists('curl_file_create')) { // php 5.5+
$cFile = curl_file_create($file_path);
} else {
$cFile = '@' . realpath($file_path);
}
$data['json_data'] = json_encode([
'method' => 'sendapi_send_file',
'phone' => 'sendapi_0000000000',
'api_id' => '<app id>'
]);
$data['file'] = $cFile;
$ch = curl_init("https://api.sendapi.net");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$body = curl_exec($ch);
curl_close($ch);
- Address:
- https://api.sendapi.net
- Method:
- GET, POST
- Parameters for json_data:
-
Parameter Required Description method sendapi_send_file Send sendapi file phone yes sendapi contact. Format: sendapi_0000000000. file_url yes File link, required if no file is attached to the request api_id yes Your API key - Response to a successful request:
-
{ "result":0, "message_id":"1" } - Response to an unsuccessful request (More):
-
{ "result":1, "result_description":"Параметр method не передан." }
A message can be sent within 24 hours after the last incoming message from the contact.
To find out whether 24 hours have passed and whether a message can still be sent, use the whatsapp_phone_get method, parameter inbox_time (time is shown in seconds).
PHP example (with the curl module enabled):
$data['json_data'] = json_encode([
"method" => "whatsapp_biz_send_text",
"phone" => "whatsapp_biz_0000000000",
"text" => "Сообщение",
"api_id" => "<app id>"
]);
$ch = curl_init("https://api.sendapi.net");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$body = curl_exec($ch);
curl_close($ch);
- Address:
- https://api.sendapi.net
- Method:
- GET, POST
- Parameters for json_data:
-
Parameter Required Description method whatsapp_biz_send_text Send WhatsApp Business message phone yes WhatsApp Business contact. Format: whatsapp_biz_0000000000. text yes Message text api_id yes Your API key - Response to a successful request:
-
{ "result":0, "message_id":"1" } - Response to an unsuccessful request (More):
-
{ "result":1, "result_description":"Параметр method не передан." }
1. Sending a file by link. PHP example (with the curl module enabled):
$data['json_data'] = json_encode([
"method" => "whatsapp_biz_send_file",
"phone" => "whatsapp_biz_0000000000",
"file_url"=> "https://api.sendapi.net/img/kp6.png",
"api_id" => "<app id>"
]);
$ch = curl_init("https://api.sendapi.net");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$body = curl_exec($ch);
curl_close($ch);
2. Sending as a file. PHP example (with the curl module enabled):
$file_path = 'absolute path /12019526947.jpg';
if (function_exists('curl_file_create')) { // php 5.5+
$cFile = curl_file_create($file_path);
} else {
$cFile = '@' . realpath($file_path);
}
$data['json_data'] = json_encode([
'method' => 'whatsapp_biz_send_file',
'phone' => 'whatsapp_biz_0000000000',
'api_id' => '<app id>'
]);
$data['file'] = $cFile;
$ch = curl_init("https://api.sendapi.net");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$body = curl_exec($ch);
curl_close($ch);
- Address:
- https://api.sendapi.net
- Method:
- GET, POST
- Parameters for json_data:
-
Parameter Required Description method whatsapp_biz_send_file Send WhatsApp Business file phone yes WhatsApp Business contact. Format: whatsapp_biz_0000000000. file_url yes File link, required if no file is attached to the request api_id yes Your API key - Response to a successful request:
-
{ "result":0, "message_id":"1" } - Response to an unsuccessful request (More):
-
{ "result":1, "result_description":"Параметр method не передан." }
PHP example (with the curl module enabled):
$data['json_data'] = json_encode([
"method" => "whatsapp_biz_template_list",
"api_id" => "<app id>"
]);
$ch = curl_init("https://api.sendapi.net");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$body = curl_exec($ch);
curl_close($ch);
- Address:
- https://api.sendapi.net
- Method:
- GET, POST
- Parameters for json_data:
-
Parameter Required Description method whatsapp_biz_template_list Get WhatsApp Business templates api_id yes Your API key - Response to a successful request:
-
{ "result":0, "result_data":[ {"sp_numb":0000,"phone_number":00000000000,"template_name":"template_1","template_message":"Сообщение","params_count":0} ] } - Response to an unsuccessful request (More):
-
{ "result":1, "result_description":"Параметр method не передан." }
$data['json_data'] = json_encode([
"method" => "whatsapp_biz_template_send",
"phone" => "whatsapp_biz_0000000000",
"template_name" => "template_1",
"template_params" => ["текст"],
"api_id" => "<app id>"
]);
$ch = curl_init("https://api.sendapi.net");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$body = curl_exec($ch);
curl_close($ch);
- Address:
- https://api.sendapi.net
- Method:
- GET, POST
- Parameters for json_data:
-
Parameter Required Description method whatsapp_biz_template_send Send WhatsApp Business template phone yes WhatsApp Business contact. Format: whatsapp_biz_0000000000. template_name yes Template Name template_params yes Additional template data api_id yes Your API key - Response to a successful request:
-
{ "result":0, "message_id":"1", "user_balance": 0 } - Response to an unsuccessful request (More):
-
{ "result":1, "result_description":"Параметр method не передан." }
Returns the list of all active channels (numbers) of the account with safe data for all available transports.
HTTP request example:
PHP example (with the curl module enabled):
$data['json_data'] = json_encode([
"method" => "channels_list",
"api_id" => "<app id>"
]);
$ch = curl_init("https://api.sendapi.net");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$body = curl_exec($ch);
curl_close($ch);
- Address:
- https://api.sendapi.net
- Method:
- GET, POST
- Parameters for json_data:
-
Parameter Required Description method channels_list Get channel list api_id yes Your API key - Fields in result_data:
-
Field Type Description sp_numb int Channel ID (used in the sp_numb parameter when sending) phone_number string Phone number / channel identifier transport string Transport type: whatsapp, telegram, instagram, vk, facebook, viber_bot, other active_status string Channel status (on - active) priority int|null Channel priority (lower = higher priority) - Response to a successful request:
-
{ "result": 0, "result_data": [ { "sp_numb": 123, "transport": "whatsapp", "active_status": "on", "priority": 1 }, { "sp_numb": 456, "phone_number": "79007654321", "transport": "telegram", "active_status": "on", "priority": 2 } ] } - Response to an unsuccessful request (More):
-
{ "result": 1, "result_description": "Параметр method не передан." }
Code examples:
$data['json_data'] = json_encode([
"method" => "user_balance",
"api_id" => "<app id>"
]);
$ch = curl_init("https://api.sendapi.net");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$body = curl_exec($ch);
curl_close($ch);
const data = {
json_data: JSON.stringify({
method: "user_balance",
api_id: "<app id>"
})
};
fetch("https://api.sendapi.net", {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
body: new URLSearchParams(data)
})
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.error("Error:", error));
import requests
import json
data = {
'json_data': json.dumps({
'method': 'user_balance',
'api_id': '<app id>'
})
}
response = requests.post('https://api.sendapi.net', data=data)
result = response.json()
print(result)
- Address:
- https://api.sendapi.net
- Method:
- GET, POST
- Parameters for json_data:
-
Parameter Required Description method user_balance User balance api_id yes Your API key - Response to a successful request:
-
{ "result":0, "user_balance": 0 } - Response to an unsuccessful request (More):
-
{ "result":1, "result_description":"Параметр method не передан." }
This method is also suitable for unblocking the API if it was blocked due to prolonged incorrect responses to requests to the webhook URL. The request must specify the status 'active'.
Example of sending a message via HTTP:
PHP example (with the curl module enabled):
$data['json_data'] = json_encode([
"method" => "webhook_status_update",
"status" => "off", // available statuses: 'active', 'off'
"api_id" => "<app id>"
]);
$ch = curl_init("https://api.sendapi.net");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$body = curl_exec($ch);
curl_close($ch);
- Address:
- https://api.sendapi.net
- Method:
- GET, POST
- Parameters for json_data:
-
Parameter Required Description method webhook_status_update Update webhook status status yes Available statuses: active, timeout, off. api_id yes Your API key - Response to a successful request:
-
{ "result":0 } - Response to an unsuccessful request (More):
-
{ "result":1, "result_description":"Параметр method не передан." }
When errors occur, the API returns a JSON response with the result field not equal to 0 and an error description in the result_description field.
Error response example:
{
"result": 1,
"result_description": "Параметр method не передан."
}
General error handling principles:
- Always check the
resultfield in the response - When
result != 0, handle the error according to the description inresult_description - Implement retries for temporary errors (codes 42, 6, 72)
- Check the correctness of the passed parameters before sending the request
Response options:
| Response | Description |
|---|---|
| 0 | Successful result |
| 1 | Error |
| 11 | Invalid method parameter. |
| 2 | The phone parameter is not provided. |
| 21 | Invalid phone parameter. |
| 22 | Subscriber not found. |
| 23 | Subscriber is unsubscribed or not processed. |
| 24 | Failed to update subscriber data. |
| 3 | The text parameter is not provided. |
| 31 | Invalid text parameter. |
| 32 | Message length exceeded. Maximum length is 2000 characters. Send large messages via POST. |
| 4 | The api_id parameter is not provided. |
| 41 | Invalid api_id parameter. |
| 42 | System error. Contact support. |
| 5 | The message_id parameter is not provided. |
| 51 | Invalid message_id parameter. |
| 52 | Failed to get the messages array. |
| 6 | Failed to create a message sending task. |
| 61 | Data not found. |
| 62 | You need to purchase or pay for a plan. |
| 71 | Senders not found. |
| 72 | Senders are overloaded. |
Webhook
The Webhook link can be configured on the API Settings page
All events are sent using the POST method with the Content-Type: application/json header to the URL you specified. If an authorization token is set in the settings, it is passed in the Authorization HTTP header. The event type is determined by the callback_status field. The fields transport, phone_id, user_id, add_date, reverse_date are present in all events.
Actions that trigger the Webhook: