DialogFlow (API.AI) to ChatFuel integration — easy as 1.2.3 with Activechat.ai
We’ve been building chat-bots for almost a year now, and for simple projects we often use ChatFuel platform — it’s fast, easy and powerful enough to drive much of the conversations our customers need. The only major drawback for ChatFuel is it’s quite… er… basic, let’s say so, when it comes to natural language processing.
On the other hand, DialogFlow from Google is one of the most powerful NLP-as-a-service platforms that I know, but for an average developer with less-than-professional skills it can seem a bit overwhelming at first.
So, we’ve been looking for some solution that would combine easy-to-use block dialogue builder from ChatFuel and the power of NLP from Google. This can be easily achieved by using a simple relay mechanism (as described in MiningBusinessData article, for example) — but that usually requires some external hosting for relay script and also engages some back-end magic to transfer control from DialogFlow intents to certain blocks within ChatFuel. Combined, that adds to development time and requires some mid-level development skills for each simple bot.
🔥🔥🔥 March 2019 UPDATE 🔥🔥🔥
Integrator service described below is not supported anymore. We’ve launched our own visual chatbot platform and there’s no more need for complex integrations (like Chatfuel+Dialogflow+Integrator, described in this article). Activechat.ai visual chatbot builder has everything you need — visual conversation flow, skills and intents, and direct Dialogflow integration for advanced natural language processing. It seems to be a bit more flexible and powerful than Chatfuel:
- multiple messengers support (Facebook Messenger, Telegram, Twilio etc)
- advanced data processing
- visual conversation builder
- direct support for Dialogflow
- direct integration with e-commerce platforms (WooCommerce and Shopify)
- drip campaigns and broadcasts
- …and many more
✅ Check it now 👉 https://activechat.ai
To solve that issue we’ve created what we call Integrator — a simple service that connects DialogFlow intents to ChatFuel blocks in a couple of mouse clicks and can be used even by the most inexperienced chat-bot developers.
We’ve been using Integrator for a couple of months now and I find it to be quite useful both in terms of development speed and simplicity, so I’d like to share it with other developers out there.
Currently we’re providing this as a free service to get some feedback from chat bot builders around the world and we’ll be adding more functions and integrations in the near future, so if you’d like to easily add some human language understanding capabilities to your chat bot please feel free to use Integrator on the as-is basis.
How does it work?
We’re hosting a simple script in Google Cloud that creates end-point (we call it “Port”) for each of your bots. That port is designed to catch the calls from ChatFuel’s “Default Answer” block (the one that is called when user input could not be recognized) via JSON API and relay these calls to DialogFlow for processing.
To start using Google-powered NLP (natural language processing) in your chat bot you should create an agent in DialogFlow and connect that agent to our port (more on that below). Every intent that you have in your agent will trigger certain block within your ChatFuel bot — based on dependencies that you can build by mouse-clicks inside the Integrator.
Why not use DialogFlow’s responses for this?
Actually, you definitely can do this and provide replies to your user’s natural language input directly from DialogFlow. The only issue that you’ll encounter is when you’d like to provide user with some rich cards (carouselles, for example) — these should be built from scratch as JSON objects in DialogFlow, and that takes some time and skills to do — or continue serving the detected intent with other blocks that you already have within your bot in ChatFuel.
Get connected
OK, let’s see how we actually connect a bot in ChatFuel to an agent in DialogFlow with Integrator.
Step 1. Create DialogFlow agent or use existing one
I will not be wasting your time describing the process of creating DialogFlow agents. There’s plenty of resources on this topic elsewhere (MiningBusinessData could be a perfect example), so let’s get straight to…
Step 2. Create a port for your bot in Integrator
Press “Free sign-up” to create your free account and connect to your DialogFlow agents.
Press “+ Add bot” to create new port.
Give your bot a name (and maybe a short description) and select one of your DialogFlow agents from a drop-down list.
Press “Connect”.
Now you’ll see your connected bot in “Bots” menu within Integrator.
Step 3. Configure ChatFuel’s “Default Answer”
Click your bot name to get to intents settings page. On top of that page you’ll see unique address for your port in Integrator. Click that address to copy it to your clipboard.
Now go to your ChatFuel bot, select “Default answer” block, remove anything that you have there and add “JSON API” plugin.
Paste your port address into URL field and select “POST” type.
Add {{last user freeform input}} in “User attributes” field.
Voila!
Now you can connect your intents from DialogFlow to ChatFuel blocks simply by copying block names.
Select the block that you’d like to connect to DialogFlow intent, double-click it’s name and press Ctrl-A Ctrl-C (Cmd-A Cmd-C for Mac) to select its name and copy to clipboard.
Paste (Ctrl-V) block name into an empty field next to the intent that should be triggering that block. Note that the intent gets connected to your block name with red line which turns green when you press “Save”.
Now you can go to your bot and test it! 🤖
From now on every time the connected intent will be triggered in DialogFlow it will immediately call corresponding block in ChatFuel.
Did it require any programming? I hope, not too much 😁
What about entities?
Sure, we did not forget about it. Entities is a good way to get some parameters into your intents, and you definitely can use these in ChatFuel. Just use {{entity_name}} user attribute anywhere you want (replace it with exaxt entity name) — it will be automatically populated with the latest entity value from DialogFlow (more on this in video below).
Here’s a simple example: imagine you have “@pizza_type” entity in DialogFlow.
If you connect that intent to a block in ChatFuel you’ll immediately have {{pizza_type}} user attribute filled with entity value when this intent is triggered!
Why did I clear the attribute after sending message to user? So that it doesn’t come in the way next time, in case there will be no entity value defined.
And here’s the result:
Works like a charm, and that’s why I wanted to share it with you!
Do you think we’ve missed anything with this integration? Drop me a line, and I’ll be happy to fix this for you.
To use Integrator in your own chat bot projects (it’s FREE!) please follow the link below:
https://i.activechat.ai
Please feel free to share your thoughts, comments and ideas on this — and stay tuned to our upcoming ChatFuel / ManyChat integrations (WooCommerce and 3Dcart to name just a few) — you’ll get updated if you use Integrator!