1. Home
  2. Docs
  3. REST API
  4. API Guides
  5. Transactional SMS request example

Transactional SMS request example

Send an immediate SMS to your contacts
with or without parameters,
with or without attachments.

The sending can be done synchronously – this is the default mode.
Or asynchronously – in this case you will only get the “queued” response and sending will be done later with a background service.

POST /transactional/SMS/send

 

Example 1 – Simple send, sync mode

{
"message": {
    "content": "BODY of the message",
    "charset": "unicode",
    "to": [
      {
        "mobile_number": "972-54-1111111"
      }
    ]
  }
}

Example 2 – Send, with async mode

{
 message: {
    content: "Hi",
    charset: "unicode",
    unsubscribe_text: "Click to unsubscribe: ",

    add_unsubscribe_link: true,
    add_unsubscribe_sms_reply: true,
    to: [
      {
        "mobile_number": "972-54-1111111"
      }
    ]
  }
,
	"async": true,
	"send_at": "2020-01-20 13:05:00+02:00"
}

Example 3 – Send to kosher number

{
message: {
    content: "Hi. ",
    charset: "unicode",
    unsubscribe_text: "remove: ",

    add_unsubscribe_link: true,
    add_unsubscribe_sms_reply: true,
    to: [
      {
        "mobile_number": "972-58-32XXXXX"
      }
    ]
  }
,
	"async": true,
}

Example 4 – More attributes

{
"message": {
    "content": "Hi #field1#,
your package was just sent.
track link: www.google.com
etc.
",
    "to": [
      {
        "mobile_number": "972-54-111111"
      }
    ],
    "track_clicks": true,
    "field_vars": [{
          "rcpt": "972-54-XXXXXXX",
           "fields": [{
                 "name": "field1",
                 "content": "Hi",
                 "type": "string"
              }]
       }],
   
    "tags": ["PackageMessage1"]  
  }
,
"async": true,
"send_at": "2020-01-20 13:05:00+02:00"
}

Response code

If everything goes well, you should get a success response code 200 –  response url as the model schema

Response code 401 – response url = “you are not authorized to use rest API”

when send Async mode:

  • queued“. final status and reject reason should be then retrieved from GET methods.
  • sent” (when ended with success)
  • invalid” (when error in the phone number) + “reject_reason”: “invalid-number”
  • rejected” (when refused sending for unsubscribe reason) + “reject_reason”: “unsubscribe”
  • rejected” (then number is marked as kosher – refused incoming message) + reject_reason”: “kosher-number”
  • queued + "reject_reason": “insufficient-funds” (when no credit to send)

* There are more reject reasons as: exception, invalid_mobile_number, bounced, unsubscribed, no_credit, cancelled_by_user, kosher_number

How can we help?