Skip to content

gagaus/flash-sales-bot

Repository files navigation

Flash Sales Bot

This bot was created with the objective of prototyping bots for Flash Sales.

Demo Video with Account Kit login:

IMAGE ALT TEXT HERE

Demo Video with Account Linking login:

IMAGE ALT TEXT HERE

Requirements

Setup

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.:

alt text

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.:

alt text

Optional

Product Catalog API

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.

Get Started Button

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>

Account (Un)Linking

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>

Cheatsheet

Easiest way to get a Page Access Token is:

  1. Go to Graph Explorer
  2. Get an User Access Token with manage_pages
  3. Select the Page you want on the drop down.
  4. Copy the token from the Access Token field.

To see token permissions, expiration date, etc, use Access Token Debugger.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published