When you use Freshchat as your customer-facing widget, your customer will first see Topics. Topics are specific messaging channels that your customers can use to connect to your team. Depending on the Topic, you can offer specific support. If you’re using bots, you can trigger a different bot flow for each Topic. If you have multiple Whatsapp numbers connected to your Freshchat account, you can even set up unique bot flows for each of these numbers.

When you’re using Freshchat BYOB, you can have only one bot connected to your Freshchat at account at a given point in time. You can build the bot flows for the different topics and Whatsapp numbers in the same bot, and use conditional logic to trigger the relevant bot conversations to your customers.


Setting up the API

  • Add the Authorization Header, as shown below. The Authorization key is “Bearer <API Token>”. To get the API token, open your Freshchat account settings > API Tokens > Generate/Copy an Existing API token.


  • Enter channel_id, as the Required response parameter. This will return the channel ID to your bot, which can then use conditional logic to decide which bot flow or Whatsapp number to trigger.

Setting up the conditional logic

  • When your customer reaches out via the Freshchat widget, the bot will start looking for a matching intent. There can be three ways for this interaction to start:
    • Your customer might start with a greeting, which is then matched with the Hello flow.
    • You can choose to map the conversation (based on the keywords your customers use) to a different intent — such as a flow name of any answers that you've set up.
    • If the bot is unable to match the conversation based on the intent, it will instead trigger the Sorry flow. To make the customer experience is seamless, you can mark the first dialog in the “Sorry” flow private and then connect the “Sorry” flow to the first dialog in the “Hello” flow or to a different flow that you have set up.

  • Open the first dialog in your “Hello” flow and mark it as private.
  • Add a new Action > pick Trigger API > pick the API that you configured earlier. In our example, it was the Fetch source API.

Getting the channel IDs from Freshchat

  • Before configuring the conditional logic for the different Freshchat topics/Whatsapp numbers, you’ll need to get the channel ID associated with each of these topics/Whatsapp numbers. To get this, you can trigger the List All Channels API in an API tool.

Setting up the conditional logic

  • Go back to the bot that you were setting up in Freddy Self-service. Open the flow where you configured the Trigger API action, and switch to the Conditions.
  • Here, you need to configure a condition that will check the channel ID returned by the API call, in our case, the response parameter from the Fetch Source API. 
  • In the Conditions tab, set up a rule so that the bot detects the channel ID or the Topic where the customer has initiated the conversation and trigger the appropriate bot flow. 

  • Once it has the channel ID, it will look for a match with the list of channel IDs from Freshchat . If the channel ID returned from the API call is found to be equal to a channel ID associated with a topic, the condition will route the bot flow to that Topic.

  • In our example, the Freshchat account has two topics: Sales and Support. Based on which Topic the customer initiates a conversation from, the bot will trigger different flows.