Sending an RCS message

Learn how to quickly send RCS messages in a Node.js application with the Sinch RCS API.

What you need to know before you start

RCS is currently only supported on Android handsets and needs to be enabled in the messaging client being used on the device. As such, you will need a compatible Android device with chat features turned on in the messaging client.

You will also need access to one of the Sinch Demo Sender Identities which will be provided to you upon acceptance to the Closed Beta program.

Set up your Node.js application

Create a new node app with npm.

npm init

Accept the defaults for the application. Add the fetch package with npm to generate the necessary dependencies.

npm install 'node-fetch'
Note:
The node fetch package requires us to use node modules, so we need to use a .mjs file type instead of a .js.

Create your file

Create a new file named index.mjs in the project and paste the provided "Send an RCS message" code into the file.

Fill in your parameters

Assign your values to the following parameters:

ParameterYour value
senderIDThe demo Sender ID sent to you by your account manager
apiTokenThe API token sent to you by your account manager
toNumberThe phone number to which you want to send the test RCS message

Save the file.

Send your first RCS message

Now you can execute the code and send your test SMS message. Run the following command:

node index.js

Next steps

The code you used in the index.mjs file sends a POST request to the Sinch API /batches endpoint to send the SMS message. Click here to read more about the batches endpoint.

We'd love to hear from you!
Rate this content:
Still have a question?
 
Ask the community.