PHP >=5.5composer- ngrok
- Facebook Account
For simplicity of this task, we will use built-in PHP server.
- install dependencies with
composer install - from project's directory run in console
php -S localhost:9999. - check local PHP server is running - in browser go to
http://localhost:9999/- you should see a blank page.
Ngrok is local proxy allowing your PC to be accessible from Internet.
- download
ngrokfrom https://ngrok.com/download and extract it in project directory. - make sure it is executable - run in console:
./ngrok. - start
ngrokto have public proxy -./ngrok http 9999. - make sure everything is OK with
ngrokby going to http://127.0.0.1:4040/inspect/http
-
Chatbot will need a facebook page to work. Create page in facebook if you don't have one
-
Go to Developer facebook.com and click
Add new App
- Enter the name of your app (ex. Chatbot workshop)
-
You will be redirected to you project configuration page
-
Fill required steps:
- Get your
App idandApp secret
- Add messenger product to your application

- Select page that will use this app (may require to add permissions).
Page Access Tokenwill be generated. Add it to your application
- Click
Subscribe To EventsinWebhookssection - Fill url you got from
ngroksetup, other fields should be as it is in screenshot.
- Select a page to subscribe your webhook to the page events

- Get your
-
If everything was according to plan, you can open Messenger, search for chat bot and he should reply to you.
In case you restarted ngrok, you will receive a new public hostname, you need to change it in App Webhooks