|

|  How to Integrate Google Dialogflow with Salesforce

How to Integrate Google Dialogflow with Salesforce

January 24, 2025

Seamlessly connect Google Dialogflow with Salesforce with our easy-to-follow guide. Empower your customer service with AI-driven solutions today.

How to Connect Google Dialogflow to Salesforce: a Simple Guide

 

Set Up Your Google Cloud Project

 

  • Go to the Google Cloud Console and create a new project.
  •  

  • Navigate to the Dialogflow integration and enable the Dialogflow API.
  •  

  • Create a service account for authentication purposes, ensuring you assign the Dialogflow API Admin role.
  •  

  • Download the JSON key file for the newly created service account. This file will be used for authenticating the Dialogflow requests.

 

Create Your Dialogflow Agent

 

  • Visit the Dialogflow Console, sign in with your Google account, and create a new agent.
  •  

  • Connect your Dialogflow agent to your Google Cloud project, using the GCP Project ID.

 

Set Up Salesforce

 

  • Sign in to Salesforce and navigate to Setup.
  •  

  • Search for 'Sites' and create a new site, ensuring the site is active.
  •  

  • Within your site, create a new Public Access Settings profile and allow API access. Make sure the necessary objects and fields are accessible.

 

Build the Integration Logic

 

  • Create an Apex class in Salesforce that will handle the HTTP requests from Dialogflow.
  •  

  • Use the following sample code to construct an endpoint in Salesforce that will communicate with Dialogflow:

 

@RestResource(urlMapping='/dialogflow/*')
global with sharing class DialogflowIntegration {

    @HttpPost
    global static void doPost() {
        RestRequest req = RestContext.request;
        RestResponse res = RestContext.response;

        // Read request body
        String requestBody = req.requestBody.toString();

        // Process Dialogflow request and create response
        Map<String, Object> response = new Map<String, Object>();
        response.put('fulfillmentText', 'Response from Salesforce');

        res.responseBody = Blob.valueOf(JSON.serialize(response));
    }
}

 

  • Ensure you replace 'Response from Salesforce' with your desired text.
  •  

  • Deploy the Apex class and publish the site, generating a public URL for Dialogflow to call.

 

Connect Dialogflow to Salesforce

 

  • In your Dialogflow console, navigate to Fulfillment and enable Webhook.
  •  

  • Input the Salesforce site URL generated in the previous step as the Webhook URL.
  •  

  • Deploy and apply changes to allow Dialogflow to call this endpoint during conversation intents.

 

Test Your Integration

 

  • Simulate a conversation in the Dialogflow simulator to test the integration.
  •  

  • Ensure that Dialogflow can correctly invoke the Salesforce webhook and return the expected responses.

 

Handle Authentication and Security

 

  • Ensure HTTPS is enabled for communication between Dialogflow and Salesforce, maintaining data security.
  •  

  • Set up OAuth 2.0 credentials if handling more extensive data or when working with sensitive integrations.

 

Deploy and Monitor the Integration

 

  • Continue testing conversations and monitor logs to catch and fix any potential errors.
  •  

  • Regularly update permissions and roles to maintain security best practices.

 

Omi Necklace

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

Build and test with your own Omi.

How to Use Google Dialogflow with Salesforce: Usecases

 

Customer Support Automation with Google Dialogflow and Salesforce

 

  • Integrate Google Dialogflow to create a conversational interface for customer queries. This virtual assistant will handle common inquiries efficiently.
  •  

  • Utilize Salesforce's CRM capabilities to store and retrieve detailed customer information, ensuring personalized interactions.
  •  

  • Map Dialogflow intents to Salesforce actions. For example, when a customer asks about their order status, Dialogflow triggers a Salesforce function to retrieve and present the relevant information.
  •  

  • Employ Webhook integration, allowing Dialogflow to send data directly to Salesforce. This facilitates real-time communication between both platforms.
  •  

  • Set up fulfillment in Dialogflow, which executes backend logic such as updating Salesforce records based on conversations, thereby automating redundant tasks.
  •  

  • Leverage Salesforce reports to analyze trends in customer interactions captured by Dialogflow, enabling data-driven decisions and enhancements in customer service strategies.

 


// Example payload sent from Dialogflow to Salesforce
{
  "sessionId": "12345",
  "queryResult": {
    "action": "getOrderStatus",
    "parameters": {
      "orderNumber": "ABCD1234"
    }
  }
}

 

 

Lead Qualification Enhancement with Google Dialogflow and Salesforce

 

  • Deploy Google Dialogflow as a virtual assistant on your website to engage visitors in real-time, efficiently capturing their contact details and initial inquiries.
  •  

  • Integrate Salesforce with Dialogflow to ensure that collected lead data is automatically stored and organized within Salesforce CRM.
  •  

  • Configure Dialogflow to route different types of leads to appropriate sales teams based on the conversation context and predefined criteria.
  •  

  • Utilize Dialogflow fulfillment to trigger Salesforce workflows, such as sending automatic follow-up emails or setting reminders for sales representatives.
  •  

  • Implement a Webhook integration that allows Dialogflow to update Salesforce with additional information when a lead revisits and provides further details or updates their inquiry.
  •  

  • Employ Salesforce's reporting and analytics features to assess the quality and outcome of leads generated via Dialogflow, allowing adjustments in lead generation strategies.

 


// Example data transformation sent from Dialogflow to Salesforce
{
  "leadId": "001xx000003DGbP",
  "queryResult": {
    "action": "qualifyLead",
    "parameters": {
      "interestLevel": "high",
      "productOfInterest": "CRM Software"
    }
  }
}

 

Omi App

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

Github →

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