- Prerequisites:
- npm and node must be installed
- npm is installed with node so you can get both here: https://nodejs.org/en/download/package-manager/
- Set up AWS, instructions could be found: https://serverless.com/framework/docs/providers/aws/guide/credentials/
- npm and node must be installed
$ npm install -g serverless
$ git clone https://github.com/kehitysto/coaching-chatbot.git
$ npm install
Rename .env.example to .env and fill in FACEBOOK_BOT_VERIFY_TOKEN
. The verify token can be anything you choose. You will need it later.
$ serverless deploy
Copy the GET endpoint url
- In Facebook Developer site create new Facebook application and page
- Create Facebook application -> https://developers.facebook.com/quickstarts/?platform=web
- Create Facebook page -> https://www.facebook.com/pages/create (if the page already exists, use it when we refer to the page created in step 1)
- Go to the App Dashboard. Select under Products "+Add Product" and choose Messenger. Next setup webhook by clicking
Setup Webhooks
- Callback URL -> use endpoint url copied in Coaching chatbot Installation
- Verify Token -> use FACEBOOK_BOT_VERIFY_TOKEN filled in Coaching chatbot Installation
- Select Subscription field
messages
- At this stage, the application is available only for developers and testers. The application needs to be approved by Facebook for public access
- Click
Verify and Save
- In the Token Generation section, select the page created in step 1 and copy the generated token
- In Webhooks section, select page created in step 1(Facebook App Configuration) to be the one that subscribes the webhooks
- Paste token copied in step 4 to .env file as
FACEBOOK_BOT_PAGE_ACCESS_TOKEN
$ serverless deploy
More detailed instructions for Facebook Messenger platform configuration can be found from https://developers.facebook.com/docs/messenger-platform/quickstart/
To make your application acceptable to other user your app should be approved by facebook
- Prerequisites:
- Your app must have App Icon (1024 x 1024) set.
- Your app must have Privacy Policy URL set.
- You can set them by going to the application in facebook developers, Setting -> Basic
Instructions of approvals:
-
Go to the application in facebook developers
-
Choose
Messenger
underProducts
-
Scroll down to
App Review for Messenger
-
For the app to work properly, you should have
pages_messaging
pages_messaging_subscription
approved, to do so pressAdd to Submission
-
Scroll to
Current Submissions
and pressEdit Notes
.pages_messaging
- Example:
pages_messaging_subscription
* Add description: "Our application will use pages_messaging_subscriptions to notify the user that some other users want to became their pair. The user can quite pair searching at any point if he/she doesn't want to get notification anymore. Permission is needed because the pair could be found after 24 hours after subscribing and it's possible that during this time few users want to send a request to the user." Feel free to change the description
* Upload a Screencast showing one path of the possible conversations with the bot. This example should show what kind of messages the bot sends to users without the user initiating the conversation.
-
Press
Submit for Review
To deploy multiple versions of the chatbot you have to define a name for serverless deploy:
$ serverless deploy <name here>
After this you can follow the instructions from the top of this page onwards. You can see the different versions you have deployed in your aws lambda dashboard and also delete/modify them there. One good use for this is for example having a staging environment and a production environment.