Dialogflow CX

Connecting Dialogflow CX to Baat

Updated 14 November 2026

If you have built a bot in Google Dialogflow CX, you can connect it to Baat. Baat then sends your customers’ WhatsApp messages to the bot and sends its replies back, and your team can take over in the Inbox at any time.

Only the account owner can connect or disconnect an integration.

What you need

  • A Google Cloud project with the Dialogflow API enabled

  • A Dialogflow CX agent in that project

  • A service account that can call the agent, with a JSON key

Step 1: Enable the Dialogflow API

  • In the Google Cloud Console, open your project

  • Go to APIs & Services → Library, search for Dialogflow API, and click Enable

Step 2: Create a service account and key

  • Go to IAM & Admin → Service Accounts and click Create Service Account. Name it, for example, baat-dialogflow

  • Give it the Dialogflow API Client role, which lets it talk to your agent

  • Open the service account, go to Keys, and click Add Key → Create new key → JSON. A .json file downloads

Keep this file private. Anyone who has it can use your agent.

Step 3: Find your agent’s details

ValueWhere to find it
Project IDAt the top of the Google Cloud Console, or as project_id in the JSON key
RegionThe location you chose when you created the agent, such as asia-south1 or global
Agent IDIn the Dialogflow CX console, open the agent’s settings. It is a long ID such as a1b2c3d4-e5f6-…, not the agent’s name

Step 4: Connect in Baat

  • Go to Settings → Integrations and click Connect on the Dialogflow CX card. The setup page opens

  • Under Shared connection, fill in Project ID, Region and Language, and paste the whole JSON key into Service account JSON

  • Under Live agent, enter the Agent ID

  • Click Save

Baat shows “Plugin configured successfully!” and the card shows Connected. Baat does not test the details when you save, so test the agent next.

Language: Baat currently sends every message to your agent in English (en-US), whatever you choose under Language. Make sure your agent supports en-US.

Step 5: Test with a staging agent

You can try a second agent on a few phone numbers before your customers see it:

  • Turn on Staging agent

  • In Phone allowlist, enter the numbers that should talk to the staging agent

  • Enter the staging agent’s Agent ID. If it is in a different project, also fill in its Project ID and Service account JSON

  • Click Save

Messages from the listed numbers go to the staging agent. Everyone else still gets the live agent. If you turn off Live agent, only the listed numbers get answers.

Then send a WhatsApp message to your business number from a test phone. The message and the agent’s reply both appear in your Inbox.

Which messages go to your agent

Baat sends a customer’s message to your agent when all of these are true:

  • Enable Bot is on, on the Dialogflow CX setup page

  • The message is text, a button or list reply, an image, an order, or a submitted WhatsApp Flow. Locations, audio, video and documents are not sent

  • No team member has replied in that conversation since the bot was last turned on for it

  • No Baat chatbot or journey is waiting for this customer’s reply

Handing over to your team

When a team member replies in a conversation, the bot stops answering in it, so the customer is never talking to both. It stays off for that customer until someone turns it back on: open the ⋯ menu in the conversation header and click Turn the bot on.

How replies are sent

  • Baat uses the customer’s Baat conversation as the Dialogflow session, so the agent remembers the conversation from one message to the next

  • Each turn also carries the session parameters conversation_id, merchant_id and contact_phone

  • Text responses are sent as WhatsApp text messages, in order, about one second apart

  • For buttons, lists, links and Flows, use a custom payload. See Sending interactive WhatsApp messages from Dialogflow CX

If the agent does not reply

  • Check that it is switched on. Enable Bot and Live agent must be on, or Staging agent with your number in the allowlist

  • Check the details. Project ID, Region, Agent ID and the JSON key must all belong to the same agent

  • Check for a team reply. If someone on your team has replied in the conversation, the bot stays off for that customer until it is turned back on from the conversation’s ⋯ menu

  • Test in Dialogflow. In the Dialogflow CX console, open Test Agent and send the same message in en-US. If no route matches and there is no fallback response, the agent has nothing to send

If Dialogflow returns an error, Baat sends no reply and shows no error in the Inbox.

Disconnecting

Go to Settings → Integrations and click the red Disconnect icon on the Dialogflow CX card, then confirm. Baat stops sending messages to your agent and removes the saved details. To connect again, enter the details again.

Disconnecting does not delete your agent or service account. You can delete the JSON key in Google Cloud afterwards.

Related reading

Where this fits in the wider picture.

Need a hand?

Our team answers on WhatsApp, usually within a business day.

Contact support Book a demo