How to integrate Rocket.Chat as a ticket service on the Weni Plataform

Giovana Borges Feitosa Updated by Giovana Borges Feitosa

Rocket.Chat Ticketer

Requirements

  • Admin access to Rocket.Chat
  • Admin access to Weni Flows

First steps

  1. Get org access token in Weni Flows

This token is required for the app installed on Rocket.Chat to be able to communicate with your organization on Weni Flows.

In the side menu of the platform go to Settings and at the end of the page you will have a field informing your Token.

  1. Get Rocket.Chat User ID and Access Token
  • The Rocket.Chat ID is so that Weni Flow can communicate with the installed application.
  • In Rocket.Chat go to  My account > Personal access tokens, check the option Bypass two-factor authentication and enter a name for the token.
  1. Connect Rocket.Chat to the Rocket Cloud console
  • In Rocket.Chat go to Administration > Connectivity Services > Cloud Console
  • Follow the steps to register a self-managed Rocket.Chat and enter the token provided in the cloud in Rocket.Chat
  • After inserting the Token, new options will appear on the Rocket.Chat screen, on that click Login to Rocket.Chat Cloud.

Install the Ticket app

  • Go in Administration > Apps > Marketplace
  • Search for WhatsApp Tickets by Weni  and install the App.

Configure the Ticket Service

To perform the configuration, configurations must be made in parallel in the Application and in the Ticket Service in Weni Flows. The process becomes simpler if you have already written down the Tokens that were obtained previously (Weni Flows Token, Rocket Token and User ID), to start the configuration:

  1. Go to the side menu of the platform at Integrations
  2. Inside the module go to Others Apps
  3. Next to the option Add Channel click on the menu and choose Add Ticketing Service
  4. Choose the Rocket.Chat option
  5. Configure the fields with the Rocket.Chat User ID and Token
  6. In the URL field, go to Rocket.Chat on the installed app's details screen and copy the url from the app's API listing:

It must be in the following format:

https://chat.weni.ai/api/apps/public/02c2b89b-f8c4-446c-abe0-b97c5e0d4649

  1. In the third step of the installation guide which is in the ticket service, there is a Secret that will be used to authenticate the configuration request, copy and paste it into the app's configuration page in Rocket.Chat, in the field App Secret.

Obs: This secret is updated whenever the page is reloaded. Always before clicking connect, make sure the secret matches the one configured in Rocket.Chat

  1. After entering Secret in application settings, paste the org access token in the field Weni Authorization Token and click Save in the upper right field.
  2. With the app properly configured, go back to Weni Flows and click Connect on the Ticket service configuration screen.

Configure a flow to use the service

  1. In the flow editor, to open a room in Rocket.Chat use the card Open a ticket with a human agent
  2. In the first selector choose the configured Rocket.Chat ticket service.

Obs: The selectors where you have General and Assign to  are currently not supported by the Rocket.Chat ticket service

  1. Leave the body of the card empty, removing the default string @results.

Card body must be empty or receive valid JSON with department information and/or custom fields.

With this, it is now possible to open a service for the contact

Assign a department when opening the Ticket

  • In the body of the card Open a ticket with a human agentadd the department name as follows:
{
"department": "departamento_x"
}

Add custom fields on room opening

  • In the body of the card Open a ticket with a human agentadd the custom fields as follows:
{
"customFields": {
"age": @run.contact.fields.age,
"city": @run.contact.fields.city
}
}

How did we do?

U-Partners - Proper use of features

Using groups to organize human attendance

Contact