דלג לתוכן הראשי

REST API - Send Bulk SMS

Send multiple SMS messages in one batch request.

Endpoint

POST https://sms.deals/api/ws_json_bulk.php

Request Format

Send a JSON array of SMS objects:

[
{
"service": "send_sms",
"dest": "0501234567",
"sender": "0541231231",
"sendtime": "01/01/2020 12:00",
"callback_url": "http://yoursite.com/page.php",
"message": "Hello world User example 1"
},
{
"service": "send_sms",
"dest": "0521231232",
"sender": "0541231232",
"message": "Hello world User example 2"
}
]

Code Examples

cURL

curl --location --request POST "https://sms.deals/api/ws_json_bulk.php" \
--header "Content-Type: application/json" \
--header "Authorization: Bearer xxxxxx..." \
--data '[
{
"service": "send_sms",
"dest": "0521231231",
"sender": "0521231221",
"message": "Hello world User example 1"
},
{
"service": "send_sms",
"dest": "0541231221",
"sender": "0541231231",
"message": "Hello world User example 2"
}
]'

PHP

<?php
$curl = curl_init();
$token = "xxxxxx...";

$json = array(
array(
'service' => 'send_sms',
'dest' => '0521231231',
'sender' => '0541231231',
'message' => 'Hello world User example 1'
),
array(
'service' => 'send_sms',
'dest' => '0521231232',
'sender' => '0541231232',
'message' => 'Hello world User example 2'
)
);

curl_setopt_array($curl, array(
CURLOPT_URL => "https://sms.deals/api/ws_json_bulk.php",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => false,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode($json),
CURLOPT_HTTPHEADER => array(
"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;
}
?>

Response

[
{
"service": "send_sms",
"status": "Message in Action",
"message_id": 212131221,
"message": "test",
"sender": "0521231231",
"dest": "0521231232",
"sendtime": "2022-09-05 18:48:37",
"total_charge": 1
},
{
"service": "send_sms",
"status": "Error - 403 Forbidden",
"description": "Mandatory fields missing: token",
"message": "test",
"dest": "0531231231",
"sender": "0531231241"
}
]

Response Fields

FieldTypeDescription
serviceStringService name (send_sms)
statusStringMessage status or error
message_idIntegerUnique message identifier (on success)
messageStringMessage content
senderStringSender number or name
destStringDestination phone number
sendtimeStringScheduled or actual send time
total_chargeIntegerSMS credits charged
descriptionStringError description (on failure)

השפעות על המערכת

שליחה מרוכזת היא פעולה אינטנסיבית עם השפעות רוחב:

  • קרדיט — כל נמען ב‑batch נספר בנפרד; יש לבדוק יתרה דרך /credit לפני הפעלה כדי למנוע כשל אמצע שליחה
  • סטטוס פר‑הודעה — התשובה היא מערך תואם לבקשה; כל פריט מכיל status עצמאי (הצלחה/שגיאה) כך שאפשר לשלוח חבילה מעורבת ולטפל פר‑נמען
  • דו״ח התראות — כל הודעה בחבילה נרשמת כרשומת _notifications נפרדת; דו״ח ההתראות מציג את כולן
  • תזמון — ניתן לצרף sendtime לכל הודעה בנפרד; ההודעה תישלח רק בזמן שצוין
  • Callback URL — כל הודעה יכולה לקבל callback נפרד להחזרת סטטוס מסירה

ראו גם