This Project is currently Working In Progress(WIP)
This is basic Facebook messenger chat bot with Laravel yeah. You saved questions and answer to the database. When user ask question from Messenger. It answer back with the answer you saved in the database. That's for now yeah. Will add many more new features soon ;)
- clone this repo & composer install
- Setup your domain. Your Domain Must be with https, you can setup with let's encrypt
- Setup Facebook App
- Fill Database credentials and Facebook verify_token and token(app/page_token) in Laravel's .env
- Modify Q&A in
database/seeds/QuestionsAndAnswerSeeder.php
Already added some basic, you can check it out there and runphp artisan migrate && php artisan db:seed
- Chat with your Facebook page. Base on your
QuestionsAndAnswerSeeder
's Q&A
For this step, I am really lazy to write everything. So, I just copy from jw84 repo. Thanks jw84
- Create or configure a Facebook App or Page here https://developers.facebook.com/apps/
- In the app go to Messenger tab then click Setup Webhook. Here you will put in the URL of your Heroku server and a token. Make sure to check all the subscription fields.
In this step https://guarded-dusk-21746.herokuapp.com/webhook/ will be https://yourdomain.com/webhook/
- Get a Page Access Token and save this somewhere.
-
Go back to Terminal and type in this command to trigger the Facebbook app to send messages. Remember to use the token you requested earlier.
$ curl -X POST "https://graph.facebook.com/v2.6/me/subscribed_apps?access_token=PAGE_ACCESS_TOKEN"
Thanks jw84 for Messenger Bot Tutorials and pimax for FB Messenger Bot PHP API
#Docs Facebook Messenger Platform
#Demo Bot