Skip to content

Commit

Permalink
Merge pull request #11 from urbanriskmap/dev
Browse files Browse the repository at this point in the history
Merge dev to form release
  • Loading branch information
tomasholderness authored Jun 19, 2018
2 parents f887ea7 + fd30d1a commit a2bf318
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 3 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
bin/
node_modules/
.nyc_output
.env
.env-dev
.env*
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# CHANGELOG

### v0.0.3

Deployment version:
- working bot with buttons
- support for null areas
- improved thanks message
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ Adjust .travis.yml to deploy via Travis as need.
### Configuration
Save a copy of sample.env as .env in local directory with appropriate credentials as defined in sample.env

### Facebook Configuration
- To subscribe to the get started button, make sure the app is subscrived to `messaging_postbacks` as set in the Messenger -> Settings -> Webhooks -> Edit events config page in developers.facebook.com
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cognicity-reports-facebook",
"version": "1.0.0",
"version": "0.0.3",
"description": "Facebook Messenger bot running on AWS lambda",
"main": "index.js",
"scripts": {
Expand Down
2 changes: 2 additions & 0 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ export default {
CARDS_API: process.env.CARDS_API || 'https://data.riskmap.us/cards/',
CARDS_API_KEY: process.env.CARDS_API_KEY,
CARDS_URL: process.env.CARDS_URL || 'https://cards.riskmap.us/flood/',
DEFAULT_INSTANCE_REGION_CODE: process.env.DEFAULT_INSTANCE_REGION_CODE ||
'brw',
DEFAULT_LANGUAGE: process.env.DEFAULT_LANGUAGE || 'id',
FACEBOOK_ENDPOINT: process.env.FACEBOOK_ENDPOINT || 'https://graph.facebook.com/v2.6/me/messages',
FACEBOOK_PAGE_ACCESS_TOKEN: process.env.FACEBOOK_PAGE_ACCESS_TOKEN,
Expand Down
4 changes: 4 additions & 0 deletions src/lib/facebook.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@ export default class Facebook {
**/
sendThanks(body) {
return new Promise((resolve, reject) => {
if (body.instanceRegionCode === 'null') {
// catch reports outside the reporting area and reply a default
body.instanceRegionCode = this.config.DEFAULT_INSTANCE_REGION_CODE;
}
Promise.all([this.bot.thanks(body), this.bot.card(body)])
.then((values) => {
console.log(values);
Expand Down

0 comments on commit a2bf318

Please sign in to comment.