A RCS Business Messaging Library for Node
npm install @rownd/rcs-business-messaging
import RbmApiHelper, { JWT } from '@rownd/rcs-business-messaging';
// Initialize the Google auth client
const authClient = new JWT(
'<CLIENT_EMAIL>',
void 0,
'<PRIVATE_KEY>',
[
'https://www.googleapis.com/auth/rcsbusinessmessaging'
]
);
// Initialize RBM API helper
const rbmApiHelper = new RbmApiHelper(authClient);
const msisdn = '+19199999999';
// Call checkCapability() to determine if the msisdn supports RCS
try {
await rbmApiHelper.checkCapability(msisdn);
} catch (err) {
if (err instanceof GaxiosError && err.response?.status === 404) {
throw new Error('RCS not supported');
}
throw err;
}
const response = await rbmApiHelper.sendMessage({
messageText: message,
msisdn: msisdn,
suggestions: [],
});