|

|  How to Integrate Google Dialogflow with Intercom

How to Integrate Google Dialogflow with Intercom

January 24, 2025

Learn to seamlessly integrate Google Dialogflow with Intercom for enhanced customer interactions. Boost your support and engage more effectively.

How to Connect Google Dialogflow to Intercom: a Simple Guide

 

Prerequisites

 

  • Ensure you have a Google Cloud Platform account with Dialogflow enabled.
  •  

  • Create a Dialogflow agent and set up intents and entities according to your needs.
  •  

  • Ensure you have an Intercom account and access to the Intercom developer hub.

 

Configuring Dialogflow

 

  • Go to the Dialogflow console and navigate to the Integrations tab.
  •  

  • Enable the Webhook integration within your Dialogflow agent settings. This allows Dialogflow to send information to external URLs.
  •  

  • Create a custom Webhook URL using a cloud function or a server endpoint to handle Dialogflow’s requests.

 

Creating a Webhook

 

  • Set up a server using Node.js, Python, or any preferred language to handle incoming Dialogflow webhook requests.
  •  

  • Ensure your server can parse JSON requests and respond with JSON formatted responses.
  •  

  • Example Node.js server setup:
  •  

    const express = require('express');
    const bodyParser = require('body-parser');
    
    const app = express();
    app.use(bodyParser.json());
    
    app.post('/webhook', (req, res) => {
        const intent = req.body.queryResult.intent.displayName;
        let response = { fulfillmentText: "Default response" };
        
        if (intent === 'YourIntentName') {
            response.fulfillmentText = "Custom response for intent";
        }
    
        res.json(response);
    });
    
    app.listen(process.env.PORT || 3000, () => {
        console.log('Server is running');
    });
    

 

Connect Webhook to Dialogflow

 

  • In the Dialogflow console, navigate to Fulfillment, enable Webhook, and input your server’s webhook URL.
  •  

  • Ensure that your server is publicly accessible and using HTTPS for secure communication.

 

Setting Up Intercom

 

  • Log in to your Intercom account and navigate to the Developer Hub.
  •  

  • Create a new app and note down the app ID and app secret, which will be used to authenticate your integration.
  •  

  • Enable the "Incoming" and "Outgoing" Webhooks in Intercom if needed, for further customization and interaction.

 

Integrating with Intercom

 

  • In your server handling the Dialogflow webhook, implement a function to send messages to Intercom using their API.
  •  

  • Use the Intercom Node.js library or directly make HTTP requests to Intercom's API.
  •  

  • Example Intercom API call:
  •  

    const axios = require('axios');
    
    function sendMessageToIntercom(userId, message) {
        return axios.post(`https://api.intercom.io/messages`, {
            message_type: "inapp",
            body: message,
            from: { type: "user", user_id: userId }
        }, {
            headers: {
                'Authorization': `Bearer YOUR_ACCESS_TOKEN`,
                'Accept': 'application/json',
                'Content-Type': 'application/json'
            }
        });
    }
    

 

Testing the Integration

 

  • Interact with your Dialogflow agent through Intercom chat, ensuring intents trigger correctly and responses are sent back effectively.
  •  

  • Monitor both systems for logs and errors to ensure the webhook is functioning correctly and sending necessary data between systems.

 

Finalizing and Deploying

 

  • Confirm that your server is stable and can handle scaling based on expected traffic.
  •  

  • Deploy your server solution to a robust cloud service to ensure maximum uptime for your Dialogflow-Intercom integration.

 

Omi Necklace

The #1 Open Source AI necklace: Experiment with how you capture and manage conversations.

Build and test with your own Omi Dev Kit 2.

How to Use Google Dialogflow with Intercom: Usecases

 

Integrating Google Dialogflow with Intercom for Enhanced Customer Support

 

  • Objective Verification:  Integrating Google Dialogflow with Intercom can automate customer interactions, reduce response times, and enhance the customer support experience.
  •  

  • Seamless Conversation Flow:  By connecting Dialogflow's natural language processing capabilities with Intercom's chat platform, customers can interact with automated agents. This helps ensure that common queries are handled promptly, enabling human agents to focus on complex issues.
  •  

  • Get Started with Google Dialogflow:  Create a Dialogflow project to define intents and entities that capture a wide range of customer interactions.
  •  

  • Link Dialogflow to Intercom:  Use the Intercom API to connect Dialogflow. Set up webhooks to allow Dialogflow to process and respond to Intercom conversations automatically.
  •  

 

