Creating a Facebook Messenger Chat Bot

Requirements

You need node.js, a yelp and facebook account.

Basic Setup — Step1

Let’s start by creating our project. I have also created a github repo with the code at https://github.com/amitevski/locobot . To follow along you can simply clone the code and checkout the current step.

Create the Facebook Page and App

Now comes the boring part. First go to Facebook Pages and create a page. After creating it write down the page id somewhere, this is our FB_PAGE_ID. We will need it to start our bot.

Choose Website
Add Product

Starting and verifying Loco Bot

We still need to setup the Facebook Webhooks, but before our loco bot must be running, as facebook will connect to it.

Starting Loco
Loco bot console output

Getting Locations nearby — Step2

Now that our bot is running we can start making him a bit more useful.

Summary

We created a simple but pretty useful bot in no time. Creating a native or webapp with same functionality would have been more complicated. Also installing a native app means more friction.

--

--

Freelance Web Developer

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store