Single SMS API

Send SMS using a template

SMS is a simple and cost-effective way to communicate with customers. Before starting to send the SMS APIs, make sure that you have configured the SMS channel in Kalyra.io. This section details how to send your first outbound SMS using an API request.

To send marketing messages use "type" value as "MKT".
To send transactional messages use "type" value as "TXN".
To send otp messages use "type" value as "OTP".

post/v2/{sid}/messages

Request

  • Base URL
    api.in.kaleyra.io (relative, and the document’s source URL is not known)
  • URL
    api.in.kaleyra.io/v2/{sid}/messages
  • Auth
    none declared. Required headers: api-key, Content-Type

Path parameters

sidstring required

Headers

api-keystring required

API Key generated by kaleyra.io. Example - Ac4XXXXX21f

Content-Typestring required

The format in which the data is sent.

Request body application/x-www-form-urlencoded

tostring required

It contains a phone number, Numbers Separated by “,“ comma OR It can have a list of numbers in an Array. For example - 9188XXXXXXXX.

senderstring required

Sender ID used for sending SMS. The sender must be in the form of a tag when used in template-based sending. For example - "KLRHXA"

bodystring

[Conditional] Body of the SMS. It is required if template_id is not provided.

template_idstring

[Conditional] Template ID for pre-registered templates. Required if the body is not provided. template_id must be 12 to 30 digits and exist as a tag.

typestring

Type of the SMS (for example, transactional). type must exist as a tag if using template-based sending.

callback_profile_idstring

URL for callbacks. Callback must exist as a tag if using template-based sending.

template_datastring

Data to replace template placeholders. template_data must be a key-value pair JSON structure with each value under 30 characters.

campaign_namestring

Name of the campaign. Must match regex pattern ^[\w-]*$.

refstring

Custom reference fields for the message, up to 150 characters each.

ref1string

Custom reference fields for the message, up to 150 characters each.

ref2string

Custom reference fields for the message, up to 150 characters each.

Example request

{
  "to": "{{to}}",
  "sender": "{{sender_id}}",
  "body": "{{body}}",
  "template_id": "{{template_id}}",
  "type": "MKT",
  "callback_profile_id": "{{callback_profile_id}}",
  "template_data": "{\"OTP\": 12345}",
  "campaign_name": "Campaign",
  "ref": "Reference Data",
  "ref1": "Reference Data 2",
  "ref2": "Reference Data 3"
}

Response

Successful response

Changes

No recorded changes to this operation across all 2 revisions of this API.