Tutorial section - RCS
Send RCS with MaaP using cURL
Sending RCS with the MaaP API using the cURL programming languageThe rcs-maap-bot
module can be used to make MaaP requests using Node.js to send RCS.
cURL requirements and resources
cURL is a command-line tool that can be used to quickly and easily add RCS support for 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 cURL:
- cURL
cURL is a command-line tool
Code
The following example cURL commands make MaaP calls to send a "hello world" message to a mobile user.
Get access token
MaaP API credentials (client_id
and client_secret
) can be obtained from RCS MaaP Simulator .
$ curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -d "grant_type=client_credentials&scope=botmessage&client_id=3735253246770816601&client_secret=15733157713923306455" https://rcsmaapsim.melroselabs.com/oauth2/v1/token
{
"access_token": "37JncCHryDsbzayy4cBWDxS22JjzhMai",
"expires_in": 900,
"refresh_token": "RrV41mtzxlYvKWrO72tK0LK0e1zLOZ2n",
"token_type": "access"
}
Contact capabilities
$ curl -H "Authorization: Bearer 37JncCHryDsbzayy4cBWDxS22JjzhMai" -X GET 'https://rcsmaapsim.melroselabs.com/rcs/bot/v1/bot402829/contactCapabilities?userContact=+447968847040'
{
"capabilities": [
"chatBotCommunication",
"fileTransfer",
"videoCall",
"geolocationPush",
"chat"
]
}
Send message
$ curl -H "Authorization: Bearer 37JncCHryDsbzayy4cBWDxS22JjzhMai" -H "Content-Type: application/JSON" -X POST https://rcsmaapsim.melroselabs.com/rcs/bot/v1/bot402829/messages -d '{"RCSMessage":{"textMessage":"hello world"},"messageContact":{"userContact":"+447964847040"}}'
{
"RCSMessage": {
"msgId": "RrV41mtzxlYvKWrO72tK0LK0e1zLOZ2n",
"status": "pending"
}
}
Message status
$ curl -H "Authorization: Bearer 37JncCHryDsbzayy4cBWDxS22JjzhMai" -X GET https://rcsmaapsim.melroselabs.com/rcs/bot/v1/bot402829/messages/RrV41mtzxlYvKWrO72tK0LK0e1zLOZ2n/status
{
"RCSMessage": {
"msgId": "RrV41mtzxlYvKWrO72tK0LK0e1zLOZ2n",
"status": "delivered"
}
}
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.
RCS Code BenchGet MaaP credentials for RCS MaaP Simulator
RCS Developer Tools
Alternative APIs and languages
Other languages covered in our tutorials that can be used for sending and receiving RCS with MaaP include: Python, Node.js