How to build a multi-language Manychat bot with Dialogflow

Dialogflow supports 16 of the popular languages used by Messaging users. Learn how to make your Manychat bot multi-lingual.

Josh Barkin
Sep 6, 2018 · 6 min read

For the complete guide on how to build AI-enhanced Manychat bots click here

ManyChat users have begun to embrace Dialogflow, a Google Service, as their source for artificial intelligence due to its power and flexibility. Multi-language AI support is one of it’s greatest strengths.

Dialogflow currently has multi-language support for 16 languages, so I’m going to show you how to build a multi-language ManyChat bot with one of Dialogflow’s built-in languages.

No time to read? Watch the video

Let’s build a multi-language ManyChat bot with AI

If you haven’t done so already, you’ll want to follow the entire Dialogflow for ManyChat series and get yourself a free Dialogflow agent from Google here

Create a new Dialogflow agent. Just name and save it. Next, click the ⚙ next to your agent name and jump over to the language tab.

Add the languages you want to include in your ManyChat experience. For this tutorial, I’m going to work with the default, English, and I’m going to add Español.

You see those country codes in the language selection list? Those are going to be helpful in your ManyChat setup, so remember en is for English and es is for Español.

If you click the language code for the languages you added, that will activate the language you are training in. Toggle between languages to create intents in different languages.

I’ve created an intent called “Thanks” in English(en) and I’ve translated in by toggling to Español(es) and updating the training phrases and response. You should know that Dialogflow will mirror your intents in each language. So if you delete some intents in one language, they will be deleted from the intents in the other language. Also you can’t rename your intents in different languages, so while it doesn’t matter what you name your intents, the same intent name will be used across all languages you add to your AI agent.

My English Intent names will also be my Spanish intent names, but the training phrases and responses will be different in each language

Now that you have a Dialogflow AI agent ready to train, add Janis to Slack and tell Janis you want to Add a bot. If you’ve already done this step, then you can just skip ahead to step 3.

Tell Janis you use Dialogflow. You’ll need to authenticate with Google, but you only need to do that once. Then you can add Dialogflow agents to Janis with just one click.

Then tell Janis you use ManyChat as your bot platform and Janis will help you get connected with a URL you can add to your default reply.

If you just want to experiment, create a flow in your bot that isn’t easily accessible and you can use a secret ManyChat keyword to trigger that flow and test things out. Ultimately though, whether you’re rolling this into your existing bot, or creating a new bot, you’ll want the language selector to be part of your welcome message. I’ll use my welcome message for this tutorial.

Let’s say I’m a restaurant that offers dining services to both English and Spanish speaking patrons. You’ll see that I have added an English and Espanol language selector in my welcome message.

You might be thinking at this point that you can just create different flows and each flow could be in a different language, but the point is that flows are linear and keywords are useless without context, so by using Dialogflow, you can ensure that your bot will respond to free form text messages in their preferred language, and instead of keywords, you’ll use training phrases and add context.

In my English flow you’ll see that the I’ve set an action as the first step. I’ve set a Custom Field (user field) as lang and I’ve set the value to en. The lang field is what Janis to relay that a language selection has been made, while the en value will tell Dialogflow which language code to use.

Now, click into the Español flow and you’ll see I’ve replicated the English setup, only here the value for the lang Custom Field has been set to es (Dialogflow’s language code for Español).

I’m going to also create one other intent to switch languages, in case the user is chatting with my bot in one language, but then wants to switch languages in the middle. I’ve added in my English version of the intent the word Spanish, and in my Spanish version of the intent, I included English. The user might not intuitively type “Change language” or something you would expect. They might just enter the other language(s) you’re offering them.

Dialogflow might automatically highlight the language you enter into the training phrase and treat it as a system entity, but click the trash can for the parameter/entity to remove the highlight.

In each version of the intent, I just redirected back to my English flow for the English response and my Spanish flow for the Spanish response.

Let’s Test things Out!

You can test your multi-language Dialogflow connection by selecting your language in your welcome message and then sending your bot a message you know it won’t understand. You should get a default answer back from Dialogflow in your selected Language! Then click on the other language and send yourself the same message, and you’ll get the default fallback in that selected language.

Congratulations, you’ve got a framework for an AI enhanced multi-language ManyChat bot. Whatever language is the selected language in ManyChat will be the language that Dialogflow delivers its response.

  1. Join the Janis Facebook group and meet others working with Dialogflow + Manychat
  2. See the complete guide to building AI-enhanced Manychat bots
  3. Connect a bot: https://www.janis.ai/manychat
  4. Applaud and share this with others if you found it useful. You’ll help the Manychat community benefit from AI too!.

Being Janis

Stories from the humans behind Janis.ai

Josh Barkin

Written by

Co-founder Janis.ai

Being Janis

Stories from the humans behind Janis.ai

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade