Przejdź do treści
SENDLY by ACTIOSENDLY by ACTIO
Specification

SENDLY SMS API

Specification v1.2

The SENDLY SMS API works by transmitting messages over the HTTP protocol. Two mutually exclusive modes are available for handling SMS messages: SMS API and 3CX API

1. SMS API

1.1 Sending a message

This is the default API mode, intended for use with applications that support REST API. The following endpoint is available for sending SMS:

POST https://api.sendly.link/api/sms

Authorization: Bearer token
Expected content type: application/json

Request body fields:

FieldData typeDescription
fromNumeric string, minimum 9 characters, maximum 11 characters (optional field)The virtual mobile number in SENDLY
toNumeric string, minimum 9 characters, maximum 11 charactersDestination mobile number
bodyString, minimum 1 characterMessage content

Example request:

curl -X POST https://api.sendly.link/api/sms \
     -H "Authorization: Bearer TWOJ_TOKEN" \
     -H "Content-Type: application/json" \
     -d '{
           "from": "48732129000",
           "to": "48732129001",
           "body": "Test SENDLY"
         }'

The token can be generated and downloaded from the client panel. Alternatively, the token can be obtained through customer support.

Possible responses:

200 – the message has been accepted for sending

Response body:

FieldData typeDescription
message_idStringUnique message identifier (16 hex characters)

Example response:

{"message_id":"a906cff7719bd889"}

Possible error responses:

403 – authorization problem
422 – data validation problem
429 – Rate limit exceeded

In case of errors, the response body may contain one or more of the fields described in the table below:

FieldData typeDescription
errors.tokenArray of stringsDescription of the error related to the provided access token
errors.fromArray of stringsDescription of the error related to the source number
errors.toArray of stringsDescription of the error related to the destination number
errors.bodyArray of stringsDescription of the error related to the message body

Example response:

{"errors":{"token":["Invalid token"]}}

Outgoing messages are encoded in UCS-2 and split every 60 characters. Optionally, it is possible to send SMS in GSM7 encoding with a limit of a single message with a maximum length of 160 characters. This option can be enabled in the client panel or by submitting a request to customer support.

1.2 Sending a message to multiple numbers

This is an API method that allows sending the same message to multiple numbers. Enabling this feature for an access token happens exclusively through contact with customer support. The following endpoint is available:

POST https://api.sendly.link/api/sms-multi

Authorization: Bearer token
Expected content type: application/json

Request body fields:

FieldData typeDescription
fromNumeric string, minimum 9 characters, maximum 11 characters (optional field)The virtual mobile number in SENDLY
toArray of numeric strings, minimum 9 characters, maximum 11 characters, minimum 1 element, maximum 100 elementsDestination mobile numbers
bodyString, minimum 1 characterMessage content

Example request:

curl -X POST https://api.sendly.link/api/sms-multi \
     -H "Authorization: Bearer TWOJ_TOKEN" \
     -H "Content-Type: application/json" \
     -d '{
           "from": "48732129000",
           "to": ["48732129001", "48732129002"],
           "body": "Test SENDLY"
         }'

Validation of the submitted phone numbers follows an “all or nothing” principle – each of the submitted numbers must be a valid Polish mobile number or the entire request will be rejected. The submitted numbers must be unique; submitting duplicate numbers will cause the entire request to be rejected.

Possible responses:

200 – the message has been accepted for sending

Response body:

FieldData typeDescription
message_idsArray of objectsEach returned object contains a “number” field pointing to one of the given destination numbers and “message_id”, which is the identifier of the message accepted for sending

Example response:

{"message_ids":[{"number":"48732129001","message_id":"a906cff7719bd889"}]}

Possible error responses:

403 – authorization problem
422 – data validation problem
429 – Rate limit exceeded

In case of errors, the response body may contain one or more of the fields described in the table below:

FieldData typeDescription
errors.tokenArray of stringsDescription of the error related to the provided access token
errors.fromArray of stringsDescription of the error related to the source number
errors.toArray of stringsDescription of the error related to the destination number
errors.bodyArray of stringsDescription of the error related to the message body

Example response:

{"errors":{"token":["Invalid token"]}}

1.3 Receiving messages

Incoming messages are sent to the webhook specified in the client panel. The webhook can also be provided in a request to customer support. A single delivery attempt will be made. The API request does not follow redirects and does not authenticate to the webhook. The request will originate from the current IP address of the api.sendly.link domain.

Method: POST
Content type: application/json

Request body fields:

FieldData typeDescription
typeStringMessage type. For an incoming message it takes the value “MESSAGE”
fromStringPresentation of the source number. For a message with an overridden number, this field contains the sender ID (nadpis).
toNumeric stringDestination phone number
bodyStringMessage content

Example request body:

{"type":"MESSAGE","from":"48732129000","to":"48732129001","body":"Test sms"}

1.4 Delivery confirmation

If you wish to receive delivery notifications, you must enable this option in the client panel or via a request to customer support. Enabling this option will cause a request to be sent to the specified webhook address. A single notification delivery attempt will be made. The API request does not follow redirects and does not authenticate to the webhook. The request will originate from the current IP address of the api.sendly.link domain.

Method: POST
Content type: application/json

Request body fields:

FieldData typeDescription
typeStringMessage type. For a status message it takes the value “NOTIFICATION”
message_idStringThe message identifier returned after acceptance for sending
statusStringDELIVERED for a delivery notification. ERROR for an error notification.

Example request body:

{"type":"NOTIFICATION","message_id":"a906cff7719bd889","status":"DELIVERED"}

2. 3CX SMS API

This version of the API supports sending and receiving messages based on the current specification of the 3CX Phone System. To enable this API, select both options in the client panel: SMS API and 3CX SMS API.

To handle outgoing traffic, you must provide, in the SMS section in 3CX, the token that can be generated in the client panel, and the URL:

https://api.sendly.link/api/tcx

To handle incoming messages, provide in the client panel the webhook available in your 3CX system.

Customer support can also perform the activation; in that case you provide the webhook and a token is sent back in response.