{
  "webhookUrl": "https://yourserver.com/dialogflow-webhook",
  "languageCode": "en"
}

 

  • Custom Responses:  Program custom responses in Dialogflow for typical customer inquiries, allowing quick resolutions to frequently asked questions.
  •  

  • Fallback Intent Handling:  Implement fallback intents in Dialogflow to ensure that if an inquiry cannot be handled automatically, it is seamlessly transferred to a human agent in Intercom.
  •  

  • Data Collection & Analysis:  Use analytics to measure interaction success rates. Adjust conversation design and agent responses to improve overall performance.
  •  

  • Continuous Learning:  Update intent and entity definitions based on new common inquiries and conversation patterns, improving the AI's coverage over time.

 

 

Streamlining Customer Feedback with Google Dialogflow and Intercom

 

  • Enhancing Feedback Collection:  By leveraging Google Dialogflow and Intercom, companies can automate the process of gathering customer feedback in real-time, allowing for more immediate insights and actionable data.
  •  

  • Automated Survey Deployment:  Utilize Dialogflow's intent recognition to trigger surveys based on specific customer interactions, ensuring feedback is timely and relevant.
  •  

  • Building the Dialogflow Agent:  Set up a Dialogflow agent that can understand and collect various types of feedback, such as satisfaction ratings or suggestions for improvement.
  •  

  • Connecting Dialogflow with Intercom:  Integrate Dialogflow with Intercom using API calls to allow customers to submit feedback directly through the chat interface seamlessly.
  •  

 

{
  "feedbackTrigger": "intent",
  "surveyUrl": "https://yourserver.com/dialogflow-survey"
}

 

  • Understanding User Sentiment:  Implement sentiment analysis within Dialogflow to categorize feedback as positive, neutral, or negative, allowing for tailored follow-up actions.
  •  

  • Escalation of Negative Feedback:  Automatically route negative feedback to a human support representative in Intercom to address the issues more effectively and personally.
  •  

  • Data-Driven Insights:  Analyze collected feedback to identify trends or common issues that can inform product development and improve customer satisfaction.
  •  

  • Continuous Improvement:  Use the feedback data to refine Dialogflow intents and responses, ensuring a more effective interaction over time as customer needs evolve.

 

Omi App

Fully Open-Source AI wearable app: build and use reminders, meeting summaries, task suggestions and more. All in one simple app.

Github →

Order Friend Dev Kit

Open-source AI wearable
Build using the power of recall

Order Now

Troubleshooting Google Dialogflow and Intercom Integration

How to connect Google Dialogflow to Intercom?

 

Connect Dialogflow to Intercom

 

  • Create a Google Dialogflow agent if you haven't done so. Note your project's JSON credentials as they'll be needed later.
  •  

  • Log in to Intercom and navigate to the Developer Hub to create a new app. Capture your App ID and access token, which will be necessary to authenticate requests.
  •  

  • Use a middleware like Firebase Functions or Express.js to manage communication between Dialogflow and Intercom. In your middleware, implement REST APIs to handle incoming messages.

 

const express = require('express');
const bodyParser = require('body-parser');
const {WebhookClient} = require('dialogflow-fulfillment');
const app = express();
const port = 8080;
app.use(bodyParser.json());

app.post('/webhook', (req, res) => {
  const agent = new WebhookClient({ request: req, response: res });
  let intentMap = new Map();
  intentMap.set('YourIntentName', yourFunctionHandler);
  agent.handleRequest(intentMap);
});

function yourFunctionHandler(agent) {
  // Custom logic to process the intent
}
app.listen(port);

 

  • Link your middleware to your Dialogflow agent by setting the webhook URL to point to your server's endpoint.
  •  

  • Ensure your middleware also communicates with Intercom's API using the access token, redirecting Dialogflow's responses to Intercom.

 

const axios = require('axios');
function sendMessageToIntercom(message) {
  axios.post('https://api.intercom.io/messages', {
    from: { type: 'user', email: 'example@example.com' },
    body: message
  }, {
    headers: {
      'Authorization': `Bearer YOUR_ACCESS_TOKEN`,
      'Content-Type': 'application/json'
    }
  });
}

Why isn't my Dialogflow bot responding in Intercom?

 

Check Integration

 

  • Ensure your Dialogflow bot is properly integrated with Intercom by reviewing the configuration settings in both platforms.
  •  

  • Verify that the correct API keys or credentials are in place for authentication between Dialogflow and Intercom.

 

Review Intent and Fulfillment

 

  • Check if the intents in Dialogflow are correctly set up to respond to the specific inputs from Intercom.
  •  

  • Ensure fulfillment is enabled if your bot requires a webhook or API response.

 

Test Connection

 

  • Use Intercom’s test chat feature to see if the bot initiates a session and responds appropriately.
  •  

  • Test the Dialogflow agent directly via the Dialogflow console to rule out agent-level issues.

 

