ViRBM RCS APIs Ver 9 8th Feb 2024
ViRBM RCS APIs Ver 9 8th Feb 2024
8.0 Added section on allowed media and file Dipanjan Das Dec-19-2023
types
1.1. Overview
Vi RBM platform provides GSMA Chatbot MaaP APIs as per GSMA MaaP Chatbot API
specifications and Google style RBM APIs as per Google API specifications, to extend any bot’s
services to multiple MaaP platforms with ease. Register a bot on the RCS-APIs Platform and
send messages to a phone on any supported network via the RCS-APIs Platform.
If you are already familiar with Google RBM APIs, then you can refer to section 3, Google Style
RBM APIs.
In addition to RCS APIs, Vi API platform provides APIs for brands to send OTP, transactional
and promotional RBM messages to a target base belonging to multiple MaaP platforms.
These will be sent in pre-defined templates that you (as a brand) need to configure after
you sign up in to the Vi RBM Developer Portal.
All Vi APIs are REST-style HTTP APIs and, receive and return JSON data. A JSON request is sent to
an HTTP API endpoint.
Method: One of the HTTP Methods like POST, GET, DELETE, and PUT.
In response to an HTTP API call, the response returned will have an HTTP Status Code such as
200, 202, 404, 500, etc. and a JSON Response.
The Chatbot needs to register it’s webhook with the RCS APIs platform. The webhook should be
secured with HTTPS. User messages, responses, and status notifications will be posted on the
webhook.
2
Server Root: https://api.virbm.in/rcs
Step 1
To use the Vi RCS APIs, the brand needs to submit the agent details (the form with these
details will be shared manually to you) to Vi. Along with the agent details, this also includes
the webhook endpoint of the brand for receiving message events and notifications from the
Vi RCS API platform.
Step 2
Once the agent is created and verified at the backend, the agent needs to be registered with
the Vi RCS APIs.
This will generate the necessary client ID and secret in the Vi SSO authentication server.
Step 3
The client Id and secret and the botId will be shared with the brand over email.
The webhook URL to call back the brand will also be registered along with other details.
https://auth.virbm.in/auth/oauth/token?grant_type=client_credentials
3
To get the token, the client Id and client_secret should be sent in the Authorization header as
Basic authentication (base64 encoded).
The above endpoint is rate limited in terms of the number of requests allowed per minute.
By default the number of transactions per minute (TPM) will be 60 per client (A client will
typically be mapped to a single bot created)
In case you wish to have a higher value, please get in touch with [email protected]
4
2. GSMA Style RBM APIs
2.1. Communicate with user
Resource endpoint: {serverRoot}/bot/v1/{botId}/messages/async
This is the API used to send messages and isTyping indications to users.
Request format:
URL: {serverRoot}/bot/v1/OsOsQ0GwNvUdLTV9Bd/messages/async
Authorization: Access Token obtained from Auth2 SSO service as Bearer token
Request:
{
"RCSMessage":{
"textMessage":"hello world"
},
"messageContact":{
"userContact":"+914253136789"
}
}
Request Parameters:
Response Format:
{
"RCSMessage": {
"msgId": "6cd095cd-62f6-4338-bba2-4b14b98b0537",
"status": "pending"
5
}
}
Response Parameters:
Code Description
In addition to the RCS messages, any template added and approved on the Vi RBM portal can
be sent on this endpoint. Please note that only template messages from the brand will be
allowed outside of a conversation. Please refer to RCS Template section for more details.
6
event and validation errors (invalid client, invalid template, rate limit etc...) as API
response, any other errors (charging failure, number not found, etc...) will be sent as a
failure event on the agent’s callback URL.
Authorization: Access Token obtained from Auth2 SSO service as Bearer token
Request Parameters:
2.1.1.1. Example
Request:
{
"RCSMessage": {
"templateMessage": {
"templateCode":"template_123",
"customParams":"{\"name\":\"Vi\"}"
}
},
"messageContact": {
"userContact": "+14251234567"
}
}
7
"RCSMessage": {
"fileMessage": {
"fileUrl" : "https://storage.googleapis.com/kitchen-sink-sample-images/cute-
dog.jpg"
}
},
"messageContact": {
"userContact": "+14251234567"
}
}
8
"displayText":"Open website or deep link",
"postback":{
"data":"set_by_chatbot_open_url"
}
}
},
{
"action":{
"calendarAction":{
"createCalendarEvent":{
"startTime":"2017-03-14T00:00:00Z",
"endTime":"2017-03-14T23:59:59Z",
"title":"Meeting",
"description":"GSG review meeting"
}
},
"displayText":"Schedule Meeting",
"postback":{
"data":"set_by_chatbot_create_calendar_event"
}
}
},
{
"action":{
"mapAction":{
"showLocation":{
"location":{
"latitude":37.4220041,
"longitude":-122.0862515,
"label":"Googleplex"
},
"fallbackUrl":"https://www.google.com/maps/@37.4219162,-122.078063,15z"
}
},
"displayText":"Show location on a map",
"postback":{
"data":"set_by_chatbot_open_map"
}
}
},
{
"action":{
"mapAction":{
"requestLocationPush":{}
},
"displayText":"Share location on a map",
"postback":{
9
"data":"set_by_chatbot_open_map"
}
}
}
]
}
},
"messageContact": {
"userContact": "+14251234567"
}
}
10
"content": {
"media": {
"mediaUrl": "https://storage.googleapis.com/kitchen-sink-sample-
images/cute-dog.jpg",
"mediaContentType": "image/jpg",
"mediaFileSize": 2718288,
"thumbnailUrl": "https://storage.googleapis.com/kitchen-sink-sample-
images/cute-dog.jpg ",
"thumbnailContentType": "image/jpg",
"thumbnailFileSize": 314159,
"height": "MEDIUM_HEIGHT",
"contentDescription": "Textual description of media content, e. g.
for use with screen readers."
},
"title": "This is a single rich card.",
"description": "This is the description of the rich card. It's the
first field that will be truncated if it exceeds the maximum width or height of a
card."
}
}
}
},
"suggestedChipList": {
"suggestions": [
{
"reply": {
"displayText": "Yes",
"postback": {
"data": "set_by_chatbot_reply_yes"
}
}
},
{
"reply": {
"displayText": "No",
"postback": {
"data": "set_by_chatbot_reply_no"
}
}
},
{
"action": {
"urlAction": {
"openUrl": {
"url": "https://virbm.in/"
}
},
"displayText": "Open website or deep link",
11
"postback": {
"data": "set_by_chatbot_open_url"
}
}
}
]
}
},
"messageContact": {
"userContact": "+14251234567"
}
}
Response:202 Accepted
{
"RCSMessage": {
"msgId": "63c30986-3222-4369-a8e8-16c09b36f34f",
"status": "pending"
}
}
Response:403 Forbidden
{
"RCSMessage": {
"msgId": "937796c9-46d3-432f-b958-5d9215874f8f",
"status": "failed",
"timestamp": "2023-02-01T04:43:48.361Z"
},
"reason": {
"text": "Invalid client id!",
"code": 403
}
}
12
invalid_template 409 user is not in a conversation and
provided message template is not
approved or
Template code with bot doesn't exist.
opted_out 410 opted_out
13
2.1.2.1. Example:
POST {serverRoot}/bot/v1/OsOsQ0GwNvUdLTV9Bd/messages/async
Authorization: Access Token obtained from Auth2 SSO service as Bearer token.
Request Parameters:
Request:
{
"RCSMessage":{
"isTyping":"active"
},
"messageContact":{
"userContact":"+914253136789"
}
}
Response:202 Accepted
{
"RCSMessage": {
"msgId": "e125527c-1af3-4158-8db9-9cc4f16d4733",
"status": "pending"
}
}
Request format:
URL:{serverRoot}/bot/v1/OsOsQ0GwNvUdLTV9Bd/messages/2bbedeb3-b071-473c-878b-
dac4252d149b/status
Authorization: Access Token obtained from Auth2 SSO service as Bearer token
14
Request Parameters:
2.2.1.1. Example:
GET{serverRoot}/bot/v1/OsOsQ0GwNvUdLTV9Bd/messages/ddc24c2-cff5-48ac-baaa-
4f286bc28061/status
Authorization: Access Token obtained from Auth2 SSO service as Bearer token.
Request:
No request body
Request Parameters:
Response: 200OK
{
"RCSMessage": {
"msgId": "ddc24c2-cff5-48ac-baaa-4f286bc28061",
"status": "sent",
"timestamp": "2020-11-10T11:06:26"
}
}
Response Parameters:
15
msgId A field in the Message Identifier
Response body for the message
Code Description
200 The status of the message will be returned in the response body.
404 The message ID cannot be found
401 This request is unauthorized.
5XX Server error.
2.2.2.1. Example
PUT{serverRoot}/bot/v1/OsOsQ0GwNvUdLTV9Bd/messages/MsYMv92L4HS5GJ54rW5Xm2JA/s
tatus
Authorization: Access Token obtained from Auth2 SSO service as Bearer token.
Request:
{
"RCSMessage": {
"status": "displayed"
}
}
Request Parameters:
16
msgId Path variable Message-Id of the
received user
message
Code Description
204 The status of the message has been updated and a read
notification will be sent to the user
400 This is a bad request with invalid input, invalid object, etc.
2.2.3.1. Example:
PUT{serverRoot}/bot/v1/OsOsQ0GwNvUdLTV9Bd/messages/MsW6S-
iK49TuCRSwG=mfNP7Q/status
Authorization: Access Token obtained from Auth2 SSO service as Bearer token.
Request:
{
"RCSMessage": {
"status": "cancelled"
}
}
Request Parameters:
17
Name Type Description Remarks
Code Description
204 The RCS APIs Platform shall try to revoke the message if it has not
been delivered to the user.
400 This is a bad request with invalid input, invalid object, etc.
404 The message ID cannot be found
401 This request is unauthorized.
5XX Server error.
This is an RCS based communication service, the Chatbot shall only communicate with the
user using an RCS capable device. So the Chatbot shall conduct the RCS capability discovery
to learn about whether the given user's device is RCS capable or not.
Request format:
URL: {serverRoot}/bot/v1/OsQ0GwNvUdLTV9Bd/contactCapabilities
Authorization: Access Token obtained from Auth2 SSO service as Bearer token.
Request:
No request body
18
Request Parameters:
Response Format:
{
"capabilities": [
"chatBotCommunication",
"chat",
"fileTransfer"
]
}
Response Parameters:
Code Description
19
404 user's device is not RCS capable.
5XX Server error.
2.3.1. Example:
GET {serverRoot}/bot/v1/OsQ0GwNvUdLTV9Bd/contactCapabilities?
userContact=+914253136788
Authorization: Access Token obtained from Auth2 SSO service as Bearer token.
Request:
No request body
Request Parameters:
There are two ways to upload files to the RCS APIs platform. Files can be uploaded directly to
the RCS APIs platform or by sharing a file URL.
20
Request format:
URL: {serverRoot}/bot/v1/OsQ0GwNvUdLTV9Bd/files
Authorization: Access Token obtained from Auth2 SSO service as Bearer token.
‘fileType‘
‘until ‘
‘fileContent’ or ‘fileUrl’
Request Parameters:
{
"File": {
"fileId": "GiYosOsQ0GwNvUdLTV9Bd2naXGkuz8bmDA",
"fileUrl": "https://api.virbm.in/OsQ0GwNvUdLTV9Bd/someFile.png",
"fileSize": 15022,
"status": "ready",
"validity": "2020-11-12T11:06:26"
}
}
21
Response Parameters:
Code Description
2.4.2.1.1. Example:
POST {serverRoot}/bot/v1/OsQ0GwNvUdLTV9Bd/files
Authorization: Access Token obtained from Auth2 SSO service as Bearer token.
Request:contentType - multipart/formdata
fileType Image/png
until 2020-11-12T11:06:26
fileContent picture1.png
22
"File": {
"fileId": "YB5tV2prGiY2eAyIuFZ6AiEJ1zPnaXGk",
"fileUrl": "https://api.virbm.in/OsQ0GwNvUdLTV9Bd/picture1.png",
"fileSize": 15022,
"status": "ready",
"validity": "2020-11-12T11:06:26"
}
}
2.4.2.2.1. Example:
POST {serverRoot}/bot/v1/OsQ0GwNvUdLTV9Bd/files
Authorization: Access Token obtained from Auth2 SSO service as Bearer token.
Request:contentType - multipart/formdata
fileType Image/png
until 2020-11-12T11:06:26
fileUrl https://somedomain.com/pictures/picture2.png
{
"File": {
"fileId": "wPT9VpDqEfW98EnYDpSiuMC74yn7N7tX",
"fileUrl":"https://api.virbm.in/OsQ0GwNvUdLTV9Bd/picture2.png",
"fileSize": 14052,
"status": "ready",
"validity": "2020-11-12T11:06:26"
}
}
A chatbot can delete the file uploaded to the platform earlier, by providing the file Id.
Request format:
23
URL:{serverRoot}//bot/v1/OsQ0GwNvUdLTV9Bd/files/GiYosQ0GwNvUdLTV9Bd2naXGkuz8bmD
A
Authorization: Access Token obtained from Auth2 SSO service as Bearer token.
Request:
No request body
Request Parameters:
No response body
Code Description
2.4.3.1. Example:
DELETE
{serverRoot}/bot/v1/OsQ0GwNvUdLTV9Bd/files/DqVpWEf8E7N7tnpXwPSiuMT99YDC74yn
Authorization: Access Token obtained from Auth2 SSO service as Bearer token.
Request:
No request body
Response:204 No Content
24
2.4.4. Get status of the uploaded file
Resource endpoint: {serverRoot}/bot/v1/{botId}/files/{fileId}
A chatbot can retrieve the uploaded file's information. This API provides a way to check the file
status along with other information. Possible file status includes 'ready' and 'expired'.
Request format:
URL: {serverRoot}/bot/v1/OsQ0GwNvUdLTV9Bd/files/YB5tV2prGiY2eAyIuFZ6AiEJ1zPnaXGk
Authorization: Access Token obtained from Auth2 SSO service as Bearer token.
Request:
No request body
Request Parameters:
{
"File": {
"fileId": "YB5tV2prGiY2eAyIuFZ6AiEJ1zPnaXGk",
"fileUrl": "https://api.virbm.in/OsQ0GwNvUdLTV9Bd/picture1.png",
"fileSize": 15022,
"status": "ready",
"validity": "2020-11-12T11:06:26"
}
}
Response Parameters:
25
message types such
as file transfer or
audio message
Code Description
2.4.4.1. Example:
GET{serverRoot}/bot/v1/OsQ0GwNvUdLTV9Bd/files/YB5tV2prGiY2eAyIuFZ6AiEJ1zPnaXGk
Authorization: Access Token obtained from Auth2 SSO service as Bearer token.
Request:
No request body
Response:200 OK
{
"File": {
"fileId": "YB5tV2prGiY2eAyIuFZ6AiEJ1zPnaXGk",
"fileUrl": "https://api.virbm.in/OsQ0GwNvUdLTV9Bd/picture1.png",
"fileSize": 15022,
"status": "expired",
"validity": "2020-11-12T11:06:26"
}
}
2.5.Webhook
Webhook is the callback API provided by the Chatbot. RCS APIs Platform uses the webhook
exposed by Chatbot to send an HTTP POST payload when certain RCS events occur.
26
A chatbot may receive the following events from the RCS-APIs platform:
1. message from a user (text, file, location, or audio message)
2. isTyping notification from a user
3. message status update
4. response to suggested reply or action
The Chatbot shall always return a 200 OK HTTP response to the HTTP POST from the RCS APIs
Platform.
2.5.1.1. Example
2.5.1.1.1. Message from a user
{
"RCSMessage": {
"msgId":"MsWHg8WU3cTjK7scyQ1bv-aA",
"textMessage":"hello world",
"timestamp":"2020-11-12T09:16:29.527061Z"
},
"messageContact": {
"userContact":"+914253136789"
},
"event":"message"
}
27
"status":"delivered",
"timestamp":"2020-11-12T09:55:49.444158Z"
},
"messageContact":{
"userContact":"+914253136789"
},
"event":"messageStatus"
}
{
"RCSMessage":{
"msgId":"MxNsfgtg86T-6-=o2i7P3pGw",
"timestamp":"2023-06-20T15:39:30.475341Z",
"suggestedResponse":{
"response":{
"action":{
"displayText":"Reach Us",
"postback":{
28
"data":"user_clicked_Reach_Us",
"metadata":"{\"suggestionType\":\"url_action\",\"templateType\":\"carousel\",\"car
dIndex\":1,\"suggestionIndex\":2,\"msgId\":\"1ed15c61-7fd1-436a-a127-
0baa8d91cdb2\",\"a2pMsgDate\":\"2023-07-03T15:22:00.356\",\"templateCode\":\"test
template\"}"
}
}
}
}
},
"messageContact":{
"userContact":"+919976878767"
},
"event":"response"
}
The metadata fields will be additionally sent as part of the payload to the agent webhook
in case the user responses are within A2P message templates. This will include the
following:
cardIndex: in case of a carousel, the index of the card for which the user event is
generated (index starts from 0)
To get the number of RBM-reachable users, do a bulk capability check. Bulk checks include
whether a phone number is reachable but not which capabilities or features a phone number
supports (Please refer to the single capability check API in Section 2.3 to understand what is
29
meant by capabilities). You can specify up to 10,000 phone numbers per bulk capability
check. To check more numbers, perform multiple checks.
Bulk capability checks respond with the specified numbers that are reachable by the agent.
Note: This is a common API for both Google and GSMA and this API is applicable for
only launched bots.
2.6.1. Example
POST {serverRoot}/bot/v1/OsOsQ0GwNvUdLTV9Bd/rcsEnabledContacts
Authorization: Access Token obtained from Auth2 SSO service as Bearer token.
Request:
{
"users": [
"+919687895543",
"+919686960876",
"+919688757768"
]
}
Request Parameters:
Response:
Ex1. 200 OK
{
"rcsEnabledContacts": [
"+919686960876"
]
}
Ex2. 400 Bad Request
{
"Error": "Requested users shouldn't be more than 10000 in a request"
}
30
Code Description
400 This is a bad request with invalid input, invalid object, etc.
31
3. Google Style RBM APIs
Vi MaaP also provides Google style APIs as per Google RBM standard specifications for the
ease of use for developers and brands.
This comes handy for a developer or brand who has already integrated with Google RBM APIs
earlier, and now wants to integrate with a non-Google MaaP. With these APIs, they can
seamlessly integrate with Vi's Google Style RBM API's (even for non-Google MaaPs) with minor
changes since the API request and response payload will be same as per Google standards.
3.1. Authorization
To access Google APIs of the Vi RCS platform, an access token with ‘Chatbot-message’ and
‘google’ scope needs to be provided.
Register a Service Client with scope ‘Chatbot-message’ and ‘google’ to receive OAuth2
client_credentials. Using the credentials obtained from SSO, an access token can be generated
which in turn should be used as an Authorization Bearer token, to access Google spec APIs of
RCS platform.
https://auth.virbm.in/auth/oauth/token?grant_type=client_credentials
To get the token, the clientId and client_secret should be sent in the Authorization header as
Basic authentication (base64 encoded).
In addition to the RCS messages, any template added and approved on Developer portal can
be sent on this endpoint. Please note that only template messages from the brand will be
allowed outside of a conversation. Please refer to Rich Template section for more details.
1. {serverRoot}/v1/phones/{phone_number}/agentMessages/async?botId={bot_id}&m
essageId={message_id}
This is the Google styled messaging API. Requests submitted on this endpoint will receive
only Pending event and validation errors (invalid client, invalid template, rate limit etc...)
as API response, any other errors (charging failure, number not found, etc...) will be sent
as a failure event on the agent’s callback URL.
32
Request Parameters:
If messageId is not
provided, Platform
will assign one and
include it in
response.
Message expiry:
An Additional field is available in all agent messages to support message expiry feature.
To help ensure timely and relevant messages, set a message expiration. This can prevent
offline users from receiving stale content when they come back online. Expiration is also a
good cue to invoke your fallback messaging strategy, so users get the info they need on
time.
To set a message expiration, specify one of the following fields in the agent message:
expireTime: the exact time in UTC when the message expires. A timestamp in RFC3339
UTC "Zulu" format, with nanosecond resolution and up to nine fractional
digits.
example: - "expireTime": "2024-10-02T15:01:23Z"
ttl(time to live): the amount of time before the message expires. A duration in seconds
with up to nine fractional digits, ending with 's'.
example:- "ttl": "3.5s"
These fields are optional and if any older dates or invalid formats are used such
messages will be rejected. Once the message expires, the platform stops trying to deliver
the message, and it's automatically revoked. Based on revoke status,
33
‘ttl_expiration_revoke’ or ttl_expiration_revoke_failed event will be sent on agent
webhook. Please refer to section 3.8.2.1.6 and 3.8.2.1.7 for details.
Request format:
URL:
POST https://api.virbm.in/rcs/v1/phones/+914253136789/agentMessages/async?botId=
OsOsQ0GwNvUdLTV9Bd&messageId=d2f81052-37c7-469c-997b-9576023b4220
Authorization: Access Token obtained from Auth2 SSO service as Bearer token
Request:
Ex 1: TEMPLATE MESSAGE
{
"contentMessage":{
"templateMessage":{
"templateCode":"template_123",
"customParams":"{\"name\":\"Vi\"}"
}
}
}
Ex2: TEXT
{
"contentMessage" : {
"text" : "Welcome to RCS chat!"
},
"ttl": "10s"
}
34
}
}
}]
}
}
Ex6: RICHCARD
{
"contentMessage" : {
"richCard" : {
"standaloneCard" : {
"cardContent" : {
"media" : {
"contentInfo" : {
"fileUrl" : "https://storage.googleapis.com/kitchen-sink-
sample-images/cute-dog.jpg ",
"forceRefresh" : false,
"thumbnailUrl" : "https://storage.googleapis.com/kitchen-sink-
sample-images/cute-dog.jpg"
},
"height" : "MEDIUM"
},
"title" : "Celebrity",
"suggestions" : [ {
"reply" : {
"text" : "Like",
"postbackData" : "user_like"
}
} ]
},
"thumbnailImageAlignment" : "LEFT",
"cardOrientation" : "VERTICAL"
}
},
"suggestions" : [ {
"reply" : {
35
"text" : "Know more",
"postbackData" : "user_query"
}
} ]
}
}
Response :
Ex 1:
{
"name": "phones/+919686960276/agentMessages/3bbf89eb-2a11-4569-aaac-
8458215b0231",
"sendTime": "2023-01-23T08:10:22.397Z",
"contentMessage":
{
"text": "Welcome to RCS chat!"
}
}
36
Ex 2:
{
"senderPhoneNumber": "+919686960276",
"eventType": "FAILED",
"reason": "Invalid client id!",
"sendTime": "2023-02-01T04:45:44.206Z",
"messageId": "00b53bde-9760-41f5-8f11-7a2f25b6b2ac",
"code": 403
}
37
invalid_client 403 Invalid client id
Response Parameters:
38
message A field in the Error message if
response body request fails
Agent generated events for user messages can be sent through this API. Agents can send
read event for a user message or typing indication to users.
Resource endpoint:
{serverRoot}/rcs/v1/phones/{phone_number}/agentEvents?botId={bot_id}&eventId={event
_id}
Authorization: Access Token obtained from Auth2 SSO service as Bearer token.
Request Parameters:
39
3.3.1. Send ‘read’ notification to users
A chatbot can send a ‘read’ notification to the end user for any received user message. This
event indicates that a message has been opened or acknowledged. To users, this event
appears as a read receipt for a specific message.
Request format:
URL :
POST
https://api.virbm.in/rcs/v1/phones/+914253136789/agentEvents?botId=OsOsQ0GwNvUdLTV9B
d&eventId=6924cc84-dc0b-4679-a4ab-50c0875b309f
Authorization: Access Token obtained from Auth2 SSO service as Bearer token.
Request:
{
"eventType": "READ",
"messageId": "6924cc84-dc0b-4679-a4ab-50c0875b309f "
}
Response: 200 OK
No response body
200 The status of the message has been updated and a read notification
will be sent to the user
400 This is a bad request with invalid input, invalid object, etc.
404 The message ID cannot be found
40
3.3.2. Send Typing Event
The Chatbot can send typing indication to users. To a user, this event appears as a typing
indicator and lets him know that agent is composing a message. The typing indicator expires
after a short time (approximately 20 seconds) or when the user's device receives a new
message from your agent. Your agent can send multiple IS_TYPING events to reset the typing
indicator's expiration timer.
Request format:
URL :
POST
https://api.virbm.in/rcs/v1/phones/+914253136789/agentEvents?botId=OsOsQ0GwNvUdLTV9B
d&eventId=6924cc84-dc0b-4679-a4ab-50c0875b309f
Authorization: Access Token obtained from Auth2 SSO service as Bearer token.
Request:
{
"eventType" : "IS_TYPING"
}
Response: 200 OK
No response body
3.4.Revoke a Message
Agent can revoke messages that it has sent but that have not been delivered to the user.
41
There is a small chance that your bot may initiate a revocation while the MaaP is in the
process of delivering the message. In these rare cases, your bot receives a DELIVERED event
for the message shortly after initiating the revocation request.
Resource endpoint:
{serverRoot}/rcs/v1/phones/{phone_number}/agentMessages/{message_id}?botId={b
ot_id}
Request parameter:
Request format:
URL:
DELETE
https://api.virbm.in/rcs/v1/phones/+914253136789/agentMessages/{message_id}?botId=
OsOsQ0GwNvUdLTV9Bd
42
Authorization: Access Token obtained from Auth2 SSO service as Bearer token.
Response :
Ex1 :
200 OK
No response body
Ex2: if messageId Not found.
404 NOT FOUND
{
"status": "Error",
"message": "Not found : Message Id"
}
Response Parameters:
200 Revoke request has been accepted and platform will try to revoke if
it’s not delivered to user yet.
43
In RCS based communication service, the Chatbot shall only communicate with the user using
an RCS capable device. So the Chatbot shall conduct the RCS capability discovery to learn
about whether the given user's device is RCS capable or not.
Resource endpoint:
{serverRoot}/rcs/v1/phones/{phone_number}/capabilities?botId={bot_id}&request
Id={request_id}
Request Parameters:
Request format:
URL:
44
GET
https://api.virbm.in/rcs/v1/phones/+914253136789/capabilities?botId=
OsOsQ0GwNvUdLTV9Bd&requestId= 2918644c-9b58-4cf9-a598-3eec750ad0e3
Authorization: Access Token obtained from Auth2 SSO service as Bearer token
Request:
No request body
Response :
Response Parameters:
45
5XX Server error.
When agent sends a message with an image or video, agent must provide a publicly
accessible URL for the content. If not, agent can upload a media file binary to Vi CDN and then
send the media in a message. The Vi RCS platform keeps files for 60 days, and the API returns
a file Id that your agent can include in messages to users. After 60 days, the file will be
removed from CDN.
Resource endpoint:
{serverRoot}/rcs/upload/v1/files?botId={botId}
Request format:
URL:
POST
https://api.virbm.in/rcs/upload/v1/files?botId={botId}
Authorization: Access Token obtained from Auth2 SSO service as Bearer token
Request:
binary
contentType – content type of the file (image/jpeg, video/mp4, image/png, etc..)
select the file
Response:
46
Ex1 : returns Identifier for the uploaded file.
200 OK
{
"name": "9mEFZnVTBsycGwtVTH7BovQwuz0Msr9p"
}
Response Parameters:
200 Revoke request has been accepted and platform will try to revoke if
it’s not delivered to user yet.
Chatbots can use this feature to register a tester device for Google MaaP.
47
Resource endpoint:
{serverRoot}/rcs/v1/phones/{phone_number}/testers?botId={bot_id}
Request Parameters:
Request format:
URL:
POST
https://api.virbm.in/rcs/v1/phones/{phone_number}/testers?botId=OsOsQ0GwNvUdLTV9
Bd
Authorization: Access Token obtained from Auth2 SSO service as Bearer token
Request:
No request body
Response :
{
"statusCode": "Success",
"response": "Submitted, Tester Invite Sent"
}
48
HTTP Response Codes
Code Description
3.8.Webhook
Webhook is the callback API provided by the Chatbot. Vi RCS APIs Platform uses the webhook
exposed by Chatbot to send an HTTP POST payload when certain RCS events occur.
A chatbot may receive the following events from the RCS-APIs platform:
1. message from a user (text, file, location, or audio message)
2. isTyping notification from a user
3. message status update
4. response to suggested reply or action
The Chatbot shall always return a 200 OK HTTP response to the HTTP POST from the RCS APIs
Platform.
The payload that can be sent from the Vi RCS APIs platform to the developer Chatbot’s
webhook is as defined in Google API specifications.
Every request sent on webhook will be base64 encoded in Google format and set to 'data'
field as below.
{
"subscription": "projects/rbm-stagingtestagent-
ngu7dtz/subscriptions/rbm-agent-subscription",
"message": {
"data":
"ewogICJzZW5kZXJQaG9uZU51bWJlciI6ICIrOTE5Njg2OTYwMjc2IiwKICAibWVzc2FnZU
lkIjogIk14SWdULTRwV0NRdTJ0SDloTWtTVGxqUSIsCiAgInNlbmRUaW1lIjogIjIwMjItM
TEtMTdUMDU6MTU6MTQuMzg0OTYzWiIsCiAgInRleHQiOiAiVGVzdCIsCiAgImFnZW50SWQi
OiAic3RhZ2luZ3Rlc3RhZ2VudEByYm0uZ29vZyIKfQ==",
49
"attributes": {
"project_number": "129459109761",
"product": "RBM",
"message_type": "TEXT",
"business_id": "T7SJfBnLaLCuFM6x",
"type": "message"
},
"messageId": "6267774379637729",
"publishTime": "2022-11-17T05:15:14.538Z"
}
}
On decoding the ‘data’ field one of the following payload can be obtained.
3.8.2.1. Example
3.8.2.1.1. Message from a user
{
"senderPhoneNumber": "PHONE_NUMBER",
"messageId": "0a99d150-aae7-4247-aa07-a92cdaaf8ed3",
"sendTime": "2018-12-31T15:01:23.045123456Z",
"text": "Hello, world!",
"agentId": " [email protected]"
}
50
"text": "Suggestion #1" }
}
{
"suggestionResponse":{
"postbackData":"user_clicked_Reach_Us",
"text":"Reach Us",
"type":"ACTION",
"metadata":"{\"suggestionType\":\"url_action\",\"templateType\":\"carousel\",\"cardIndex\":
1,\"suggestionIndex\":2,\"msgId\":\"1ed15c61-7fd1-436a-a127-
0baa8d91cdb2\",\"a2pMsgDate\":\"2023-07-03T15:22:00.356\",\"templateCode\":\"test
template\"}"
},
"senderPhoneNumber":"+919986473361",
"messageId":"MxNsfgtg86T-6-=o2i7P3pGw",
"sendTime":"2023-06-20T15:39:30.475341Z",
"agentId":"[email protected]"
}
The metadata fields will be additionally sent as part of the payload to the agent webhook in
case the user responses are within A2P message templates. This will include the following:
SuggestionType: reply, dialer_action, url_action
templateType: text_message, rich_card, carousel
cardIndex: in case of a carousel, the index of the card for which the user event is generated
(index starts from 0)
suggestionIndex: index of the suggestion starting from 0
msgId: the message Id of the original A2P message
a2pMsgDate: date in which the original A2P message was sent
templateCode: name of the template
51
"agentId": "[email protected]",
"eventType": "TTL_EXPIRATION_REVOKE_FAILED",
"eventId": "MxNsfgtg8sjfjk6=o2i7P3pGw",
"sendTime": "2023-06-20T15:39:30.475341Z"
}
52
4. Templates and Rich Notification APIs
Vi RBM lets you add rich media such as images, carousels, and videos, along with
customized branding, action buttons, and suggested replies into the notifications and
promotional messages.
These template messages are delivered using the underlying RCS APIs.
An RCS Template is a predefined set of RBM UI elements for e.g., a Rich Card with
suggestions which can be used as a base for formulating messages in your campaign to
the target audience.
Once a bot is created, the aggregator can create multiple templates against the bot and
use them for running campaigns. You can add images, videos, and suggested actions for
your template.
Vi RBM portal supports 3 types of templates:
o Text Message
o Rich Card Stand-alone
o Rich Card Carousel
53
Text Message Template
54
Rich Card Stand-alone Template
Any template created needs to be approved by Vi RBM Admin before it can be used
by developer to send messages.
The brand needs to submit details of the type of template to Vi from the ‘Add
Template’ section in the portal. The option of ‘Add Template’ is enabled only after the
RCS agent has been created in the Vi platform.
55
Once it is approved, you can send a message either to a tester (by adding the end
user’s phone number as a test device) if the bot is not yet launched, or directly send a
message to the user if the bot is launched in Vi.
Please note that only template messages from the brand will be allowed outside of a
conversation.
Once the template has been approved by Vi admin, use the notifications API by
passing the template code (name) and the target recipient number. Please refer to
the API section for the request and response details.
For personalized content, please note that the variables will be replaced by the real
values only during campaign execution.
Example of personalization:
In the above description., the variables within the square brackets viz., DISCOUNT and
CODE will be replaced by the actual values passed in the API in the field
custom_param (see below in theAPI section).
Vi supports REST API’s for sending template messages. The message events and notifications
will be delivered over the webhook that has been configured as part of the RCS agent
creation and development.
56
The Rich Notification API (details below) can be used only after the Rich Template has been
defined, created, and approved.
POST{base_uri}/api/rich_notification
Add header:
RequestParameters:
57
Unique bot id.
bot_id string
This would be
shared with you
as part of the
onboarding
process. Please
refer to Sec1.3
Response: 200 OK
Example Value:
{
"status_code": 10,
"status_message": "success",
"message": [
"Provided number's [918329707754] device is RCS enabled. So sending via the RCS agent."
]
}
ResponseParameters:
58
V I P R O P R I E T A R Y A N D C O N F I D E N T I A L
Code Description
200 The audience list has been accepted and message push has
started using the configured template.
400 This is a bad request with invalid input, invalid object, etc
5. API Throttling
The RCS API Platform defines configurations for the throttling limits for the API described
in the previous sections. This means that there is an upper limit to the rate of API
requests that the RCS API platform will accept from each account.
The API Platform has two separate configurations for defining the throttling limits:
o Sending a Message
o Revoking a Message
The TPS defined above is the average rate accepted by the API Platform. In
addition to that, the platform allows short time spikes of 20% of the
configured TPS, as long as the load is below the configured TPS over a 30
second period.
For example, if the TPS is set at 50, developer can send up to 60 TPS, as long
as the total number of requests is no more than 1,500 in a 30 second window
(50 TPS x 30 seconds = 1,500).
40
V I P R O P R I E T A R Y A N D C O N F I D E N T I A L
In the case that the number of requests for any given account or a given agent
exceeds the throttling limit, the response object will be as below:
{
"text": " Number of API requests allowed per second exceeded. Please
retry "
}
}
41
V I P R O P R I E T A R Y A N D C O N F I D E N T I A L
"senderPhoneNumber": "+919686960276",
"eventType": "FAILED",
"reason": " Number of API requests allowed per second exceeded. Please
retry"",
"sendTime": "2023-03-07T10:45:37.959Z",
"messageId": "e4d4529f-0336-4292-8a39-34964cad2bd3"
}
Both Group 1 and Group 2 Rate Limits are configured and enforced at account level.
Please contact [email protected] for the value of TPS configured for your
account.
42