new_releases Updates: Check the
release notes for new features and product updates.
Events
Stay organized with collections
Save and categorize content based on your preferences.
In the following examples, rbm_api_helper.js
(not used for Python) assumes the
file you are working in is one directory below the main app folder. You may need
to adjust the location depending on your project's configuration.
Read events
Read events let the user know that the agent received the message and
provide confidence that the RBM platform delivered their message. The following
code sends a read event to a device with a client library.
Node.js
// Reference to RBM API helper
const rbmApiHelper = require('@google/rcsbusinessmessaging');
// Send the device an event to indicate that messageId has been read
rbmApiHelper.sendReadMessage('+12223334444', messageId);
This code is an excerpt from an RBM sample agent.
Java
import com.google.rbm.RbmApiHelper;
…
// Create an instance of the RBM API helper
RbmApiHelper rbmApiHelper = new RbmApiHelper();
// Send the device an event to indicate that messageId has been read
rbmApiHelper.sendReadMessage(messageId, "+12223334444");
This code is an excerpt from an RBM sample agent.
Python
# Reference to RBM Python client helper and messaging object structure
from rcs_business_messaging import rbm_service
# Send the device an event to indicate that message_id was read
rbm_service.send_read_event('+12223334444', message_id)
This code is an excerpt from an RBM sample agent.
C#
using RCSBusinessMessaging;
…
// Create an instance of the RBM API helper
RbmApiHelper rbmApiHelper = new RbmApiHelper(credentialsFileLocation,
projectId);
// Send the device an event to indicate that messageId has been read
rbmApiHelper.SendReadMessage(messageId, "+12223334444");
This code is an excerpt from an RBM sample agent.
Typing events
Typing events
let the user know that your agent is composing a message. The following code
sends a typing event to a device with a client library.
Node.js
// Reference to RBM API helper
const rbmApiHelper = require('@google/rcsbusinessmessaging');
// Send the device an event to indicate that the agent is typing
rbmApiHelper.sendIsTypingMessage('+12223334444', function() {
console.log('Typing event sent!');
});
This code is an excerpt from an RBM sample agent.
Java
import com.google.rbm.RbmApiHelper;
…
// Create an instance of the RBM API helper
RbmApiHelper rbmApiHelper = new RbmApiHelper();
// Send the device an event to indicate that the agent is typing
rbmApiHelper.sendIsTypingMessage("+12223334444");
This code is an excerpt from an RBM sample agent.
Python
# Reference to RBM Python client helper and messaging object structure
from rcs_business_messaging import rbm_service
# Send the device an event to indicate that the agent is typing
rbm_service.send_is_typing_event('+12223334444')
This code is an excerpt from an RBM sample agent.
C#
using RCSBusinessMessaging;
…
// Create an instance of the RBM API helper
RbmApiHelper rbmApiHelper = new RbmApiHelper(credentialsFileLocation,
projectId);
// Send the device an event to indicate that the agent is typing
rbmApiHelper.SendIsTypingMessage(messageId, "+12223334444");
This code is an excerpt from an RBM sample agent.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-04-10 UTC.
[null,null,["Last updated 2025-04-10 UTC."],[[["\u003cp\u003eRead events inform the user that the agent has received their message, confirming delivery by the RBM platform, with code examples provided for Node.js, Java, Python, and C#.\u003c/p\u003e\n"],["\u003cp\u003eTyping events signal to the user that the agent is currently composing a message, and examples using Node.js, Java, Python, and C# are shown.\u003c/p\u003e\n"],["\u003cp\u003eThe examples demonstrate how to use the RBM API helper to send read and typing events, across multiple programming languages.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003erbm_api_helper.js\u003c/code\u003e is designed for use in Node.js and assumes a specific directory structure, which might need adjustments based on your project's configuration.\u003c/p\u003e\n"]]],[],null,["# Events\n\nIn the following examples, `rbm_api_helper.js` (not used for Python) assumes the\nfile you are working in is one directory below the main app folder. You may need\nto adjust the location depending on your project's configuration.\n\nRead events\n-----------\n\n[Read events](/business-communications/rcs-business-messaging/guides/build/events#read) let the user know that the agent received the message and\nprovide confidence that the RBM platform delivered their message. The following\ncode sends a read event to a device with a client library. \n\n### Node.js\n\n```javascript\n// Reference to RBM API helper\nconst rbmApiHelper = require('@google/rcsbusinessmessaging');\n\n// Send the device an event to indicate that messageId has been read\nrbmApiHelper.sendReadMessage('\u003cvar fieldlabel=\"Phone number\" translate=\"no\"\u003e+12223334444\u003c/var\u003e', messageId);\n```\nThis code is an excerpt from an [RBM sample agent](/business-communications/rcs-business-messaging/samples).\n\n### Java\n\n```java\nimport com.google.rbm.RbmApiHelper;\n...\n\n// Create an instance of the RBM API helper\nRbmApiHelper rbmApiHelper = new RbmApiHelper();\n\n// Send the device an event to indicate that messageId has been read\nrbmApiHelper.sendReadMessage(messageId, \"\u003cvar fieldlabel=\"Phone number\" translate=\"no\"\u003e+12223334444\u003c/var\u003e\");\n```\nThis code is an excerpt from an [RBM sample agent](/business-communications/rcs-business-messaging/samples).\n\n### Python\n\n```python\n# Reference to RBM Python client helper and messaging object structure\nfrom rcs_business_messaging import rbm_service\n\n# Send the device an event to indicate that message_id was read\nrbm_service.send_read_event('\u003cvar fieldlabel=\"Phone number\" translate=\"no\"\u003e+12223334444\u003c/var\u003e', message_id)\n```\nThis code is an excerpt from an [RBM sample agent](/business-communications/rcs-business-messaging/samples).\n\n### C#\n\n```c#\nusing RCSBusinessMessaging;\n...\n\n// Create an instance of the RBM API helper\nRbmApiHelper rbmApiHelper = new RbmApiHelper(credentialsFileLocation,\n projectId);\n\n// Send the device an event to indicate that messageId has been read\nrbmApiHelper.SendReadMessage(messageId, \"\u003cvar fieldlabel=\"Phone number\" translate=\"no\"\u003e+12223334444\u003c/var\u003e\");\n```\nThis code is an excerpt from an [RBM sample agent](/business-communications/rcs-business-messaging/samples).\n\nTyping events\n-------------\n\n[Typing events](/business-communications/rcs-business-messaging/guides/build/events#typing)\nlet the user know that your agent is composing a message. The following code\nsends a typing event to a device with a client library. \n\n### Node.js\n\n```javascript\n// Reference to RBM API helper\nconst rbmApiHelper = require('@google/rcsbusinessmessaging');\n\n// Send the device an event to indicate that the agent is typing\nrbmApiHelper.sendIsTypingMessage('\u003cvar fieldlabel=\"Phone number\" translate=\"no\"\u003e+12223334444\u003c/var\u003e', function() {\n console.log('Typing event sent!');\n});\n```\nThis code is an excerpt from an [RBM sample agent](/business-communications/rcs-business-messaging/samples).\n\n### Java\n\n```java\nimport com.google.rbm.RbmApiHelper;\n...\n\n// Create an instance of the RBM API helper\nRbmApiHelper rbmApiHelper = new RbmApiHelper();\n\n// Send the device an event to indicate that the agent is typing\nrbmApiHelper.sendIsTypingMessage(\"\u003cvar fieldlabel=\"Phone number\" translate=\"no\"\u003e+12223334444\u003c/var\u003e\");\n```\nThis code is an excerpt from an [RBM sample agent](/business-communications/rcs-business-messaging/samples).\n\n### Python\n\n```python\n# Reference to RBM Python client helper and messaging object structure\nfrom rcs_business_messaging import rbm_service\n\n# Send the device an event to indicate that the agent is typing\nrbm_service.send_is_typing_event('\u003cvar fieldlabel=\"Phone number\" translate=\"no\"\u003e+12223334444\u003c/var\u003e')\n```\nThis code is an excerpt from an [RBM sample agent](/business-communications/rcs-business-messaging/samples).\n\n### C#\n\n```c#\nusing RCSBusinessMessaging;\n...\n\n// Create an instance of the RBM API helper\nRbmApiHelper rbmApiHelper = new RbmApiHelper(credentialsFileLocation,\n projectId);\n\n// Send the device an event to indicate that the agent is typing\nrbmApiHelper.SendIsTypingMessage(messageId, \"\u003cvar fieldlabel=\"Phone number\" translate=\"no\"\u003e+12223334444\u003c/var\u003e\");\n```\nThis code is an excerpt from an [RBM sample agent](/business-communications/rcs-business-messaging/samples)."]]