Sending and receiving messages and events are the core aspects of communication between an agent and a user. Agents send messages, events, and requests to users through HTTP POST requests to the RBM API but receive user-created messages and events at the configured webhook.
Following is an example of conversation flow that uses sample data to illustrate how messages, events, and requests can create useful and meaningful interactions.
Hello, World!
In this example, the agent sends Hello, World!
as
a message to the user, and the user responds with Hello to you!
.
The agent sends a capability check request to verify that the user's device is RBM-capable.
The agent sends:
GET /v1/phones/+12223334444/capabilities?requestId=147547143069602483572&agentId=welcome-bot HTTP/1.1 Host: us-rcsbusinessmessaging.googleapis.com Content-Type: application/json
The RBM platform sends the agent a capability check response indicating that the user's device can receive RBM messages.
The agent receives:
{ "rbmEnabled": true, "features": [ "REVOCATION", "RICHCARD_STANDALONE", "RICHCARD_CAROUSEL", "ACTION_CREATE_CALENDAR_EVENT", "ACTION_DIAL", "ACTION_OPEN_URL", "ACTION_SHARE_LOCATION", "ACTION_VIEW_LOCATION" ] }
The agent sends the
Hello, World!
message to the RBM API, which passes it to the user's device.The agent sends:
POST /v1/phones/+12223334444/agentMessages?messageId=123&agentId=welcome-bot HTTP/1.1 Host: us-rcsbusinessmessaging.googleapis.com Content-Type: application/json { "contentMessage": { "text": "Hello, World!", } }
The RBM platform sends the message to the user's device and sends a
DELIVERED
event to the agent.The agent receives:
{ "senderPhoneNumber": "+12223334444", "agentId": "welcome-bot@rbm.goog", "eventType": "DELIVERED", "eventId": "Ms6oOiEli6QS-fe8QFrmhfIg", "messageId": "123" }
The user opens the message on their device, which sends a
READ
event to the agent.The agent receives:
{ "senderPhoneNumber": "+12223334444", "agentId": "welcome-bot@rbm.goog", "eventType": "READ", "eventId": "Ms6oOiEli6QS-ge9ZFsmgTj", "messageId": "123" }
The user writes and sends a reply to the agent.
The agent receives:
{ "senderPhoneNumber": "+12223334444", "agentId": "welcome-bot@rbm.goog", "messageId": "msg000999888777a", "sendTime": "2018-12-31T15:01:23.045123456Z", "text": "Hello to you!", }
The RBM platform automatically sends the user's device a
DELIVERED
event when it receives the user's message.The agent sends a
READ
event in response to the user's message to let them know it was received and acknowledged.The agent sends:
POST /v1/phones/+12223334444/agentEvents?eventId=1234&agentId=welcome-bot HTTP/1.1 Host: us-rcsbusinessmessaging.googleapis.com Content-Type: application/json { "eventType": "READ", "messageId": "msg000999888777a" }