Rapidpro-Channel is a Rocket.Chat app to enable the integration between RapidPro channels service and Rocket.Chat.
- Clone the repository and change directory:
git clone https://github.com/Ilhasoft/RCApps.RapidPro-Channel.git
cd RCApps.RapidPro-Channel
- Install the required packages:
npm install
- Give your branding to the Application:
npm run build
- Then the CLI will prompt you to insert some info about your App's branding settings
- Deploy the App to an specific Rocket.Chat instance:
rc-apps deploy --url <your-rocket-url> --username <your-admin-username> --password <your-admin-password>
- If deploying to an specific Rocket.Chat instance, make sure to enable
Development Mode
onAdministration > General > Apps > Enable Development Mode
.
- To publish the App on the Rocket.Chat Marketplace, run the following command:
npm run publish
- Answer the questions requested to publish the App on the Rocket.Chat marketplace.
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 toAdministration > Apps > this app
, and paste thesecret
on theApp's Secret
field, then clickSave 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
andUser Id
go toProfile
>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"
}
- Description:
- Match the given secret from
Authorization
header with the App'sApp Secret
field.
- Match the given secret from
- Success result:
- Status:
204 No-Content
- Status:
-
Description:
- Sets the given settings on app.
-
Payload:
{ "webhook": { "url": "https://<host>/c/rc/<UUID>/receive" }, "bot": { "username": "rocket.cat", } }
-
Success result:
- Status:
204 No Content
- Status:
- Description:
- Send a message to the specified user
- Payload:
{ "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", } ] }
- Success result:
- Status:
201 Created
- Body:
{ "id": "onrMgdKbpX9Qqtvoi" }
- Status:
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 <callback_url>
- User Message:
- Description:
- Triggered when the user/visitor sends a message to the bot.
- Payload:
{ "user": { "urn": "livechat:onrMgdKbpX9Qqtvoi", "username": "john.doe", "full_name": "John Doe" }, "text": "Hi!", "attachments": [ { "type": "image", "url": "https://link.to/attachment1.png", } ] }
- Description: