Freshchat Workers

Type: Freshchat Worker

A Freshchat worker will route a conversation to a live agent in Freshchat. A Freshchat worker can be created through the CLI.

Note: Freshchat workers cannot be interacted with directly by users, they must be transferred to via another worker first, for example a flow worker using pushBotToStack.


A Secret (of type secret) containing a Freshchat API key is required in order to access Freshchat. Please see secrets for more information on creating a secret.

The value of the secret can be found in the admin portal of Freshchat, on the API Key page. You can create one if one does not already exist.

API token

Freshchat Webhook

You must enable and configure Freshchat with a webhook to Hookit2Me prior to being able to use the worker. In the Freshchat admin portal, navigate to webhook settings. Enable the webhook if it is not already, and set it to the public hookit2me url for the region you worker will be in. Note the RSA key down for later use.


Worker configuration

Below is an example of a Freshchat worker in json, ready to be created with the CLI.

  "Data": {
    "Url": "",
    "AuthKeySecret": "srn:vault::my-org:secret:freshchatkey",
    "AppId": "12345678-1234-1234-1234-123456789012",
    "ChannelId": "12345678-1234-1234-1234-123456789012",
    "PublicKey": "-----BEGIN RSA PUBLIC KEY-----someRSAkey-----END RSA PUBLIC KEY-----",
    "Events": {
      "OnDisconnection": [
          "type": "content",
          "value": "FreshChatDisconnection"
      "OnResolution": [
          "type": "markup",
          "value": "<TimelineMessage minimumDisplayTime='1.5'><TextMsg>OnEventMarkup - Conversation has been resolved, disconnecting from live chat.</TextMsg></TimelineMessage>"
      "OnError": [
          "type": "message",
          "value": "OnEventMessage - Something has gone wrong with your freshchat conversation"
      "OnTransfer": [
          "type": "content",
          "value": "FreshChatTransfer"
      "OnTransferFailure": [
          "type": "content",
          "value": "FreshChatTransferFailure"
  "Organization": "my-org",
  "Config": {},
  "Enabled": true,
  "Description": "My Freshchat worker",
  "Type": "freshchat-worker",
  "Name": "myFreshWorker",

Within the Data object, there are several Freshchat-specific fields that need to be filled out.

  • Url: This is the base URL of Freshchat.
  • AuthKeySecret: This is the srn of the secret you created earlier with the Freshchat API key.
  • PublicKey This is the RSA Public key for the webhook configured earlier. Note there should not be newlines in the string.
  • AppId: This is an app specific Id for your Freshchat instance which you can find under account settings > integration settings. AppId
  • ChannelId: This the Freshchat channel_id of the topic you wish to use. Details on what this is used for an how it is obtained can be found here
  • Events see the events section below

Ending the chat

To end a conversation with a user from the Freshchat agent side, resolving the conversation will remove the user from it and let them know it was resolved. Users can also end the conversation by typing /leave, which will result in the conversation resolving in the Freshchat interface as well.


Events are ways to customize the hardcoded messages inside the worker. If any the below are missing from the Events object they will use the default ones. If you don’t want any message not show then you can place an empty array []

Below are a list of each event and when its triggered

  • OnError - when an error occurs while talking to an agent
  • OnResolution - when the agent has closed the chat
  • OnTransfer - when we are in the process of transferring you to an agent
  • OnTransferFailure - when the transfer to an agent fails
  • OnDisconnection - When the user disconnects

Any botnet action is support here. If any onEvent is not set then a default will be sent out