Articles on: Developers

How yo create an AI chatbot with Dialogflow

Learn how to connect Dialogflow with Crisp to build a custom AI chatbot integration.


This guide is intended for teams that want to maintain their own Dialogflow-based bot and connect it to Crisp through the Crisp APIs. If you want a native Crisp AI support agent instead, start with Hugo.



Before you start


Dialogflow is a Google platform for building conversational agents. In this setup, Dialogflow handles intent detection, while Crisp receives the visitor messages and sends the bot replies back to the conversation.


You will need:

  • A Crisp workspace with access to API credentials
  • A Dialogflow agent with at least one intent
  • A backend environment where you can run the connector code
  • Basic familiarity with Node.js and environment variables


Keep your Crisp API credentials and Google service account file private. They should only be used from your backend, never from frontend code.



Understand the integration flow


A Dialogflow bot is organized around an agent. When a visitor sends a message, Dialogflow matches that message against an intent, extracts useful parameters if needed, then returns a response or calls your fulfillment code.


Dialogflow request flow


With Crisp in the middle, the flow usually looks like this:


  1. A visitor sends a message through the Crisp chatbox.
  2. Your backend receives the message through the Crisp RTM API.
  3. Your backend sends the message to Dialogflow.
  4. Dialogflow returns the matched intent response.
  5. Your backend sends the response back to Crisp through the REST API.



Create a Dialogflow agent and intent


Go to Dialogflow and create an agent if you do not already have one.


Create the agent


  1. Sign in to Dialogflow.
  2. Click Create new agent in the left navigation.
  3. Choose a name, default language, and Google Cloud project.
  4. Click Create.


Create a first intent


For a quick test, create a simple ping-pong intent.


  1. Open the Intents section.
  2. Click Create intent.
  3. Add ping as a training phrase.
  4. Add pong as the response.
  5. Click Save.


Dialogflow intent configuration


Test the intent


Use the Try it now panel in Dialogflow and send ping. Dialogflow should return pong as the response.


Dialogflow test response



Get your Dialogflow API credentials


Your backend needs Google credentials to call Dialogflow.


  1. Follow Google's service account guide: Create service account credentials.
  2. Add the Dialogflow API Client role to the service account.
  3. Download the credentials file in JSON format.
  4. Store that file securely on your backend host.



Connect Dialogflow to Crisp


You can use Crisp's Dialogflow example repository as a starting point, then adapt it to your own bot logic.


  1. Clone the example repository: crisp-im/crisp-dialogflow.
  2. Install the dependencies with npm install.
  3. Create your Crisp API credentials from the REST API authentication guide.
  4. Add your Crisp credentials to the project fields: crispIdentifier and crispKey.
  5. Add your Dialogflow project ID in dialogflowProjectId.
  6. Set the Google credentials environment variable.
  7. Run the connector from the project root with node lib/index.js.


Environment variable examples:

  • macOS or Linuxexport GOOGLE_APPLICATION_CREDENTIALS=PATH_TO_KEY_FILE.json
  • Windows PowerShell$env:GOOGLE_APPLICATION_CREDENTIALS="KEY_PATH"


Once the connector is running, open your Crisp chatbox as a visitor and send ping. If everything is configured correctly, your bot should reply with pong.



Where to go next


After the ping-pong test works, replace the example intent with the intents your customers actually need. You can also add fulfillment logic if Dialogflow needs to call your own backend before replying.


Useful resources:


Updated on: 03/05/2026

Was this article helpful?

Share your feedback

Cancel

Thank you!