Check Logs

 

  • Examine logs in both Dialogflow and Intercom for errors or warnings that indicate any connectivity or processing issues.

 

Update and Debug

 

  • Consider updating the integration or API versions if there are known bugs or deprecated features.
  •  

  • Debug by checking if request and response payloads are correctly formatted and consistent with expected API specifications.

 

{
  "queryInput": {
    "text": {
      "text": "Hello",
      "languageCode": "en"
    }
  }
}  

 

How to pass user information from Intercom to Dialogflow?

 

Integrate Intercom with Dialogflow

 

  • Begin by ensuring you have admin access to both Intercom and Dialogflow accounts.
  •  

  • Use the Intercom API to retrieve user data. It's recommended to authenticate via OAuth for security:

 

curl https://api.intercom.io/users \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN'

 

  • In Dialogflow, enable fulfillment and the Webhook option to receive user data from Intercom.
  •  

  • Create a webhook endpoint to process the received user information. This endpoint will need to structure the data in a format Dialogflow can understand:

 

{
  "session": "projects/project-id/agent/sessions/session-id",
  "queryInput": {
    "text": {
      "text": "User data here",
      "languageCode": "en-US"
    }
  }
}

 

  • Ensure data sent to Dialogflow is concise and relevant. Avoid sending large payloads that might slow down response times.
  •  

  • Test the integration thoroughly, ensuring accuracy and data is securely transmitted and processed.

Don’t let questions slow you down—experience true productivity with the AI Necklace. With Omi, you can have the power of AI wherever you go—summarize ideas, get reminders, and prep for your next project effortlessly.

Order Now

Join the #1 open-source AI wearable community

Build faster and better with 3900+ community members on Omi Discord

Participate in hackathons to expand the Omi platform and win prizes

Participate in hackathons to expand the Omi platform and win prizes

Get cash bounties, free Omi devices and priority access by taking part in community activities

Join our Discord → 

OMI NECKLACE + OMI APP
First & only open-source AI wearable platform

a person looks into the phone with an app for AI Necklace, looking at notes Friend AI Wearable recorded a person looks into the phone with an app for AI Necklace, looking at notes Friend AI Wearable recorded
a person looks into the phone with an app for AI Necklace, looking at notes Friend AI Wearable recorded a person looks into the phone with an app for AI Necklace, looking at notes Friend AI Wearable recorded
online meeting with AI Wearable, showcasing how it works and helps online meeting with AI Wearable, showcasing how it works and helps
online meeting with AI Wearable, showcasing how it works and helps online meeting with AI Wearable, showcasing how it works and helps
App for Friend AI Necklace, showing notes and topics AI Necklace recorded App for Friend AI Necklace, showing notes and topics AI Necklace recorded
App for Friend AI Necklace, showing notes and topics AI Necklace recorded App for Friend AI Necklace, showing notes and topics AI Necklace recorded

OMI NECKLACE: DEV KIT
Order your Omi Dev Kit 2 now and create your use cases

Omi Dev Kit 2

Endless customization

OMI DEV KIT 2

$69.99

Make your life more fun with your AI wearable clone. It gives you thoughts, personalized feedback and becomes your second brain to discuss your thoughts and feelings. Available on iOS and Android.

Your Omi will seamlessly sync with your existing omi persona, giving you a full clone of yourself – with limitless potential for use cases:

  • Real-time conversation transcription and processing;
  • Develop your own use cases for fun and productivity;
  • Hundreds of community apps to make use of your Omi Persona and conversations.

Learn more

Omi Dev Kit 2: build at a new level

Key Specs

OMI DEV KIT

OMI DEV KIT 2

Microphone

Yes

Yes

Battery

4 days (250mAH)

2 days (250mAH)

On-board memory (works without phone)

No

Yes

Speaker

No

Yes

Programmable button

No

Yes

Estimated Delivery 

-

1 week

What people say

“Helping with MEMORY,

COMMUNICATION

with business/life partner,

capturing IDEAS, and solving for

a hearing CHALLENGE."

Nathan Sudds

“I wish I had this device

last summer

to RECORD

A CONVERSATION."

Chris Y.

“Fixed my ADHD and

helped me stay

organized."

David Nigh

OMI NECKLACE: DEV KIT
Take your brain to the next level

LATEST NEWS
Follow and be first in the know

Latest news
FOLLOW AND BE FIRST IN THE KNOW

thought to action

team@basedhardware.com

company

careers

events

invest

privacy

products

omi

omi dev kit

personas

resources

apps

bounties

affiliate

docs

github

help