Tickets is a Rocket.Chat app to enable the integration between RapidPro ticketing service and the Rocket.Chat Omnichannel (Livechat) feature.
To install manually on your Rocket.Chat instance you first need to enable the installation of apps in development mode at Administration > General > Apps > Enable development mode
.
- Clone the repository and change directory:
git clone https://github.com/Ilhasoft/Rocket.Chat.App-Tickets
cd Rocket.Chat.App-Tickets
- Install the required packages:
npm install
- Deploy the App:
rc-apps deploy
- Then the CLI will prompt you to insert:
Server's URL
: Is your Rocket.Chat instance URL (if running Rocket.Chat locally, insertlocalhost:<PORT>
)username
: Is the username of the Rocket.Chat adminpassword
: Is the password of the Rocket.Chat admin
Refer to this guide if you need more info.
-
With the app installed, and with the
secret
provided on the Rocket.Chat ticket service integration on 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.
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 are 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
- Result:
- Status:
200 OK
- Status:
- Description:
- Sets the given settings on app.
- Payload:
{ "webhook": { "url": "https://<host>/mr/tickets/types/rocketchat/event_callback/<UUID>" } }
- Result:
- Status:
204 No Content
- Status:
- Description:
- Creates a livechat room to the given visitor
- Payload:
{ "ticketID": "11137eb1-c831-4ddc-ba26-0bb77837f15e", "sessionStart": "2020-07-17T10:28-03:00", "visitor": { "token": "1234", "contactUUID": "88ff1e41-c1f8-4637-af8e-d56acbde9171", "deparment": "IT Support", "name": "John Doe", "email": "[email protected]", "phone": "+15417543010", "customFields": { "foo": "bar", "bar": "foo", } } }
- Result:
- Status:
200 OK
- Body:
{ "id": "onrMgdKbpX9Qqtvoi" }
- Status:
- Description:
- Closes the livechat room from the given visitor.
- Payload:
{ "visitor": { "token": "1234", } }
- Result:
- Status:
204 No Content
- Status:
- Description:
- Receives the visitor message and forwards to its assigned agent.
- Payload:
{ "visitor": { "token": "1234", }, "text": "Can you help me?" }
- Result:
- Status:
201 Created
- Body:
{ "id": "iNKE8a6k6cjbqWhWd" }
- Status:
There are currently 2 configured webhooks 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>
- Agent Message:
- Description:
- Triggered when the agent sends a message to the visitor.
- Payload:
{ "type": "agent-message", "ticketID": "11137eb1-c831-4ddc-ba26-0bb77837f15e", "visitor": { "token": "1234" }, "data": { "text": "", } }
- Description:
- Room Closing:
- Description:
- Triggered when a livechat room is closed.
- Payload:
{ "type": "close-room", "ticketID": "11137eb1-c831-4ddc-ba26-0bb77837f15e", "visitor": { "token": "1234", } }
- Description: