From 861173314f322982025ec13114ffd9b23bb5a012 Mon Sep 17 00:00:00 2001 From: Jake Jarvis Date: Mon, 17 Jul 2017 11:10:24 -0400 Subject: [PATCH] set Twilio number in env variables so app is now truly 100% portable! --- README.md | 8 +++++++- public/config.php | 3 +++ public/header.php | 4 ++-- public/sms.php | 6 +++--- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index f8b1c2c..4b0393a 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,13 @@ Easily deployable (for free!) to [Heroku](https://www.heroku.com/) as of Summer - `SITE_PASSWORD`: the password that allows staff members past the login page - `TZ`: time zone in [TZ format](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones); ex: America/New_York -Optional (but really [**awesome**](http://synonymsforawesome.com)) SMS reporting capabilities can be added for very little cost — just a few bucks should get you through the whole summer. [Sign up for a Twilio account](https://www.twilio.com/), add some credit, claim a catchy phone number, and point its text webhook callback to `http://{your domain}/sms_hook.php` via HTTP POST. Don't forget to change the phone number that's displayed in the `sms.php` how-to page. +Optional (but really [**awesome**](http://synonymsforawesome.com)) SMS reporting capabilities can be added for very little cost — just a few bucks should get you through the whole summer. [Sign up for a Twilio account](https://www.twilio.com/), add some credit, claim a catchy phone number, and point its text webhook callback to `http://{your domain}/sms_hook.php` via HTTP POST. Set the following additional [environment variables](https://devcenter.heroku.com/articles/config-vars#setting-up-config-vars-for-a-deployed-application) so the header knows to show a link to the SMS how-to page (`sms.php`) and what number to show on that page: + +- `PHONENUM`: numeric phone number claimed through Twilio; ex: +1 (917) 477-6667 +- `PHONENUM_FRIENDLY` (optional): phone number in text-based format if you [searched for one containing SPOONS on Twilio](https://support.twilio.com/hc/en-us/articles/223135247-How-to-search-for-phone-numbers); ex: +1 (917) 4-SPOONS + + +Don't forget to change the phone number that's displayed in the `sms.php` how-to page. --- diff --git a/public/config.php b/public/config.php index e097e37..a9ce42c 100644 --- a/public/config.php +++ b/public/config.php @@ -20,6 +20,9 @@ $db_name = "spoons"; } + $phonenum = getenv('PHONENUM'); + $phonenum_friendly = getenv('PHONENUM_FRIENDLY'); + $timezone_name = getenv('TZ'); date_default_timezone_set($timezone_name); diff --git a/public/header.php b/public/header.php index bd8d5ae..c9a9d66 100644 --- a/public/header.php +++ b/public/header.php @@ -140,7 +140,7 @@
@@ -149,7 +149,7 @@
diff --git a/public/sms.php b/public/sms.php index 19262f9..70bb47c 100644 --- a/public/sms.php +++ b/public/sms.php @@ -14,10 +14,10 @@ blockquote {

How to use the SMS system

-

+1 (407) 4-SPOONS

-

+1 (407) 477-6667

+

+

-

+1 (407) 477-6667

+

To interact with the spooning management interface via SMS, use the following commands: