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
-
Go to Messenger API platform and click
Try It now
-
Fill required steps:
- Check the checkbox
- Skip Node.JS installation
- Enter chat bot name - must start with capital letter
- Skip package download - we do not need it
- Fill url you got from
ngroksetup - do not pressNext, you will get an error
- In another browser tab go to Facebook Apps
- Click on App with your chat bot name (You filled it in
Step 3) - Save the
App IDandApp Secret- in configuration file
- Go to
MessengerinProductssidebar - Under
Token GenerationselectPagewith same name as your chat bot name, save thePage Access Tokenin configuration
- Go to previous browser tab and click
NextinStep 5
-
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

