From f51bba45b73821dcc36371d0cb714e7a3d321c4c Mon Sep 17 00:00:00 2001 From: Tomas Date: Tue, 19 Jun 2018 13:50:29 -0400 Subject: [PATCH] pre-release updates --- CHANGELOG.md | 8 ++++ commands/deploy_buttons.sh | 92 -------------------------------------- commands/show_buttons.sh | 10 ----- package.json | 2 +- 4 files changed, 9 insertions(+), 103 deletions(-) create mode 100644 CHANGELOG.md delete mode 100755 commands/deploy_buttons.sh delete mode 100755 commands/show_buttons.sh diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..8d18862 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,8 @@ +# CHANGELOG + +### v0.0.3 + +Deployment version: +- working bot with buttons +- support for null areas +- improved thanks message \ No newline at end of file diff --git a/commands/deploy_buttons.sh b/commands/deploy_buttons.sh deleted file mode 100755 index de2bea9..0000000 --- a/commands/deploy_buttons.sh +++ /dev/null @@ -1,92 +0,0 @@ -#!/bin/bash - -if [ -z "$FACEBOOK_PAGE_ACCESS_TOKEN" ] -then - echo "No FACEBOOK_PAGE_ACCESS_TOKEN IN ENVIRONMENT" - exit 1 #failure -else - echo "Found FACEBOOK_PAGE_ACCESS_TOKEN in env." -fi - -# ---------------------- -# Set Get started button -# ---------------------- - -#Get Started button shows up first time users look up the bot -get_started=$(cat <<-EOF - { - "setting_type": "call_to_actions", - "thread_state": "new_thread", - "call_to_actions": [{ - "payload": "GET_STARTED_PAYLOAD" - }] - } -EOF -) - -echo $get_started - -success="$(curl -s -o /dev/null -X POST -H "Content-Type: application/json" -d "$get_started" -w "%{http_code}" "https://graph.facebook.com/v2.6/me/thread_settings?access_token=$FACEBOOK_PAGE_ACCESS_TOKEN")" - -if [ $((success)) -eq 200 ] -then - echo "Successfully set GET_STARTED_PAYLOAD" -else - echo "Failed to set GET_STARTED_PAYLOAD" - exit 1 -fi - - -# --------------------- -# Set Greeting Text -# --------------------- - - - -greeting=$(cat <<-EOF - { - "greeting":[{ - "locale":"default", - "text":"Hai {{user_full_name}}!! Saya BencanaBot. Tekan menu di bawah atau ketik ‘Laporkan banjir’ untuk melaporkan banjir di sekitarmu." - }] - } -EOF -) - -success=0 -success="$(curl -s -o /dev/null -X POST -H "Content-Type: application/json" -d "$greeting" -w "%{http_code}" "https://graph.facebook.com/v2.6/me/messenger_profile?access_token=$FACEBOOK_PAGE_ACCESS_TOKEN")" - -if [ $((success)) -eq 200 ] -then - echo "Successfully set greeting" -else - echo "Failed to set greeting" - exit 1 -fi - -# --------------------- -# Set Persistant menu -# --------------------- - - -persistent_menu=$(cat <<-EOF -{ - "persistent_menu": [ - { - "call_to_actions": [ - { - "payload": "flood", - "title": "Laporkan banjir", - "type": "postback" - }], - "composer_input_disabled": true, - "locale": "default" - } - ] - } -EOF -) - -echo "persistent_menu menu: $persistent_menu" - -curl -D - -X POST -H "Content-Type: application/json" -d "$persistent_menu" "https://graph.facebook.com/v2.6/me/messenger_profile?access_token=$FACEBOOK_PAGE_ACCESS_TOKEN" diff --git a/commands/show_buttons.sh b/commands/show_buttons.sh deleted file mode 100755 index 690401a..0000000 --- a/commands/show_buttons.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -#check status of get started button -curl -X GET "https://graph.facebook.com/v2.6/me/messenger_profile?fields=get_started&access_token=$FACEBOOK_PAGE_ACCESS_TOKEN" | python -m json.tool - -#greeting text -curl -X GET "https://graph.facebook.com/v2.6/me/messenger_profile?fields=greeting&access_token=$FACEBOOK_PAGE_ACCESS_TOKEN" | python -m json.tool - -#persistant menu -curl -X GET "https://graph.facebook.com/v2.6/me/messenger_profile?fields=persistent_menu&access_token=$FACEBOOK_PAGE_ACCESS_TOKEN" | python -m json.tool diff --git a/package.json b/package.json index 629c0de..8d9a48b 100644 --- a/package.json +++ b/package.json @@ -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": {