This is a basic version of Twilio Barista to explain the basic concept.
- A Twilio account - Sign up for free
- Node.js and npm
- A Twilio Studio flow as described in this guide
git clone https://github.com/dkundel/barista-lite.git
cd barista-lite
npm install
a) Create a Twilio Sync Service and copy the SID
b) Configure the following variables in your Twilio Functions section:
- Enable
ACCOUNT_SID
andAUTH_TOKEN
- Set
API_KEY
andAPI_SECRET
to a valid pair. You can generate them in the Twilio Console - Set
SERVICE_SID
to the SID of your Sync Service - Set
PHONE_NUMBER
to the phone number or Messaging Service SID that you want to use to send notification SMS
c) Create three Twilio functions out of the three files in the twilio-functions
folder
d) Configure the Function in your Studio flow to point against the create-sync-item
function and make sure it passes trigger.message.From
as phoneNumber
and trigger.message.Body
as order
.
e) Set the webhook URL of your Sync Service to the URL of your sync-update-handler
function
f) Copy the URL of your barista-token
URL and place it in the src/data/orders.js
file as the tokenUrl
variable.
Start the application by running:
npm start
- Dominik Kundel
MIT