This tutorial will guide you through everything you need to know to build your first Messenger bot. Before you begin, choose one of the options under Requirements to get the code you will need to start, then follow the steps under Getting Started to get set up.Just want to see the finished code? Not a problem! You can fork it on GitHub.
Before you begin this quick start, make sure you have completed one of the following to ensure you have the starter code you will need. The starter code provides a basic webhook that we will use as the foundation of our Messenger bot.
Our webhook setup guide will walk you through building your first webhook that your can use with this quick start from start to finish.Build Your Webhook
Download our webhook starter code from GitHub, and deploy it to a server of your choice.Download the Code
If you do not have a server to deploy your webhook to, you can remix our starter webhook project on Glitch, which will provide a public URL served over HTTPS for your webhook.
To create your own webhook on Glitch, do the following:
Before you build your first Messenger bot, start by setting up the credentials for your app.
In this tutorial we will build a simple Messenger bot that does the following:
Parses the message and sender's page-scoped ID from an incoming webhook event.
messaging_postbacks webhook events.
Sends messages via the Send API.
Responds to text messages with a text message.
Responds to an image attachment with a generic template that uses the received image.
Responds conditionally to a postback payload.