RCS Get Template
GET Method
The Get Template API request fetches a template's details by specifying the 'template ID'.
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.
- To send any RCS messages, you must configure the RCS channel in the Kaleyra platform. To configure the RCS channel in your account, please contact your local Kaleyra representative.
API Domain and Value
| api_domain | Value |
|---|---|
| IN pod | https://rcs-api.in.kaleyra.io |
| NA pod | https://rcs-api.na.kaleyra.io |
API Request to get Template Details by Template Number
To get the template details by template number, use the https://rcs-api.<pod>.kaleyra.io/v1/<sid>/rcs/template/{template_id} endpoint with the following request method:
The following is the request format to get the RCS template details using template ID:
curl --location GET 'https://<api_domain>/v1/<sid>/rcs/template/{template_id}'\
--header 'Content-Type: <content_type>' \
--header 'api-key: <api-key>'The following is the sample request format to get the RCS template details using template ID:
curl --location GET 'https://rcs-api.in.kaleyra.io/v1/XXXXX6913850XXXX/rcs/template/19XXXX91-2XXa-4XX9-aXX9-b4XXXXXXXXd6'\
--header 'api-key: XXXXX3b8497f58a94e84b671aca43XXXX' \
--header 'Content-Type: application/json'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 |
template_id | String | ID of the template for which details will be retrieved. | 19XXXX91-2XXa-4XX9-aXX9-b4XXXXXXXXd6 | Yes |
Sample Success Response
The following is a sample success response:
{
"code": "RCS1102",
"message": "RCS Template details fetched successfully",
"data": {
"template_id": "19XXXX91-2XXa-4XX9-aXX9-b4XXXXXXXXd6",
"regions": [],
"created_date": 1774458419976,
"agent_number": "116XX2",
"template_type": "4",
"template_name": "doc_test_demo",
"rich_card_standalone": {
"card_orientation": "VERTICAL",
"thumbnail_image_alignment": "LEFT",
"content": {
"title": "Card Title",
"description": "Card description text",
"media": {
"height": "MEDIUM",
"file": {
"file_url": "https://example.com/image.jpg",
"thumbnail_url": "https://example.com/thumb.jpg",
"content_description": "Electric Bill"
}
},
"suggestions": []
}
},
"status": "CREATED",
"template_number": "MNXXXXXXXXN8"
},
"error": {}
}The following is the list of parameters shown in the success response:
| Parameter | Data Type | Description | Example |
|---|---|---|---|
code | String | Status code for the response. | RCS1102 |
message | String | Message for the response. | RCS Template details fetched successfully |
data | Object | The payload data for response for get template details. | See the specific table for details. |
The following table describes the different parameters used for the data JSON object:
Parameter | Data Type | Description | Example |
|---|---|---|---|
| String | Autogenerated template identification number. | 19XXXX91-2XXa-4XX9-aXX9-b4XXXXXXXXd6 |
| String | Region for which the template has been created. | IN |
| String | Date when the template was created. | 1774458419976 |
| String | The ID generated by google at the time of create agent request. | 116XX2 |
| String | Type of template. The allowed values are 1, 3, 4, or 5. For more information on Template type, see the Template Type table. | 4 |
| String | Unique template name. A maximum of 20 characters including alphanumeric and underscore is supported. Space is not allowed. | doc_test_demo |
| Object | Based on the template type, enter the details for template. | See the specific table for details. |
| String | Display the status of the template. You can view the following statuses:
| CREATED |
| String | Unique identification number for the template. | MNXXXXXXXXN8 |
The following table describes the different parameters used for the rich_card_standalone JSON object:
| Parameter | Data Type | Description | Example |
|---|---|---|---|
card_orientation | String | The card orientation in template message. It can be either VERTICAL or HORIZONTAL. | VERTICAL |
thumbnail_image_alignment | String | The card alignment in the template. It can be either LEFT or RIGHT. | LEFT |
content | Object | The content below the card in the template. | See the specific table for details. |
The following table describes the different parameters used for the content JSON object:
| Parameter | Data Type | Description | Example |
|---|---|---|---|
title | String | Title of the card. | Card Title |
description | String | Description of the card relevant to the title. | Card description text |
media | Object | Media attached to the card. | See the specific table for details. |
suggestions | String | Suggestion chip list. |
The following table describes the different parameters used for the media JSON object:
| Parameter | Data Type | Description | Example |
|---|---|---|---|
height | String | The height of media file in the template. It can be Short, Medium, or Tall. | MEDIUM |
file | Object | File that is attached to the template. | See the specific table for details. |
The following table describes the different parameters used for the file JSON object:
| Parameter | Data Type | Description | Example |
|---|---|---|---|
file_url | String | The URL of the file to be sent. | https://example.com/image.jpg |
thumbnail_url | String | URL of the thumbnail for the file. | https://example.com/thumb.jpg |
content_description | String | Description for URL file. | Electric Bill |
Sample Failure Response
The following are sample failure responses:
{
"code": "RCS601",
"message": "RCS Channel is not enabled for this User.",
"data": [],
"error": {
"error_code": "RCS_CHANNEL_DISABLED",
"error_message": "RCS channel not enabled"
}
}The following is the list of sample failure responses:
| HTTP Status Code | Message | Error Code | Error Message |
|---|---|---|---|
| 400 | RCS601 | RCS_CHANNEL_DISABLED | RCS Channel is not enabled for this User. |
| 4xx | RCS1104 | PROV_ERROR | Server error in body. |
| 500 | RCS502 | RCS_CHANNEL_INTERNAL_ERROR | Internal Gateway Error. |
Updated about 3 hours ago
