Skip to content

rugwirobaker/hermes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hermes

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.

Goals

  • 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

Environment variables

To function Hermes requires a couple of environment variables:

cat .template.env
PORT=8080
PINDO_API_KEY="pindo.io api key"
HERMES_SENDER_IDENTITY="who is sending the message"

This uses https://pindo.io so you'll have to create an account and an API KEY.

Try hermes

To start Hermes on your laptop:

  1. git clone this repository

  2. source the environment variables

cp .template.env .env
# edit the file .env with variables and credentials the source the file
source .env
  1. 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
  1. check hermes version via /api/version
# source .env

curl localhost:$PORT/api/version
  1. 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
  1. You can build a docker image
task image