Revolgy blog

How to make CRM speak the natural language?

Written by Martin Růžička | July 29, 2021

One of our clients approached us with a challenging task - help us to design a virtual agent being able to manage order systems using a chatbot. The main purpose of this project was to make their customer support more efficient and save unnecessary time for their real agents.

 

Build natural experiences with Dialogflow

The very first choice fell on Dialogflow which is a natural language understanding platform that makes it easy to design and integrate a conversational user interface into your mobile app, web application, device, bot, interactive voice response system, and so on. Using Dialogflow, you can provide new and engaging ways for users to interact with your product. Dialogflow is part of Google Cloud and uses its AI, which we really like.

As the second important step  we had to choose between editions Dialogflow Essentials (ES) or Customer Experience (CX).

One of the requirements was to be able to create and integrate more user stories in the future so the agents will get more complex in the future.  This led us to choose the CX option, which can abstract whole flows into smaller blocks (called sub-flows and pages). These blocks can be maintained separately so more people can work on the project. CX edition also provides diagram visualization into 2D diagrams which makes the flow more understandable.

 

Webhooks services as connector with external systems

The Important requirements for chatbots were to authorize users, and manage their products orders, including creation, listings and cancellations. These operations are performed in the customer’s CRM system.

You can integrate any external system by using Webhooks.

Webhooks are services that host your business logic. During a session, webhooks allow you to use the data extracted by Dialogflow’s natural language processing to generate dynamic responses, validate collected data, or trigger actions on the backend. A webhook can be written in Python and Node.js. It can be held in cloud servers like Google Cloud Platform, Heroku, AWS and local servers.

Dialogflow CX lets us use webhooks in almost every part of the flow. So we can for example trigger webhook in these scenarios:

  • Entering fulfilment

  • Taking a specific route in the flow

  • Setting a parameter

These possibilities allow us to validate data, retrieve orders, or send new orders to an external CRM system.

Easiest way to take advantage of Webhooks is to use Google Cloud Function, which is natively supported by Dialogflow. If we create them inside the same GCP project, Webhook calls are authorized by default service account.

 

Code

index.js

package.js

Based on https://cloud.google.com/dialogflow/cx/docs/reference/rpc/google.cloud.dialogflow.cx.v3#webhookresponse

Companies that use their custom CRM might consider to implement Dialogflow client library. This will give you the possibility to directly connect from CRM to Dialogflow and develop more complex scenarios.

Create your own chatbot today

Dialogflow is a powerful platform yet easy to maintain. It has extensive documentation on how you can use the platform, easy to find on Google Cloud website. If you just want to try to create a first chatbot, I suggest you start with Dialogflow ES. For more complex and custom solutions use the CX version as we did. Don’t wait for approval,  create your first chatbot today and let me know if you have any questions I can help you with.

Cheers, Martin.

 

FAQs

Q1: What is Google’s Dialogflow platform used for?

Dialogflow is a natural language understanding platform that makes it easy to design and integrate a conversational user interface, such as a chatbot, into a mobile app, web application, device, bot, or interactive voice response system.

Q2: What are the key differences between Dialogflow CX and Dialogflow ES that led to CX being chosen for this project?

Dialogflow CX was chosen because of the requirement to create more complex user stories in the future. The CX edition can abstract entire flows into smaller, separately maintainable blocks called sub-flows and pages, which allows more people to work on the project. It also provides 2D diagram visualizations that make the flow more understandable.

Q3: How can a Dialogflow agent interact with external systems, such as a customer’s CRM?

A Dialogflow agent can integrate with any external system by using Webhooks. These services host the business logic and can be triggered during a session to perform actions like authorizing users or managing product orders in a CRM system.

Q4: What role do webhooks play in a Dialogflow project?

Webhooks allow you to use the data extracted by Dialogflow’s natural language processing to generate dynamic responses, validate collected data, or trigger actions on a backend system. For example, they can be used to validate user data, retrieve existing orders, or send new orders to an external CRM.

Q5: What is the recommended and easiest way to implement webhooks for Dialogflow?

The easiest way to use webhooks is to implement them with Google Cloud Functions, which are natively supported by Dialogflow. When the Cloud Function is created within the same GCP project as Dialogflow, the webhook calls are automatically authorized by the default service account.

Q6: For more advanced scenarios, how can a custom CRM connect directly with Dialogflow?

Companies using their own custom CRM can implement the Dialogflow client library. This gives them the ability to connect directly from their CRM to Dialogflow and develop more complex scenarios.

Q7: Which version of Dialogflow is recommended for beginners?

To try creating a first chatbot, it is suggested to start with Dialogflow ES. For more complex and custom solutions, the CX version should be used.