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

REST API - Send SMS

Send a single SMS message to one or multiple recipients.

Endpoint

GET https://sms.deals/api/ws.php

Parameters

ParameterTypeRequiredDescription
serviceStringRequiredMust be send_sms
tokenStringOptionalAccount identification token (alternative to Bearer token)
destStringRequiredDestination phone number. For multiple recipients, use comma-separated values
messageStringRequiredText message to send. Add short URL: [[ex_url-https://yoursite.com[[
senderStringRequiredSender number or name (phone number, speed dial *XXXX, or Latin name up to 11 chars)
sendtimeStringOptionalSchedule time in format dd/mm/yyyy HH:MM
callback_urlStringOptionalURL to receive delivery status callbacks

Example Request

https://sms.deals/api/ws.php?service=send_sms&message=Hello%20World&dest=0501234567&sender=0501234567&token=YOUR_TOKEN

Code Examples

PHP

<?php
$msg = urlencode("Hello world sms");
$destination = "0521234567,0537654321"; // One or Multiple comma separated
$sender = "0531234567";
$token = "xxxxx...";

$url = "https://sms.deals/api/ws.php?service=send_sms";
$url .= "&message=".$msg."&dest=".$destination."&sender=".$sender;
$url .= "&token=".$token;

$options = array('http' => array(
'method' => 'GET',
'header' => 'Authorization: Bearer '.$token
));
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
echo $result;
?>

C# (.NET)

using System;
using System.IO;
using System.Net;
using System.Text;

namespace Examples.System.Net {
public class WebRequestGetExample {
public static void Main() {
string url_query_string = "https://sms.deals/api/ws.php?" +
"service=send_sms&" +
"message=Hello world sms&" +
"dest=0521234567,0537654321&" +
"sender=0531234567";

WebRequest request = WebRequest.Create(url_query_string);
string bearerToken = "xxxxxx...";
request.Headers["Authorization"] = "Bearer " + bearerToken;

WebResponse response = request.GetResponse();
Console.WriteLine(((HttpWebResponse)response).StatusDescription);

Stream dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
string responseFromServer = reader.ReadToEnd();
Console.WriteLine(responseFromServer);

reader.Close();
response.Close();
}
}
}

Response

<?xml version="1.0" encoding="UTF-8"?>
<SMS_Service>
<service>send_sms</service>
<Message>1231230</Message>
<Source>0541234567</Source>
<sms_recipients>
<sms_0>
<Message_id>183804870</Message_id>
<Destination>0521234567</Destination>
<Status>Message in Action</Status>
<Send_time>2014-05-24 15:10:38</Send_time>
</sms_0>
<sms_1>
<Message_id>183804880</Message_id>
<Destination>0537654321</Destination>
<Status>Message in Action</Status>
<Send_time>2014-05-24 15:10:38</Send_time>
</sms_1>
</sms_recipients>
<Total_sms>2</Total_sms>
<Total_Charge>2</Total_Charge>
</SMS_Service>

Response Variables

VariableTypeDescription
Message_idIntegerUnique identifier for the message
MessageStringMessage content
SourceStringSender number or name
DestinationStringDestination phone number
Send_timeTimeDate and time the request was logged
Total_smsIntegerNumber of SMS messages sent
Total_ChargeIntegerSMS credits charged

Callback Parameters

When using callback_url, you'll receive the following parameters:

VariableTypeDescription
fromStringSender number or name
toStringDestination phone number
statusStringDelivery status (see table below)
Message_idIntegerUnique message identifier

Delivery Status Codes

StatusDescription
SuccessMessage sent to destination operator successfully
Recipient "X" BlockedDestination blocked for incoming SMS
Destination MT blockDestination blocked for incoming SMS
System ErrorSystem error occurred
Missing Message bodyMessage is empty
Invalid DestinationInvalid destination number
ExpiredMessage validity period has expired
blacklistDestination is in blacklist

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

שליחת SMS בודד דרך ה‑API משפיעה:

  • קרדיט — כל הודעה מורידה נקודה אחת מחשבון ה‑SMS; הודעה ארוכה עשויה להתפצל לכמה חלקים ולהיספר בהתאם
  • דו״ח התראות — ההודעה נרשמת ב‑_notifications עם זמן שליחה, נמען ושולח; נראית מיד בדוח ההתראות
  • Callback URL — אם סופק callback_url, סטטוס המסירה (Success / Blocked / blacklist) נשלח חזרה בקשתית HTTP
  • sender IDs — שם השולח חייב להיות מאושר ב‑/senders; שימוש בשם לא מאושר יוחזר כשגיאה
  • רשימה שחורה — נמענים ברשימה השחורה יוחזרו עם סטטוס blacklist ולא יישלחו

ראו גם