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 helperconstrbmApiHelper=require('@google/rcsbusinessmessaging');// Send the device an event to indicate that messageId has been readrbmApiHelper.sendReadMessage('+12223334444',messageId);
importcom.google.rbm.RbmApiHelper;…// Create an instance of the RBM API helperRbmApiHelperrbmApiHelper=newRbmApiHelper();// Send the device an event to indicate that messageId has been readrbmApiHelper.sendReadMessage(messageId,"+12223334444");
# Reference to RBM Python client helper and messaging object structurefromrcs_business_messagingimportrbm_service# Send the device an event to indicate that message_id was readrbm_service.send_read_event('+12223334444',message_id)
usingRCSBusinessMessaging;…// Create an instance of the RBM API helperRbmApiHelperrbmApiHelper=newRbmApiHelper(credentialsFileLocation,projectId);// Send the device an event to indicate that messageId has been readrbmApiHelper.SendReadMessage(messageId,"+12223334444");
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 helperconstrbmApiHelper=require('@google/rcsbusinessmessaging');// Send the device an event to indicate that the agent is typingrbmApiHelper.sendIsTypingMessage('+12223334444',function(){console.log('Typing event sent!');});
importcom.google.rbm.RbmApiHelper;…// Create an instance of the RBM API helperRbmApiHelperrbmApiHelper=newRbmApiHelper();// Send the device an event to indicate that the agent is typingrbmApiHelper.sendIsTypingMessage("+12223334444");
# Reference to RBM Python client helper and messaging object structurefromrcs_business_messagingimportrbm_service# Send the device an event to indicate that the agent is typingrbm_service.send_is_typing_event('+12223334444')
usingRCSBusinessMessaging;…// Create an instance of the RBM API helperRbmApiHelperrbmApiHelper=newRbmApiHelper(credentialsFileLocation,projectId);// Send the device an event to indicate that the agent is typingrbmApiHelper.SendIsTypingMessage(messageId,"+12223334444");
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["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)."]]