Sign inSign up

gunet/simple-sms-server

By gunet

•Updated 12 months ago

A simple Flask based GUNet SMS server look-alike

Buildkit cache
Image
0

437

gunet/simple-sms-server repository overview

⁠Description

A simple Flask based GUNet SMS server look-alike. Does the following:

  • Accepts a JSON request. The request should follow the GUNet SMS aggregator API specification⁠
{
  "serviceId": "<service name>",
  "messageId": "<message-id>",
  "recipient": "<phone number>",
  "institution": "<institution name>",
  "pre-shared key": "<key>",
  "replacements": ["<string1>", "<string2>", "..."] // optional
}

  • Prints the received data
  • If a required field is missing, it responds with an error:
{
   "serviceId": "data[serviceId]",
   "errorCode": "E-001",
   "error": "Missing fields: {', '.join(missing_fields)}"
}
  • Otherwise it responds with a JSON success:
{
   "serviceId": "data[serviceId]",
   "errorCode": "",
   "error": ""
}

⁠Usage

  • Build
    • docker compose -f docker-compose.build.yaml build sms-server
    • In sms folder: docker build -t gunet/simple-sms-server .
  • Run
    • Included in the docker-compose.testers.yaml (listens of port 5000)
    • docker run --rm --name sms-server -p 5000:80 gunet/simple-sms-server (will remain in foreground)
  • Test using curl:
curl -X POST http://localhost:5000/sendSMS \
  -H "Content-Type: application/json" \
  -d '{
    "serviceId": "gradeService",
    "messageId": "12345",
    "recipient": "+123456789",
    "institution": "SomeSchool",
    "pre-shared key": "SECRET123"
  }'

Tag summary

Content type

Image

Digest

sha256:f046ef060…

Size

51.9 MB

Last updated

12 months ago

docker pull gunet/simple-sms-server