1
0

Add minimal 'echo' facebook bot

This commit is contained in:
2018-04-21 15:58:08 +02:00
parent bde5e3be09
commit d36b4589e4
6 changed files with 3450 additions and 5435 deletions

View File

@@ -5,4 +5,47 @@
## Development
$ npm i
### 1. Install dependencies
$ npx yarn
### 2. Set environment variables
#### 2.1. Generate Facebook Verify Token
$ export FB_VERIFY_TOKEN=$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 32 | head -n 1)
$ echo Facebook Access Token: $FB_VERIFY_TOKEN
#### 2.2 Set [App Secret][1]
$ export FB_APP_SECRET=''
#### 2.3. Set [Facebook Access Token][2]
$ export FB_ACCESS_TOKEN=''
#### 2.4 Set local dev server port
$ export PORT=3000
### 3. Run the local dev server
$ npx yarn run dev
### 4. Point ngrok to that local dev server
$ npx ngrok http $PORT -region eu
### 5. Point the [Facebook webhook][3] to the ngrok tunnel
https://SOME_RANDOM_ID.ngrok.io/api/v1/facebook/
### 6. Start chatting with your bot
#### 6.1 [Monitor your requests][4]
[1]: https://developers.facebook.com/apps/YOUR_APP_ID/settings/basic/
[2]: https://developers.facebook.com/apps/YOUR_APP_ID/messenger/settings/
[3]: https://developers.facebook.com/apps/YOUR_APP_ID/webhooks/
[4]: http://localhost:4040/inspect/http