Sending RCS
Send RCS messages through the Messaging API using a registered RCS Business Messaging (RBM) agent. For developers configuring a branded conversational entity for RCS delivery.
Send RCS messages through the Messaging API using your RCS Business Messaging (RBM) agent.
RCS (Rich Communication Services) is a communications standard that adds app-like features to text messaging. To send RCS messages, register as an RBM partner and create an agent for each brand you manage.
An agent is the branded conversational entity that sends messages to and receives responses from users. Its name, logo, description, contact information, and URLs appear in the RCS-enabled messaging app on the user's device.
Before you begin
-
Open the Business Communications Developer Console and sign in with your RBM Platform Google account.
-
Create an RBM agent:
- Click Create Agent.
- Enter your agent's name and region, then click Create agent.
- When your agent is available, select its name.
-
Create a service account key to authenticate API calls as your agent:
- In the left navigation, click Service account.
- Click Create key, then click Create.
- Store the downloaded key securely. You cannot recover the key if you lose it.
-
Copy your Agent ID. Include it in each request you send.
The Messaging API supports two RCS message types:
- Text messages
- Standalone Rich Cards with suggestions
NOTEThe total number of API Calls (requests) that the user can make to this endpoint in a certain time has been limited. That is, in case the user exceeds the limit of requests (messages sent) that can be made in a specific time, they will not be able to send another request until the established time is up. Once the time has elapsed, the request counter is reset and the request can be sent to the endpoint again.
In this example, the user can send 2 requests in 300 seconds (5 minutes). When a third request is sent within the 5 minute range, the
HTTP Status Code "429"will be generated and the following parameter will be displayed from the Response body:"errors": { "reason": "Too Many Requests" }. This code tells you that the user has sent too many requests in a given amount of time. Once the required time has elapsed, the request counter is reset to 2, so the user will be able to send two requests again in 5 minutes.To find out if the user exceeds the limit of required requests and the time they needs to wait to send the next request, we recommend consulting the Response Header (additional information about the body of the resource). The parameters presented in the response header are the following:
ratelimit-limit: 2\ratelimit-policy: 2;w= 300\ratelimit-remaining: 1\ratelimit-reset: 5m0s
- RateLimit-Limit: return the number of requests left for the client in the time window
- RateLimit-Remaining: return the remaining quota in the current window
- RateLimit-Reset: return the time remaining in the current window, specified in seconds
- RateLimit-Policy: return the quota policy. The quota policy expression can be found in paragraph 2.1 of the IETF draft. The format is, for example, for 2 requests in 300 seconds.
Send a text RCS message
Use a text message for notifications, alerts, and conversational messages that do not need visual or interactive content.
Send a text RCS message with the following request body.
HTTP request: POST / notification
{
"channel": "RCS",
"request": {
"to": "+580000000005",
"message": "text demo",
"messageType": "TEXT",
"agentId": "604af472d06abe3a6f5c852e"
}
}The following table describes the text RCS message request body:
| Parameter | Required | Description |
|---|---|---|
| channel | Yes | Specifies the type of delivery channel which the notification message will be sent: In this case, we enter the |
| request | Yes | Message content. |
| request. to |
Yes | Determines the destination phone number for your RCS message. Numbers are specified in E.164 format → (‘+’ and a country code). |
| request. message |
Yes | The content of the RCS message that will be sent to the end user. |
| request. messageType |
Yes | Describing the type of message which is going to be sent over RCS.
In this case, we enter the |
| request. agentId |
Yes | Agent's unique identifier. Set by RCS Business Messaging. |
| request. externalId |
No | Alphanumeric identifier used for reporting purposes. |
| request. clientId |
No | Unique user identifier that can be used for reporting purposes. This is an identifier you can use to uniquely identify the destination address in your systems. This is similar to the externalId and will be sent back to you if you are requesting callbacks that contain status changes of the messages you send. |
| callbacks | No | Indicate one or more webhook URLs to notify about the status of the message delivery. That is, if you want to receive the status of the message you've sent to your contacts, you need to specify your endpoint. Your endpoint must have a HTTP POST access method and receive a JSON body. The URL is the external callback where the events of the RCS message will be registered and published. Once a message is processed, its status will be posted to your callback URL. To view the full list and meaning of each status, please refer to the RCS Status section. |
The following table describes the response metadata for a text RCS message:
| Parameter | Description |
|---|---|
| meta | "meta" segment is dedicated to metadata regarding the call itself. |
| meta. timestamp |
Call’s time mark. Sequence of characters identifying when the message has been sent. |
| meta. transactionId |
Call’s transaction ID, this will help our teams to locate issues faster if arose. |
| meta. explain |
Useful message regarding the operation or the call. |
The Messaging API publishes the message to the RCS API queue. The response therefore includes the meta segment.
Send a standalone rich card
A Standalone Rich Card combines media and text with suggested replies or suggested actions.
A Standalone Rich Card can include:
- An image or video
- Title text
- Description text
- Up to four suggested replies or suggested actions
Send a Standalone Rich Card RCS message with the following request body.
HTTP request: POST / notification
{
"channel": "RCS",
"request": {
"messageType": "STANDALONECARD",
"title": "sample title",
"cardImageUrl": "https://example.url.site/logo.png",
"mediaHeight": "SHORT",
"cardOrientation": "HORIZONTAL",
"alignment": "RIGHT",
"to": "+580000000005",
"agentId": "604af472d06abe3a6f5c852e",
"suggestions": [
{
"type": "REPLY",
"text": "Yes"
},
{
"type": "REPLY",
"text": "No"
}
]
}
}The following table describes the Standalone Rich Card request body:
| Parameter | Required | Description |
|---|---|---|
| channel | Yes | Specifies the type of delivery channel which the notification message will be sent: In this case, we enter the |
| request | Yes | Message content. |
| request. to |
Yes | Determines the destination phone number for your RCS message. Numbers are specified in E.164 format → (‘+’ and a country code). |
| request. messageType |
Yes | Describing the type of message which is going to be sent over RCS.
In this case, we enter the |
| request. agentId |
Yes | Agent's unique identifier. Set by RCS Business Messaging. |
| request. title |
Yes | Title of the card. |
| request. mediaHeight |
Yes | Height of the card media. Values: The height of the media applies to a rich card with a vertical layout. For a standalone card with horizontal layout, height is not customizable, and this field is ignored. |
| request. cardOrientation |
Yes | Orientation type defines orientation in Card message. Values: |
| request. alignment |
Yes | Alignment type defines alignment in Card message. Values: Image preview alignment for standalone cards with horizontal layout. |
| request. cardImageUrl |
Yes | URL of the given resource. Type the URL of the image that is included in the card. |
| request. suggestions |
Yes | List of suggestions comprised of suggested replies and suggested actions. |
| request. suggestions. text |
Yes | Text that will be shown in the suggested reply. |
| request. suggestions. type |
Yes | Users can tap a suggested reply to send the text reply back to the agent. Value: |
| request. externalId |
No | Alphanumeric identifier used for reporting purposes. |
| request. clientId |
No | Unique user identifier that can be used for reporting purposes. This is an identifier you can use to uniquely identify the destination address in your systems. This is similar to the externalId and will be sent back to you if you are requesting callbacks that contain status changes of the messages you send. |
| callbacks | No | Indicate one or more webhook URLs to notify about the status of the message delivery. That is, if you want to receive the status of the message you've sent to your contacts, you need to specify your endpoint. Your endpoint must have a HTTP POST access method and receive a JSON body. The URL is the external callback where the events of the RCS message will be registered and published. Once a message is processed, its status will be posted to your callback URL. To view the full list and meaning of each status, please refer to the RCS Status section. |
The following table describes the response metadata for a Standalone Rich Card message:
| Parameter | Description |
|---|---|
| meta | "meta" segment is dedicated to metadata regarding the call itself. |
| meta. timestamp |
Call’s time mark. Sequence of characters identifying when the message has been sent. |
| meta. transactionId |
Call’s transaction ID, this will help our teams to locate issues faster if arose. |
| meta. explain |
Useful message regarding the operation or the call. |
The Messaging API publishes the message to the RCS API queue. The response therefore includes the meta segment.
Updated 4 days ago
