Hermes is a demo 12 factor app in Go that can be deployed on any cloud native compliant platform as a container. Hermes as the name obviously implies is a messenger that Sends SMS messages to any supported carrier in Rwanda.
- Simple sms delivery.
- Delivery notifications.
- Implement a simple store(sqlite+litestream) to record access records.
- Document authentication via pomerium.io.
- Add application metrics.
- Build and deploy container imag.
- Add valid knative deployment manifests
To function Hermes requires a couple of environment variables:
cat .template.env
PORT=8080
HELMES_SMS_APP_ID="fdi sms app id"
HELMES_SMS_APP_SECRET="fdi sms app password"
HELMES_SENDER_IDENTITY="fdi sms sender id"
HELMES_CALLBACK_URL="delivery(dlr) report callback url" # optional
Besides the port the other variables can be obtained by subscribing to https://www.fdibiz.com/ messaging API.
To start Hermes on your laptop:
-
git clone this repository
-
source the environment variables
cp .template.env .env
# edit the file .env with variables and credentials the source the file
source .env
- build the hermes binary
CGO_ENABLED=0 go build -o bin/hermes ./cmd/hermes
# view the output binary
ls bin
For convinience, you could install task a make alternative then:
# it will build your binary and start the hermes server
task run
- check hermes version via
/api/version
# source .env
curl localhost:$PORT/api/version
- send an sms messsage via
/api/send
# source .env
# replace with your 078xxxxxxx with your number
export PHONE="your phone"
export MESSAGE="your message"
cat example.json | jq --arg PHONE $PHONE '.recipient=$PHONE' | tee hermes.json
cat hermes.json | jq --arg MESSAGE $MESSAGE '.payload=$MESSAGE' | tee hermes.json
Finally send the payload as defined in hermes.json
curl -d "@hermes.json" -H "Content-Type: application/json" -X POST localhost:$PORT/api/send
There is a notification endpoint api/events/$ID/status
you could subscribe to receive
sms delivery notications. There is a helping script you could use to run an example:
./scripts/send.sh
- You can build a docker image
task image