Journey of the Facebook bot creation

Sandeep
HackerNoon.com
3 min readMay 28, 2017

--

Original Goal: Message F.R.I.E.N.D.S. dialog to my wife daily automatically.

FRIENDS is my wife’s favorite show. She is not able to get time to watch since our son is born. My original plan was to send automated message her on WhatsApp daily. The problem with WhatsApp is they do not provide any official API for messaging. This will be one of the reason of its downfall for sure. Telegram, slack, messenger etc. are providing API support to create BOT.

So I decided to move on messenger. The only problem with this approach is that I have to manually message her on Whatsapp. But when I saw a smile on her face after reading messages, it’s worth it.

I started searching for bot framework in PHP. There are many frameworks on GitHub. For every framework initial setup was required for client ID and client Secret. So I need to sign up as an application developer and configure these values. Also, I have to setup conversation reply for every dialog.

Everything was planned and ready. Then I suddenly remember that freehostia do not support curl operations on the free plan. I am using freehostia for hosting of my website.

I started searching for alternative and found amazing bot platform.

Chatfuel takes care of everything related to bot configuration. No coding required.

I only have to provide JSON response as a message to their callback. Also, they provide broadcast functionality where a bot will send schedule message on specified time interval. I set up a daily reminder on a morning.

The problem of bot now sorted. Now I have to work for dialog only.

Manually adding dialog will be time-consuming. Also extracting from subtitle also not worked as hard to find good dialog programmatically. So started a searching on the internet for ready-made dialog.

My search leads me to Wikiquote link.

As my hosting provider do not support curl, I can’t get at run-time by parsing from Wikiquote on chatfuel callback. I parsed all pages locally and stored on the table. I imported that table on freehostia and wrote Callback script to select one dialog randomly from a table. Done

If you liked this, click the 💚 below so other people will see this here on Medium.

Hacker Noon is how hackers start their afternoons. We’re a part of the @AMI family. We are now accepting submissions and happy to discuss advertising & sponsorship opportunities.

If you enjoyed this story, we recommend reading our latest tech stories and trending tech stories. Until next time, don’t take the realities of the world for granted!

--

--