Send a Plain Text Message
POST Method
The Send a Plain Text Message API request enables you to send a simple, plain-text message to one or more recipients. It is ideal for sending basic notifications, alerts, or transactional messages without any formatting or media.
Prerequisites
- After you sign up, your account will be on the trial version. You must complete the KYC to access all the features in kaleyra.io.
- Before you get started, Create an API Key. To view the API Key and the SID, see View API Key and SID.
- Before sending the RCS, you must configure the RCS channel in the Kaleyra platform. To configure the RCS channel in your account, please contact your local Kaleyra representative.
- You must have an approved AgentID or a specific number to be used as AgentID.
Base URL
https://rcs-api.<pod>.kaleyra.ai
- For North America (NA).
https://rcs-api.<pod>.kaleyra.io
- For rest of the world.
API Domain and Value
api_domain | Value |
---|---|
IN pod | https://rcs-api.in.kaleyra.io |
NA pod | https://rcs-api.na.kaleyra.ai |
API request to send a Plain Text Message
To send a plain text message, use the https://rcs-api.<pod>.kaleyra.ai/v1/<sid>/rcs/messages
endpoint with the following request method:
The following is the request format to send plain text message:
curl --location --request POST 'https://<api_domain>/v1/<sid>/rcs/messages\
--header 'Content-Type:<Content-Type>' \
--header 'api-key: <api-key>' \
--data {
"from":"<from> ",
"to":<to>,
"text": <text>
}
The following is the sample request format to send plain text message:
curl --location --request POST 'https://rcs-api.na.kaleyra.ai/v1/xxxxx6913850xxxx/rcs/messages'
--header 'Content-Type: application/json' \
--header 'api-key: xxxxx3b8497f58a94e84b671aca43xxxx' \
--data {
"from":"rcs-test",
"to":["9191588XXXXX"],
"text": "Hello"
}'
URL Parameters and Headers
The following is the list of parameters and headers to send the outgoing message request:
Parameter/Headers | Data Type | Description | Example | Mandatory? |
---|---|---|---|---|
sid | String | Account SID (Security Identifier). | xxxxx6913850xxxx | Yes |
Content-Type | String | Indicates the format of the content the API will be processing. | The only allowed value is application/JSON | Yes |
api-key | String | API key generated from kaleyra.io account. | xxxxx3b8497f58a94e84b671aca43xxxx | Yes |
Following is the list of attributes to be used in the payload to send the messages:
Parameter | Data Type | Description | Example | Mandatory? |
---|---|---|---|---|
from | String | The service code unique to the RCS agent, specified when the RCS agent is created or onboarded. You can contact the RCS Provisioning Team for more details on unique service code. | rcs-test | Yes |
to | Array of String | List of recipients’ device addresses (up to 100 allowed), a phone number in E.164 format prefixed with the country code without a plus sign used to contact the user. | [9191588XXXXX] | Yes |
text | String | Text message content, encoded in UTF-8 (2000 Unicode characters max.) | Hello | Yes |
Sample Success Response
The following success message appears:
{
"recipientDetails": [
{
"to": "9191588XXXXX",
"messageId": "dc4cxxxx-xxxx-xxxx-xxxx-xxxx349a5e3d "
}
]
}
Sample Failure Response
The following failure message appears:
{
"status": "ERROR",
"errorText": "Error Message"
}
Updated about 8 hours ago