How to make Chatfuel smarter with Dialogflow

Janis makes connecting and managing Dialogflow as easy as Chatfuel makes it to create and manage a Chatbot

Josh Barkin
Mar 4, 2018 · 10 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.

While Chatfuel has “Setup AI” built-in to it’s dashboard, it’s not actually AI. These are keyword triggers, which operate more like rules. For example if a user says only the word “Restart” than you could send them to your Welcome Message block. However, let’s look at a different scenario:

User A says to your bot: I’d like to buy a goat, how much is it?
User B says to your bot: I bought a goat 2 weeks ago. Where is it?
With Chatfuel AI, you won’t know the difference. While in theory you could set up a Chatfuel keyword where a user says something similar to “bought a goat” and “buy a goat”, they mean different things, but in the example above, if you tried to accomplish this with Chatfuel AI, then User B would be a very angry user if you sent them to the same block, as User A. With Dialogflow connected to Chatfuel, you can understand the intent and context of the user’s message and then be able to 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 it’s 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.

The most basic concept Dialogflow concept you should understand is what Dialogflow refers to as Intent. An intent defines 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 what the user intended when they sent you a message and how you’ll respond.

Get a Free AI Agent

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. That’s all.

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

Getting started with Dialogflow for Chatfuel

Now that you have a Dialogflow agent, here is what you’ll need to get it connected to Chatfuel easily:

  1. The Janis Chatfuel Template
  2. Janis added to Slack (to connect and manage your Dialogflow and Chatfuel integration)

Step 1: Add the Janis template to your Dashboard

While you can easily integrate Dialogflow to an existing Chatfuel bot, if you’re new to Dialogflow a great place to start is with the Janis Chatfuel template. You can just go ahead and add that to your Chatfuel dashboard. We’ll come back to that in a minute.

Step 2: Add Janis to Slack

Janis allows you to connect and mange 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 is an AI assistant that works and will walk you through the setup. Choose Dialogflow as your AI source and pick the AI agent you added, and choose Chatfuel as your bot platform. Janis will give you a unique Client Key that you’ll want to add to the JSON API of the Janis Chatfuel template.

🎉Congratulations. Your setup is complete.

To test your integration, send your Chatfuel bot a message you know it won’t understand and you should get a Default Fallback response back from Dialogflow in Messenger (What Chatfuel refers to as a Default Answer).

You should also get an alert in Slack that your bot had no response. Here is a sample “No Response” alert and these are included free when Janis manages your Dialogflow-Chatfuel connection.

Dialogflow templates can help too!

Training AI can take time, so we’ve created pre-built Dialogflow intents, that you can easily import to Dialogflow. The pre-built intents will enable your bot to respond to common things that users say to all chatbots on Messenger and you can customize the responses to match the voice of your brand.
You’ll still need to train your AI, but the pre-built intents will get you further along in the process so you don’t feel that you’ll have this huge mountain to climb to start making your bot responsive. You can can get these just by say Templates to Janis.

Working With Janis

Now that you’ve connected Dialogflow and Chatfuel to Janis, you’ll want to start training your AI. Janis makes AI training more accessible from Slack . 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

Now that you’ve connected Dialogflow and Chatfuel to Janis, you’ll want to avoid using Chatfuel AI. If you use both, this will create conflicts in your conversational experience. Users will send your bot messages, but if you have a keyword in Chatfuel, but you have a smart AI response in Dialogflow, then you may end up delivering two responses to your user. One response will be the likely wrong response with Chatfuel’s keyword rules, as well as the correct response served by Dialogflow.

Pro features

In the Janis Free plan, your bot will alert you in Slack 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:

Just say /resume in Slack to resume your Dialogflow AI responses, or Janis will automatically resume your AI responses after 10 minutes of inactivity. (HINT: You can extend the pause time by typing /pause X where X equals the number of minutes you want your AI to stay paused).

With Human Takeover from Janis, you can also manually push AI responses you’ve saved in Dialogflow. For example, you could be chatting live and if Janis receives a match to your user’s message, you can send your AI response in one click by clicking a Send to User button. We call this Co-Pilot mode and it’s really productive when you can respond to FAQ while chatting live using AI responses you’ve already saved for your bot.

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!

3 Things Before you go…

  1. Subscribe to our blog
  2. Join the Janis Facebook User Group and meet other users
  3. Start building your Chatfuel bot with a Janis template

Being Janis

Stories from the humans behind Janis.ai

Josh Barkin

Written by

Co-founder Janis.ai — Conversational AI Designer

Being Janis

Stories from the humans behind Janis.ai