automation, chatbots, data journalism, Interactivity, social media

How to build a Facebook Messenger chatbot with API.ai

The previous post shows 5 tools that help to create Facebook Messenger chatbots. The platform that I liked the most was API.ai and I used it to build a bot for my Facebook Page Dinfografia .

Through intents and entities, I tried to build a basic chatbot that displays information about my resumé. I set up some keywords to answer questions around professional experience, education or hobbies:

output_bk1Rjx

Here I explain how to create the above bot in 6 steps:

1. Sign up on Api.ai 

2. Create an Agent

It will be the conversational interface of your bot. Give a description and select a language:

Screen Shot 2016-08-11 at 09.13.39

3. Create some entities

Entities gather words under concepts and parameters to simulate a natural conversation with users. Some examples are synonyms or related words under the same topic:

Screen Shot 2016-08-11 at 23.51.04Screen Shot 2016-08-11 at 23.50.24

4. Create an intent

An intent is a guess between what the user says and the action that the bot should take. There are four fields that need to be completed for each intent:

  • Context of the topic
  • What user asks
  • Action that the bot will take
  • A speech response from the bot to the user

This slideshow requires JavaScript.

5. Integrate the bot with your Facebook account

Go to Integrations -> Facebook Messenger. Connect the chatbot to a specific page (if you don’t have one you’ll have to create it before linking both platforms).

Screen Shot 2016-08-12 at 00.10.40

6. Test the chatbot on Facebook

Do you have more examples? Let me know in the comments or on Twitter at @mcrosasb

Advertisements
Standard

3 thoughts on “How to build a Facebook Messenger chatbot with API.ai

  1. Pingback: Five chatbots created by newsrooms in 2016 that we liked – Storybench

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s