Изпращане на SMS
curl --request POST \
--url https://call.aiployees.com/api/user/sms \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"from": 123,
"to": "<string>",
"body": "<string>"
}
'import requests
url = "https://call.aiployees.com/api/user/sms"
payload = {
"from": 123,
"to": "<string>",
"body": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({from: 123, to: '<string>', body: JSON.stringify('<string>')})
};
fetch('https://call.aiployees.com/api/user/sms', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://call.aiployees.com/api/user/sms",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'from' => 123,
'to' => '<string>',
'body' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://call.aiployees.com/api/user/sms"
payload := strings.NewReader("{\n \"from\": 123,\n \"to\": \"<string>\",\n \"body\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://call.aiployees.com/api/user/sms")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"from\": 123,\n \"to\": \"<string>\",\n \"body\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://call.aiployees.com/api/user/sms")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"from\": 123,\n \"to\": \"<string>\",\n \"body\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"message": "SMS sent successfully",
"data": {
"id": 456,
"phone_number_id": 78,
"to": "+1234567890",
"body": "Hello! This is a test message from Your Company. How can we help you today?",
"user_id": 1,
"segments": 1,
"segment_price": 0.0075,
"total_cost": 0.0075,
"status": "sent",
"sms_sid": "SM1234567890abcdef1234567890abcdef",
"created_at": "2025-08-04 15:30:00",
"updated_at": "2025-08-04 15:30:02"
}
}
{
"message": "From number not found"
}
{
"message": "Invalid to phone number"
}
{
"message": "Insufficient balance"
}
{
"message": "From number is not SMS capable"
}
{
"message": "Failed to send SMS",
"error": "Twilio API error details"
}
SMS
Изпращане на SMS
Изпратете SMS съобщение, използвайки вашия телефонен номер
POST
/
user
/
sms
Изпращане на SMS
curl --request POST \
--url https://call.aiployees.com/api/user/sms \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"from": 123,
"to": "<string>",
"body": "<string>"
}
'import requests
url = "https://call.aiployees.com/api/user/sms"
payload = {
"from": 123,
"to": "<string>",
"body": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({from: 123, to: '<string>', body: JSON.stringify('<string>')})
};
fetch('https://call.aiployees.com/api/user/sms', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://call.aiployees.com/api/user/sms",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'from' => 123,
'to' => '<string>',
'body' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://call.aiployees.com/api/user/sms"
payload := strings.NewReader("{\n \"from\": 123,\n \"to\": \"<string>\",\n \"body\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://call.aiployees.com/api/user/sms")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"from\": 123,\n \"to\": \"<string>\",\n \"body\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://call.aiployees.com/api/user/sms")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"from\": 123,\n \"to\": \"<string>\",\n \"body\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"message": "SMS sent successfully",
"data": {
"id": 456,
"phone_number_id": 78,
"to": "+1234567890",
"body": "Hello! This is a test message from Your Company. How can we help you today?",
"user_id": 1,
"segments": 1,
"segment_price": 0.0075,
"total_cost": 0.0075,
"status": "sent",
"sms_sid": "SM1234567890abcdef1234567890abcdef",
"created_at": "2025-08-04 15:30:00",
"updated_at": "2025-08-04 15:30:02"
}
}
{
"message": "From number not found"
}
{
"message": "Invalid to phone number"
}
{
"message": "Insufficient balance"
}
{
"message": "From number is not SMS capable"
}
{
"message": "Failed to send SMS",
"error": "Twilio API error details"
}
Този endpoint ви позволява да изпращате SMS съобщения, използвайки закупените от вас телефонни номера. SMS-ът ще бъде изпратен чрез Twilio и разходите ще бъдат автоматично приспаднати от баланса на вашия акаунт.
Request Body
integer
required
ID-то на вашия телефонен номер, от който да изпратите SMS-а (трябва да поддържа SMS)
string
required
Телефонният номер на получателя в международен формат (например “+1234567890”)
string
required
Съдържанието на SMS съобщението (макс. 300 знака)
Response
string
Съобщение за успех, потвърждаващо че SMS-ът е изпратен
object
Show properties
Show properties
integer
Уникалният идентификатор на SMS записа
integer
ID-то на телефонния номер, използван за изпращане на SMS-а
string
Телефонният номер на получателя в E.164 формат
string
Съдържанието на SMS съобщението
integer
ID-то на потребителя, който е изпратил SMS-а
integer
Брой SMS сегменти (за целите на таксуването)
number
Цена за SMS сегмент
number
Обща цена на SMS-а (segment_price * segments)
string
Текущото състояние на SMS-а
string
Twilio SMS SID за проследяване
string
Датата и часът, когато е създаден SMS-ът
string
Датата и часът, когато SMS-ът е актуализиран за последно
Грешни Отговори
Show Error Response
Show Error Response
string
Съобщение за грешка, описващо проблема (невалиден телефонен номер, недостатъчен баланс и т.н.)
{
"message": "SMS sent successfully",
"data": {
"id": 456,
"phone_number_id": 78,
"to": "+1234567890",
"body": "Hello! This is a test message from Your Company. How can we help you today?",
"user_id": 1,
"segments": 1,
"segment_price": 0.0075,
"total_cost": 0.0075,
"status": "sent",
"sms_sid": "SM1234567890abcdef1234567890abcdef",
"created_at": "2025-08-04 15:30:00",
"updated_at": "2025-08-04 15:30:02"
}
}
{
"message": "From number not found"
}
{
"message": "Invalid to phone number"
}
{
"message": "Insufficient balance"
}
{
"message": "From number is not SMS capable"
}
{
"message": "Failed to send SMS",
"error": "Twilio API error details"
}
Забележки
- Телефонният номер на подателя трябва да принадлежи на удостоверения потребител
- Телефонният номер на подателя трябва да поддържа SMS
- Абонаментът за телефонния номер трябва да бъде активен (не изтекъл)
- Необходим е достатъчен баланс по акаунта за покриване на разходите за SMS
- Телефонните номера се форматират автоматично в E.164 формат
- Разходите за SMS варират според държавата на получателя и се таксуват за сегмент
- Дълги съобщения могат да бъдат разделени на няколко сегмента, увеличавайки цената
- Телефонният номер на получателя трябва да бъде валиден според международните стандарти
⌘I

