This bot was created with the objective of prototyping bots for Flash Sales.
Demo Video with Account Kit login:
Demo Video with Account Linking login:
- Admin access to a Facebook Page
- A Facebook App
- Node.js
To build your own bot from scratch (or with a little help), try the Messenger Platform Quick Start Tutorial.
Otherwise, to run this bot, configure your app on Facebook Developers with the following permissions:
- messages
- messaging_postbacks
- messaging_referrals
- messaging_account_linking
After associating your page with the webhook, run
npm install
to install required Node packages. Start the server running
node server.js
Fill the backend_config.js
file with your Page Access Token, and a VERIFICATION_TOKEN
with a non-guessable string.
For initial tests or development, you can install and use Local Tunnel. With your node server up, run
lt --port 65172
Use the domain provided by Local Tunnel to replace DOMAIN
in backend_config.js
and in product/payment_test/frontend_config.js
, and restart your node server. Setup your webhook with:
<lt_domain> + /webhook
Input the same VERIFICATION_TOKEN
from your backend_config.js
.
Ex.:
To enable Account Kit login, whitelist the domain and redirect url ending with akit_success
in your app dashboard (https://developers.facebook.com/apps/<APP_ID>/account-kit/settings/
).
Ex.:
In order to use a product from your Dynamic Ads product catalog, provide an User Access Token with business_management
permission from an advertiser/admin of a product catalog. In backend_config.js
, fill USER_ACCESS_TOKEN
and PRODUCT_ID
.
Setup Get Started Button with
curl -X POST -H "Content-Type: application/json" -d '{
"get_started": {"payload": "open_thread"}
}' "https://graph.facebook.com/v2.6/me/messenger_profile?access_token=<PAGE_ACCESS_TOKEN>
In case you need it, you can unlink accounts from Account Linking with
curl -X POST -H "Content-Type: application/json" -d '{
"psid":"<PSID>"
}' "https://graph.facebook.com/v2.6/me/unlink_accounts?access_token=<PAGE_ACCESS_TOKEN>
Easiest way to get a Page Access Token is:
- Go to Graph Explorer
- Get an User Access Token with
manage_pages
- Select the Page you want on the drop down.
- Copy the token from the Access Token field.
To see token permissions, expiration date, etc, use Access Token Debugger.