Skip to content

jessebraham/siren

Repository files navigation

Siren

Build Status Coverage Status

Siren provides a basic API for sending email and SMS messages via HTTP requests, authorized using HTTP Basic Authentication. Email are sent via a user-configured SMTP server, and SMS are sent using Twilio. 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 | peewee | starlette | twilio | uvicorn

The following packages are used for development and testing:
black | faker | pytest | pytest-cov


Quickstart

TODO: write me

Configuration

Configuration is done using Environment Variables, following the twelve-factor pattern. An example configuration file can be found below.

# 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. To send an SMS message using curl, run:

$ 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 file for details.

About

Provides a basic API for sending email and SMS messages via HTTP requests

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published