Tutorial section - RCS

Send RCS with MaaP using Node.js

Sending RCS with the MaaP API using the Node.js programming language

The rcs-maap-bot module can be used to make MaaP requests using Node.js to send RCS.

Node.js requirements and resources

Node.js is a scripting/programming language and can be used to quickly and easily add RCS support for programmatically sending and receiving RCS messages. Use it for transactional messaging and notifications between your application and mobiles. The following are required to send RCS using Node.js:

  • Node.js
    Node.js is a scripting/programming language

Requirements and resources

The following are required to send RCS with MaaP using Node.js:

Code

The following example Node.js code makes a MaaP call to send a message to a mobile user in reply to receiving a message from them.

const http = require('http')
const Maap = require('rcs-maap-bot')

let bot = new Maap.Bot({
  token: 'TOKEN',
  api_url: 'API_URL',
  bot_id: 'BOT_ID'
})

bot.on('error', (err) => {
  console.log(err.message)
})

bot.on('message', (payload, reply) => {
  reply(
    "You wrote: " + payload.RCSMessage.textMessage,
    null,
    (err, body) => {
      if (err) throw err
    }
  )
})

http.createServer(bot.handleWebhook()).listen(3000)

console.log('Echo bot server running on port 3000.')

Using in production

Whatever the language or API, you can send RCS and receive RCS between applications and mobiles for a wide range of uses.

We provide a wide range of CPaaS services and infrastructure to organisations, including cloud platforms that enable you to run your own SMS gateway.

Get in contact with us to find out more about CPaaS voice, messaging, video and identity from Melrose Labs.

Testing

For testing your application's RCS support when using the MaaP protocol, we recommend starting with the Melrose Labs RCS MaaP Simulator service to simulate RCS messaging to and from mobiles.

Get MaaP credentials for RCS MaaP Simulator

Alternative APIs and languages

Other languages covered in our tutorials that can be used for sending and receiving RCS with MaaP include: Python, cURL

Find out more...

Please provide your name.
Please provide a valid company name.
Please type your message.
Please provide a valid email address.