Create a Facebook Chatbot


It’s not hard at all to make your own chatbot. Adding AI is a slightly different story, but for now we want to get the basic mechanics of a chatbot for Facebook’s Messenger going.

Make a native Facebook Chatbot in 20 minutes. We’ll write some server-side code, host it on Heroku, and then connect it to Facebook.

As usual, the brilliant folks at Katacoda have a playground available where you can test this code on a live Node.js server. Visit and paste the code below to get started with your 1st Facebook chatbot. Let us know in the comments how it went.


'use strict'

const express = require('express')
const bodyParser = require('body-parser')
const request = require('request')

const app = express()

app.set('port', (process.env.PORT || 5000))

// Allows us to process the data
app.use(bodyParser.urlencoded({extended: false}))


app.get('/', function(req, res) {
	res.send("Hi I am a chatbot")

let token = ""

// Facebook 

app.get('/webhook/', function(req, res) {
	if (req.query['hub.verify_token'] === "blondiebytes") {
	res.send("Wrong token")
})'/webhook/', function(req, res) {
	let messaging_events = req.body.entry[0].messaging
	for (let i = 0; i 

Here are the links to anything you might need to pull this off:

Download NPM/Node.js:
Download Sublime:
Sign up for GitHub:
Download Git:
Sign up for Heroku:
Download Heroku Command Line Tools:
Curl: curl -X POST “”