How to make Chatfuel smarter with Dialogflow

Enhance your Chatfuel bot with conversational AI from Google.

Josh Barkin
Mar 4, 2018 · 7 min read

Chatfuel makes it easy to create an automated conversational experience for Facebook Messenger. In just a few minutes and without any technical knowledge, you can create and add a bot to Facebook. Training your Chatfuel bot to be responsive to free-form user messages is much harder though, and you’ll need your bot to handle free-form messages if you want to retain your messaging users.

With Dialogflow connected to Chatfuel, you can understand the intent and context of a user’s message and respond with the right block.

While Chatfuel’s strength lies in its intuitive web-based tools to create Messenger apps, Dialogflow’s strength lies in its natural language processing (NLP), artificial intelligence used to understand human intent and respond intelligently. Janis enables brands and agencies serious about messaging automation to think less about the technology and focus more on producing measurable business results. We built Janis to help bot makers build and manage the perfect bot stack and a winning combination is to use Chatfuel for your UI and Dialogflow for your AI.

A Dialogflow intent captures the phrases people say, the context in which they say them, and the actions, or events that should be triggered in your response. In short, an intent is what Dialogflow uses to understand messages received by your bot and how you’ll respond.

Getting started with Dialogflow for Chatfuel

Before you connect a Dialogflow AI agent to Chatfuel so your bot can be more responsive to the messages it receives from users, head over to Dialogflow , sign-in with your Google account, and create a AI agent.

You just need to give your agent a name and save it.

Now that you’ve created an AI agent, you’ll need to connect it to Chatfuel.

Step 1: Get Janis

Janis allows you to connect and manage your AI from Slack, a popular workspace used by millions of teams. When you add Janis to Slack, you can connect a Dialogflow AI agent to Janis and connect a Chatfuel bot to Janis in a few simple steps. It takes just minutes to complete the setup and begins working immediately.

Janis will give you a unique Client Key that you’ll want to add to a JSON API in your Chatfuel bot. You can do a custom integration to set up a JSON API, or you can use the Janis AI Starter Kit, which includes a Chatfuel template and you just need to drop the Janis Key into the URL.

To test your integration, Make sure that Report errors in the bot is unchecked. Click the Test the Request button and look for a status of 200 OK

Send your bot a message you know it won’t understand and you’ll get a 🙊 No Response alert from Janis too which indicates your connection is working.

Working With Janis

Now that you’ve connected Dialogflow and Chatfuel to Janis, you’ll want to start training your AI. Just say Train to Janis, and Janis will open an AI training channel for you.

Working in Slack, you can quickly create Dialogflow intents and a variety of response types. Janis supports all response types from Dialogflow including text, images, cards, quick replies, and custom payloads and can render these in your Chatfuel experience. Want to use Dialogflow to understand intent, but respond with a Chatfuel block? No problem. If you use the Dialogflow interface you can create a block redirect as a response but you would have to write some code and the process is cumbersome.

GIF loading…

Training in Slack like this means powerful AI from Google becomes more accessible to non-technical team members. You can even invite others on your team to train AI, collaborate with clients and partners without ever giving access to your Chatfuel bot, or your Dialogflow account!

Disable “Setup AI” in Chatfuel

You’ll want to avoid using Chatfuel Keyword Rules (AI) if you’re using Dialogflow because if you use both at the same, this will create conflicts in your conversational experience. Users will send your bot messages, but if you have a keyword in Chatfuel and have responses in Dialogflow, then you may end up delivering two responses to your user.

Pro features

In the Janis Free plan, your bot will alert you every time your bot has no response. Pro users can benefit from even more of Janis’ powerful capabilities!

Say Connect Facebook to Janis and connect Janis to the same Facebook page as your Chatfuel bot and activate more alerts:

🙊No Response: When your user hits your default message in Chatfuel, Janis will alert you in Slack so you can identify bottlenecks in your conversational experience (Free)

😱 Sentiment Alerts: Janis will monitor conversations with your Chatfuel bot and if Janis detects negative sentiment (your users are angry, or frustrated with your bot) Janis will alert you immediately. (Pro)

💁 Help: Janis listens for words like “help”, “human”, “agent”, “start chat”, “operator” and “assistance”, and alerts you when it detects any of these user inputs. You can add any of these keywords into your Chatfuel blocks, or just wait for your user to include them in their free form messages and Janis will alert you. (Pro)

🔔 Custom Alerts: You can add your own alerts to any Dialogflow intent, and Janis will alert you. This opens up infinite possibilities. Let’s say you want to get alerts when your bot detects a warm sales lead. You can create alerts for these intents and then act on alerts immediately without leaving Slack.(Pro)

Acting On Alerts

Pro Users also get more details in each alert so you can fix many problems without even leaving Slack. Pro alerts include not only who sent the message, and what they said to produce the alert, but Janis will transcribe your Messenger conversation entirely in Slack.

Human Take Over

If you’ve been using any of the Live Chat plugins available through Chatfuel, then you know they have limitations. When Janis alerts you that a human wants to chat, just start typing and Janis will automatically pause your AI responses from Dialogflow and send your messages to your users.

Here is what it looks like from your user’s perspective in Messenger:

With Human Takeover from Janis, you can also manually push AI responses you’ve saved in Dialogflow. We call this Co-Pilot mode and it’s really productive when you can respond live and use saved responses.

Training Dialogflow from your chat transcripts

While the free connection to Dialogflow includes free training tools built right into Slack so you can quickly add what users say and test out your responses, Janis Pro users can train directly from messaging transcripts. When you get an alert, open the transcript, and click to view Janis’ reply to each user message received.

Training Dialogflow directly from a messaging transcript is not only more productive because you have the complete context needed to make automation decisions, but you can maximize live chat time by training AI to learn from your human-powered conversations.

Share data between systems

Once you become comfortable with key Dialogflow concepts like context and entities, you’ll discover that the free connection is really quite powerful and you can share data between systems. You can pass User Attributes from Chatfuel to Dialogflow and Dialogflow parameters are automatically passed back to Chatfuel and saved as User Attributes. We’ve also created a number of custom user attributes you can use to communicate with Dialogflow so you can set and control context from your Chatfuel blocks.

Achieve your messaging goals

Enabling a truly delightful conversational experience should be your goal, but it will take some time to get there, so be patient, and while your users may not be as patient for AI to learn and your bot to improve, make sure you’re able to be responsive to alerts and act fast. You’ll be more hands-on at first, but over time, you’ll find yourself getting fewer alerts, while your AI-powered bot will become more responsive.

We’ve created a complete guide for working with Chatfuel and Dialogflow, with tips and tricks, videos and links to more tutorials!

Being Janis

Stories from the humans behind