Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/fif0o/twilio-app

📡 Boilerplate python code (flask web server) using Twilio messaging api to send/receive text messages.
https://github.com/fif0o/twilio-app

flask python twilio twilio-api twilio-sms-api

Last synced: 3 days ago
JSON representation

📡 Boilerplate python code (flask web server) using Twilio messaging api to send/receive text messages.

Awesome Lists containing this project

README

        

# PYTHON APP USING API MESSAGING FROM TWILIO AND ARDUINO WATER SENSOR

A (Js) serverless implementation of the back-end is also available.



## Pre-requisites
-----------------

### Deps
install deps: `pip install -r requirements.txt`.

### Twilio configuration
Add your own `account_sid`, `auth_token`, `from` (given by twilio when creating a phone number for your servie), `to` numbers to your environment after your registered for a Twilio account.

It can be found in your [console](https://www.twilio.com/console).

your `to` phone number (used to create a twilio account) must be [verified](https://www.twilio.com/console/phone-numbers/incoming).

### Environment
Create your own virtual environment: `virtualenv .venv`.

Activate your environment: `source .venv/bin/activate`.

Add your environment variables to a `.env` file.

Source environment variables for your project before running it: `source .env` or use `autoenv`.

## Running the project
----------------------

### Twilio Messaging configuration
Run webserver with [Twilio SMS Webhook](https://www.twilio.com/console/phone-numbers/).

If you don't want to host your webserver you can use ngrok locally to add your webhook endpoint to the Messaging service `/sms` route on the webserver `PORT:5000`.

### Available commands

Use the `Makefile` to `serve` and run your project.

### Javascript and serverless endpoint
`./serverless` directory holds a script using [webtask.io](https://webtask.io/) using Twilio API.

Alternatively, you can use [stdlib](https://stdlib.com/).

After `cd` the directory, you can install the deps `npm i`, and run the npm `deploy` task to update your script on webtask.io.

You will need to provide a `.secrets` file with your API variables: `TWILIO_ACCOUNT_SID`, `TWILIO_AUTH_TOKEN`, `TWILIO_NUMBER_FROM`, `TWILIO_NUMBER_TO` or source them in your environment.

## Examples of implementation
-----------------------------

* [Leak detector](https://github.com/slyg/leak-detector) - [@slyg](https://github.com/slyg) & [@fif0o](https://github.com/fif0o)

![leak detector](https://giphy.com/embed/l4EoO8Tmm5ShB7GdW)