Rapidpro-Channel is a Rocket.Chat app to enable the integration between RapidPro channels service and Rocket.Chat.
git clone https://github.com/Ilhasoft/RCApps.RapidPro-Channel.git
cd RCApps.RapidPro-Channel
npm install
npm run build
rc-apps deploy --url <your-rocket-url> --username <your-admin-username> --password <your-admin-password>
Development Mode
on Administration > General > Apps > Enable Development Mode
. npm run publish
Refer to this guide if you need more info.
With the app installed, and with the secret
provided on the Rocket.Chat claim page in RapidPro, go to Administration > Apps > this app
, and paste the secret
on the App's Secret
field, then click Save Changes
.
Return to RapidPro, and proceed with the integration setup after setting the App's Secret
field. This will automatically validate the integration between the app and RapidPro.
Create a bot on Rocket.Chat and give it the livechat-agent
role, so insert the bot username on the channel setup on RapidPro.
To get the required Auth Token
and User Id
go to Profile
> My account
> Personal Access Tokens
> Generate a token without 2FA
, save the tokens as it will not be displayed again once the pop-up is closed.
The following headers are required in for all incoming requests to ensure the requests being made from the intended RapidPro integration.
Content-Type: application/json
Authorization: Token LHHKXX8ZMJTVUFAHSW2J5P6FSF4SCQRK
Error responses body returned in this pattern:
{
"error": "error details message"
}
Authorization
header with the App's App Secret
field.204 No-Content
Description:
Payload:
{
"webhook": {
"url": "https://<host>/c/rc/<UUID>/receive"
},
"bot": {
"username": "rocket.cat",
}
}
Success result:
204 No Content
{
"userURN": "direct:john.doe",
"botUsername": "rocket.cat",
"text": "Hi! How are you?",
"attachments": [
{
"type": "image/png",
"url": "https://link.to/attachment1.png",
},
{
"type": "application/pdf",
"url": "https://link.to/attachment1.pdf",
}
]
}
201 Created
{
"id": "onrMgdKbpX9Qqtvoi"
}
There are currently 1 configured webhook on the app.
The following headers are required in for all webhooks to ensure the requests are being made from the intended RapidPro integration.
Content-Type: application/json
Authorization: Token LHHKXX8ZMJTVUFAHSW2J5P6FSF4SCQRK
POST
{
"user": {
"urn": "livechat:onrMgdKbpX9Qqtvoi",
"username": "john.doe",
"full_name": "John Doe"
},
"text": "Hi!",
"attachments": [
{
"type": "image",
"url": "https://link.to/attachment1.png",
}
]
}