国际短信
国际短信

Send SMS

Send SMS to specified number(s), contact(s), group(s).
The method requires at least one of the parameters: to, contacts, groups.

Request Body schema: application/json
to
required
Array of strings

One or multiple telephone numbers.

contacts
required
Array of items

One or multiple contacts from Phonebook.

groups
required
Array of items

One or multiple groups from Phonebook.

text
required
string

Your text message.

date
string <YYYY-MM-DDThh:mm:ssZ>

Date when to send the SMS. If this parameter is not null SMS will be scheduled for sending at the given date and time.

priority
integer [ 0 .. 9 ]

SMS with higher priority will be queued earlier.

encoding
string
Default: "default"
Enum: "unicode" "standard"
  • 'standard' = no Unicode encoding
  • 'unicode' = SMS will be encoded using Unicode (you can send national characters).
flash
boolean
Default: false
Enum: false true
  • false = Normal SMS (default)
  • true = SMS will be sent as flash message.
oid
string

This attribute specifies a user-defined unique ID that is assigned to a message-recipient pair.
The oid is a varchar(36) that uniquely identifies a message sent to a particular recipient (particular phone number).
The value of this ID allows client applications to match incoming reply messages to outgoing messages. If no oid was assigned to the outgoing message this attribute will have a value of null for incoming message. The oid value will be automatically assigned to incoming message only if incoming phone number matches exactly the phone number (including country code) from outgoing message.

validity
string
Default: "max"
Enum: "5m" "10m" "30m" "1h" "2h" "4h" "12h" "1d" "2d" "5d" "1w" "2w" "4w" "max"

How long will be the message valid. If message expires before it is received by a phone, the message will be discarded by cellular network.

send_after
string <hh:mm>

Send a message after a specified time. It can be used to prevent messages from being sent at night.

send_before
string <hh:mm>

Send a message before a specified time. It can be used to prevent messages from being sent at night.

test
boolean
Default: false
Enum: false true

true = Simulate message sending. Messages with that parameter will not be added to outbox and they will return ID = 0.

modem_no
integer [ 1 .. 8 ]

Sending modem number (only for multimodem devices).

Responses

200

Message status

Response Schema: application/json
status
string
message
string
number
string
id
integer
400

Bad request

Request samples


#include 
#include 
#include 
int main(void) {
  CURL *curl;
  CURLcode res;
  using namespace std;
  curl = curl_easy_init();
  if(curl) {
    char const *path = "https://smseagleip/index.php/api/v2/messages/sms";
    curl_easy_setopt(curl, CURLOPT_URL, path);
    string jsonPayload = R"({
        "to": ["+4812345678"],
        "contacts": [12,15],
        "groups": [57,35],
        "text": "my message",
        "date": "2022-12-27T12:20:31+05:01",
        "priority": 5,
        "encoding": "unicode",
        "flash": true,
        "oid": "123abc456def789ghi123abc456def789ghi",
        "validity": "30m",
        "send_after": "12:05",
        "send_before": "17:15",
        "test": true,
        "modem_no": 2
    })";
    struct curl_slist* headers = NULL;
    headers = curl_slist_append(headers, "Content-Type: application/json");
    headers = curl_slist_append(headers, "access-token: 0005gOjCOlMH8F2BP8");
    curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
    curl_easy_setopt(curl, CURLOPT_POSTFIELDS, jsonPayload.c_str());
    res = curl_easy_perform(curl);
    if(res != CURLE_OK)
      fprintf(stderr, "curl_easy_perform() failed: %s\n",
              curl_easy_strerror(res));
    curl_easy_cleanup(curl);
  }
  return 0;
}
					
                   

Response samples


{
  "status": "queued",
  "message": "OK",
  "number": "123456789",
  "id": 1821
}