https://github.com/jessebraham/siren
Provides a basic API for sending email and SMS messages via HTTP requests
https://github.com/jessebraham/siren
asgi email peewee python python3 sms starlette twilio uvicorn
Last synced: about 1 month ago
JSON representation
Provides a basic API for sending email and SMS messages via HTTP requests
- Host: GitHub
- URL: https://github.com/jessebraham/siren
- Owner: jessebraham
- License: mit
- Archived: true
- Created: 2018-10-30T19:03:24.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-07-29T18:08:33.000Z (over 4 years ago)
- Last Synced: 2025-03-16T01:28:59.231Z (about 1 month ago)
- Topics: asgi, email, peewee, python, python3, sms, starlette, twilio, uvicorn
- Language: Python
- Homepage:
- Size: 54.7 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Siren
[](https://travis-ci.org/jessebraham/siren)
[](https://coveralls.io/github/jessebraham/siren?branch=master)__Siren__ provides a basic API for sending email and SMS messages via HTTP requests, authorized using [HTTP Basic Authentication](https://en.wikipedia.org/wiki/Basic_access_authentication). Email are sent via a user-configured SMTP server, and SMS are sent using [Twilio](https://www.twilio.com/). Additional services may be supported in the future; if you would like to see a service supported feel free to open an issue.
> __NOTE:__ `starlette` has yet to reach a `1.0` release, so this project will remain questionably stable until at least that point; do not use Siren for anything remotely important without first understanding the risks.
- - -
__Siren__ is built using the following packages:
[bcrypt](https://github.com/pyca/bcrypt/) | [peewee](https://github.com/coleifer/peewee) | [starlette](https://github.com/encode/starlette) | [twilio](https://github.com/twilio/twilio-python) | [uvicorn](https://github.com/encode/uvicorn)The following packages are used for development and testing:
[black](https://github.com/ambv/black) | [faker](https://github.com/joke2k/faker) | [pytest](https://github.com/pytest-dev/pytest) | [pytest-cov](https://github.com/pytest-dev/pytest-cov)- - -
## Quickstart
__TODO:__ write me
## Configuration
Configuration is done using Environment Variables, following [the twelve-factor pattern](https://12factor.net/config). An example configuration file can be found below.
```bash
# instance/.env
#
# Don't commit this to source control.
# Eg. Include ".env" in your `.gitignore` file.DEBUG=False
TWILIO_ACCOUNT_SID="your-twilio-account-sid"
TWILIO_AUTH_TOKEN="your-twilio-auth-token"
TWILIO_FROM_NUMBER="+18005551234"SIREN_SMTP_HOST="smtp.example.com"
SIREN_SMTP_PORT=587
SIREN_SMTP_USERNAME="[email protected]"
SIREN_SMTP_PASSWORD="your-smtp-password"
SIREN_SMTP_FROM_ADDR="[email protected]"
```## Endpoints
__Siren__ exposes the following endpoints:
| Method | Route | Parameters |
|:-------|:--------------|:-----------------------------|
| `POST` | `/send/email` | `{ to_addr, subject, body }` |
| `POST` | `/send/sms` | `{ to_addr, body }` |A username and password must be supplied, as _all_ requests are authenticated using [HTTP Basic Authentication](https://en.wikipedia.org/wiki/Basic_access_authentication). To send an SMS message using `curl`, run:
```bash
$ curl -X POST \
http://user:password@localhost:8000/send/sms \
-H 'Content-Type: application/json' \
-d '{ "to_addr": "+12223334444", "body": "Science!" }'
```## License
__Siren__ is released under the MIT License. See the bundled [LICENSE](LICENSE) file for details.