FreshWorks (FreshChat)

How to integrate Amio AI chatbot with FreshWorks (FreshChat)



What FreshChat integration with Amio chatbot allows you to do:

  1. Link your Amio chatbot customers to FreshChat
    This allows customers to reach your support team for further assistance when necessary.
  2. Access chatbot conversations with customers directly in FreshChat
    Live agents can view the chat history, enabling them to promptly address customer issues.
  3. Communicate with your customers in real-time from the FreshChat application
    This ensures quick responses, minimizing wait times for your customers.

Set up

To integrate Freshchat to Amio there are several steps to be done:

Step 1- to collect the necessary information needed from the Freshchat interface. The necessary info to be collected: API key, App url, App id.
Step 2 - to get the data from 2 API calls (agent_id, channel_id).
Step 3- run an API request to integrate Freshchat and Amio.

Step 1

API key and App URL

  1. Settings - Admin Settings

  2. In the search find API Setting

  3. From the API settings page copy API key and chat URL

App ID

  1. Settings - Admin Settings

  2. In the search find Web Chat Settings

  3. Go to Integration Settings

  4. Copy App ID

Step 2

To get the values in the second step you need to run 2 endpoints, company_subdomain is equal to the App URL taken in the 1st Step. Authorization Bearer Token - API token taken in the 1st Step.

Agent ID

Run the endpoint and copy the desired agent_id

GET https\://{company_subdomain}.freshchat.com/v2/agents?items_per_page=50

Channel ID

Run the endpoint and copy the desired channel_id

GET https\://{company_subdomain}.freshchat.com/v2/channels?items_per_page=50

Step 3

This is the final step to integrate Freshchats and Amio, to do so you need to run the following endpoint. But before you need to get the id of the Amio channel you want your bot to be connected to.

To find it out, go to https://app.amio.io/administration/channels, find the desired channel and copy the ID


Authorization - you valid token from Amio app. Can be retrieved from the Dev concole.

POST https://api.amio.io/internal/integrations

Body:

{  
                "type": "freshchat",  
                "freshchat_channel_id": "channel ID from Step 2",  
                "freshchat_app_id": "app ID from Step 1",  
                "freshchat_agent_id": "agent ID from Step 2",  
                "freshchat_api_url": "app URL from Step 1",  
                "access_token": "api key from Step 1",  
                "channels": [  
                    {  
                        "id": "amio channel ID from Step 3"  
                    }  
                ]  
                }

Make sure that the response status is 200. After the integration will be created and you will be able to see it under the Integrations tab in the Amio channel used:

Webhooks

Another important settings to be set before the start is the Webhooks.

  1. Go to Settings - Admin Settings
  2. In the search find Conversational Webhooks
  3. Set up the Webhook as https://api.amio.io/webhook/freshchat and Failure notifications email to [email protected]

Amio Chat

Amio Chat is setup as usual - Getting Started - Amio Web Chat.
To add user data to Freshchat, use the setMetadata function. The user data should be defined within the freshchat_user object.

window.amioWebchat.init({
  externalContactId: '<unique user id from your system>'
})

window.amioWebchat.setMetadata({
  freshchat_user: {
    //the fields are optional
    reference_id: '<user id>',
    email: '<user email>',
    first_name: '<user first name>',
    last_name: '<user last name>',
    phone: '<user phone>'
  }
})

📘

The externalContactId in init is optional, use it to make sure the chat history will be the same when the user connects from a different device/browser.