Objectives
- Creating a Dashboard in Adafruit.
- Creating an Applet in IFTTT.
- Creating a chatbot in facebook by using Adafruit and IFTTT.
- Improvising the bot using Chatfuel.
Things
For this project, you will need,
- A Facebook account.
- An Adafruit account.
- An IFTTT account.
Let’s begin!
A chatbot is an artificial intelligence (AI) application that can imitate a real conversation with a user in their natural language. Chatbots enable communication via text or audio on websites, messaging applications, mobile apps, or telephone.
Create a Dashboard in adafruit
Step 1: Open a browser and go to io.adafruit.com. Click on Get Started for Free.
Step 2: Fill in your details and click on Create Account. Note that the site would have navigated to
accounts.adafruit.com
Adafruit Sign up
Step 3: Once the account is created, navigate to Dashboards. Then navigate to actions and create a new Dashboard.
Dashboard
Step 4: Name the dashboard and click Create
Create a new Dashboard
Step 5: Open the newly created dashboard. You will get a blank dashboard. Click on + to create new blocks on the dashboard.Select a Toggle block.
Create a new block
Step 6: Select Enter new feed name. Type ONOFF and click Create
Choose feed
Step 7: Select the newly created field. Click on Next step.
Step 8: Give an appropriate Block Title. Set the ON and OFF texts as 1 and 0 respectively. Click on Create Block
Block Title
Finally you will get a new toggle block. Hence a Dashboard is created.
Create an Applet in IFTTT
Step 1: Open a new browser tab and go to ifttt.com. Click on Sign Up. Create an account in IFTTT.
IFTTT Sign up
Step 2: Once logged in, click on the account icon and then click on create.
Click Create
Step 3: Click on new applet and then click on [+]this.
Click [+] This
Step 4: Search and select Webhooks.
Select Webhooks
Step 5: You will be prompted to Connect to Webhooks if this is your first time. Once done, select Receive a web request.
Step 6: Fill in the details as shown and select Create trigger
Create trigger
Step 7: Select [+]that
Step 8: Search and select Adafruit
Step 9: You will be prompted to authorize the link to the Adafruit account, click on Authorize. Select Send data to Adafruit IO
Step 10: Select the feed name ONOFF from the list which appears. In Data to save, click on Add ingredient and select Value1. It will appear as shown. Select Create action and then click on Finish
Select Value1
Step 11: Once the applet is created, click on the Webhooks symbol
Step 12: Click on settings and copy the Authentication key of your Webhooks applets. Make note of it in a notepad.
Account information
Step 13: Type the following URLs in your notepad. Make sure to replace <event_name> with your event name and <auth_key> with your authentication key
https://maker.ifttt.com/trigger/<event_name>/with/key/<auth_key>/?value1=1
https://maker.ifttt.com/trigger/<event_name>/with/key/<auth_key>/?value1=0
Create a Chatbot in your Facebook
Step 1: Open facebook in a new browser tab and login to your account.Click Create and select Page.
Click Create
Step 2: You need to create a page for Community or public figure. Click Get Started
Step 3: Name your page and select category as Electronics. Click Continue.
Community or public figure
Step 4: Skip the profile picture and cover photo prompts. Your page is now ready to accept messages.
Step 5: Open a new browser tab and go to chatfuel.com. And click on Continue with Facebook
chatfuel
Step 6: Click on Create from Template and select Blank Bot
Blank Bot
Step 7: Once your Blank Bot is created, click Connect then, Click CONNECT TO PAGE on the Facebook page you created. It will prompt Published.
Bot Publishing
Step 8: Click Automate tab. Clear the Welcome message and type as shown
Welcome Message
Step 9: Also change the Default Answer to “I am sorry. I did not understand that command.”
Default Answer
Step 10: Click on + under Add Blocks Here and rename as shown. Add a Text block.
Rename Block
Step 11: Fill the Text block as shown and then click on +
Click on +
Step 12: Select JSON API
Chatfuel Plugins
Step 13: You will get this. Select TYPE as POST instead of GET. Paste the first URL from your notepad here. Remove the tick mark from Report plugin errors in the bot.
JSON API
Step 14: Make another block for LED OFF and follow the same steps. Paste your second URL here.
Step 15: Click on Set up AI and Type the following. Then click on Block
Set up AI
Step 16: Select the LED ON block.
Select LED ON block
Step 17: Click on Add AI Rule and make a similar one for LED OFF. Your Chatbot is now ready
Step 18: Navigate to facebook and select View as Page Visitor
View as Page Visitor
Step 19: Click Send message and then click on Get Started
Here You Go!
Get Started