curl -X POST "https://call.aiployees.com/api/user/whatsapp/send-freeform" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"sender_id": 12,
"recipient_phone": "+1234567890",
"message": "Thank you for your inquiry! Our team will review your request and get back to you within 2 hours."
}'
const response = await fetch(
'https://call.aiployees.com/api/user/whatsapp/send-freeform',
{
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
sender_id: 12,
recipient_phone: '+1234567890',
message: 'Thank you for your inquiry! Our team will review your request and get back to you within 2 hours.'
})
}
);
const data = await response.json();
console.log(data);
import requests
response = requests.post(
'https://call.aiployees.com/api/user/whatsapp/send-freeform',
headers={
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
json={
'sender_id': 12,
'recipient_phone': '+1234567890',
'message': 'Thank you for your inquiry! Our team will review your request and get back to you within 2 hours.'
}
)
print(response.json())
{
"success": true,
"conversation_id": 1234,
"message_id": 567,
"whatsapp_message_id": 890,
"message_sid": "SMxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"session_status": {
"is_open": true,
"can_send_freeform": true,
"requires_template": false,
"message": "Session open (23 hr 45 min remaining). Unlimited free-form messages allowed.",
"minutes_remaining": 1425,
"expires_at": "2026-02-25T10:30:00+00:00"
}
}
{
"success": false,
"error": "Insufficient balance. Please top up your account.",
"error_code": "INSUFFICIENT_BALANCE"
}
{
"success": false,
"error": "The 24-hour messaging window is closed. Customer must reply first, or use a template message.",
"error_code": "SESSION_EXPIRED",
"session_status": {
"is_open": false,
"can_send_freeform": false,
"requires_template": true,
"message": "Session expired. Send a template or wait for customer to reply.",
"expired_at": "2026-02-23T10:30:00+00:00"
}
}
{
"success": false,
"error": "Sender not found or does not belong to you",
"error_code": "SENDER_NOT_FOUND"
}
{
"success": false,
"error": "Invalid phone number format. Use E.164 format (e.g., +14155551234).",
"error_code": "INVALID_PHONE"
}
{
"success": false,
"error": "Sender is not online. Current status: Offline",
"error_code": "SENDER_OFFLINE"
}
WhatsApp
Изпращане на свободна форма съобщение
Изпращане на WhatsApp съобщение със свободен текст в рамките на активна 24-часова сесия
POST
/
user
/
whatsapp
/
send-freeform
curl -X POST "https://call.aiployees.com/api/user/whatsapp/send-freeform" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"sender_id": 12,
"recipient_phone": "+1234567890",
"message": "Thank you for your inquiry! Our team will review your request and get back to you within 2 hours."
}'
const response = await fetch(
'https://call.aiployees.com/api/user/whatsapp/send-freeform',
{
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
sender_id: 12,
recipient_phone: '+1234567890',
message: 'Thank you for your inquiry! Our team will review your request and get back to you within 2 hours.'
})
}
);
const data = await response.json();
console.log(data);
import requests
response = requests.post(
'https://call.aiployees.com/api/user/whatsapp/send-freeform',
headers={
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
json={
'sender_id': 12,
'recipient_phone': '+1234567890',
'message': 'Thank you for your inquiry! Our team will review your request and get back to you within 2 hours.'
}
)
print(response.json())
{
"success": true,
"conversation_id": 1234,
"message_id": 567,
"whatsapp_message_id": 890,
"message_sid": "SMxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"session_status": {
"is_open": true,
"can_send_freeform": true,
"requires_template": false,
"message": "Session open (23 hr 45 min remaining). Unlimited free-form messages allowed.",
"minutes_remaining": 1425,
"expires_at": "2026-02-25T10:30:00+00:00"
}
}
{
"success": false,
"error": "Insufficient balance. Please top up your account.",
"error_code": "INSUFFICIENT_BALANCE"
}
{
"success": false,
"error": "The 24-hour messaging window is closed. Customer must reply first, or use a template message.",
"error_code": "SESSION_EXPIRED",
"session_status": {
"is_open": false,
"can_send_freeform": false,
"requires_template": true,
"message": "Session expired. Send a template or wait for customer to reply.",
"expired_at": "2026-02-23T10:30:00+00:00"
}
}
{
"success": false,
"error": "Sender not found or does not belong to you",
"error_code": "SENDER_NOT_FOUND"
}
{
"success": false,
"error": "Invalid phone number format. Use E.164 format (e.g., +14155551234).",
"error_code": "INVALID_PHONE"
}
{
"success": false,
"error": "Sender is not online. Current status: Offline",
"error_code": "SENDER_OFFLINE"
}
Този endpoint изпраща WhatsApp съобщение със свободна форма (свободен текст) до получател. За разлика от template съобщенията, съобщенията със свободна форма могат да съдържат всякакъв текст, но изискват активен 24-часов прозорец за съобщения — което означава, че получателят трябва да е изпратил съобщение на вашия WhatsApp изпращач в рамките на последните 24 часа.
Съобщения със свободна форма могат да се изпращат само по време на активен 24-часов прозорец за съобщения. Ако сесията е изтекла, първо трябва да изпратите template съобщение, за да започнете отново разговора. Използвайте Session Status endpoint, за да проверите дали сесията е активна.
Този endpoint е ограничен до 5 заявки в секунда на потребител.
Request Body
integer
required
ID на WhatsApp изпращача, от който да се изпрати (получен от Get Senders endpoint)
string
required
Телефонният номер на получателя в международен формат (например,
+1234567890)string
required
Съдържанието на съобщението за изпращане (максимум 4096 символа)
Response Fields
boolean
Дали съобщението е изпратено успешно
integer
ID на разговора, свързан с това съобщение
integer
ID на записа на съобщението в разговора
integer
ID на записа на WhatsApp съобщението
string
Twilio message SID за проследяване на доставката
object
Обновен статус на сесията след изпращане на съобщението
Show Свойства на статуса на сесията
Show Свойства на статуса на сесията
boolean
Дали 24-часовият прозорец за съобщения е в момента отворен
boolean
Дали съобщения със свободна форма могат да се изпращат точно сега
boolean
Дали е необходимо template съобщение
string
Четимо описание на състоянието на сесията
integer
Оставащи минути в 24-часовия прозорец
string
ISO 8601 timestamp кога сесията изтича
Error Responses
curl -X POST "https://call.aiployees.com/api/user/whatsapp/send-freeform" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"sender_id": 12,
"recipient_phone": "+1234567890",
"message": "Thank you for your inquiry! Our team will review your request and get back to you within 2 hours."
}'
const response = await fetch(
'https://call.aiployees.com/api/user/whatsapp/send-freeform',
{
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
sender_id: 12,
recipient_phone: '+1234567890',
message: 'Thank you for your inquiry! Our team will review your request and get back to you within 2 hours.'
})
}
);
const data = await response.json();
console.log(data);
import requests
response = requests.post(
'https://call.aiployees.com/api/user/whatsapp/send-freeform',
headers={
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
json={
'sender_id': 12,
'recipient_phone': '+1234567890',
'message': 'Thank you for your inquiry! Our team will review your request and get back to you within 2 hours.'
}
)
print(response.json())
{
"success": true,
"conversation_id": 1234,
"message_id": 567,
"whatsapp_message_id": 890,
"message_sid": "SMxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"session_status": {
"is_open": true,
"can_send_freeform": true,
"requires_template": false,
"message": "Session open (23 hr 45 min remaining). Unlimited free-form messages allowed.",
"minutes_remaining": 1425,
"expires_at": "2026-02-25T10:30:00+00:00"
}
}
{
"success": false,
"error": "Insufficient balance. Please top up your account.",
"error_code": "INSUFFICIENT_BALANCE"
}
{
"success": false,
"error": "The 24-hour messaging window is closed. Customer must reply first, or use a template message.",
"error_code": "SESSION_EXPIRED",
"session_status": {
"is_open": false,
"can_send_freeform": false,
"requires_template": true,
"message": "Session expired. Send a template or wait for customer to reply.",
"expired_at": "2026-02-23T10:30:00+00:00"
}
}
{
"success": false,
"error": "Sender not found or does not belong to you",
"error_code": "SENDER_NOT_FOUND"
}
{
"success": false,
"error": "Invalid phone number format. Use E.164 format (e.g., +14155551234).",
"error_code": "INVALID_PHONE"
}
{
"success": false,
"error": "Sender is not online. Current status: Offline",
"error_code": "SENDER_OFFLINE"
}
24-часов прозорец за съобщения
WhatsApp прилага политика за 24-часов прозорец за съобщения:- Когато клиент изпрати съобщение на вашия WhatsApp Business номер, се отваря 24-часов прозорец.
- По време на този прозорец можете да изпращате съобщения със свободна форма без ограничения.
- След като прозорецът изтече, трябва да използвате template съобщение, за да започнете отново разговора.
- Всяко ново съобщение от клиента нулира 24-часовия таймер.
Забележки
- Максималната дължина на съобщението е 4,096 символа (ограничение на WhatsApp).
- Изпращачът трябва да е
online. Офлайн изпращачи връщат503грешка. - Разходите за съобщения се приспадат автоматично от баланса ви.
- Ограничение за заявки: 5 заявки в секунда на потребител.

