sms-sender

command module
v0.0.0-...-b79fb73 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 26, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

README

Build Status Go Report Card codecov Maintainability

SMS service

Simple sms service that provides HTTP API to send text messages. It connects directly to SMS Center or SMS proxy of telecom operator using SMPP 3.4 procotol.

HTTP API description is available at http://${base-path}/swagger/index.html (the service must be running)

Examples of using HTTP API

  • Sending message (there might be more than one recipient phone):
curl localhost:8080/sms -H "Content-Type: application/json" -d '{"phones":["996XXXZZZZZZ"],"text":"hello", "sender":"awesome"}'

will return response containing id of message, which can be used later to check status of message delivery:

{"id":56}
  • Check status of message delivery
curl localhost:8080/sms/56
curl localhost:8080/sms/56?phone=996XXXZZZZZZ

response:

{
  "id": 56,
  "sender": "awesome",
  "text": "hello",
  "statuses": [
    {
      "phone": "996XXXZZZZZZ",
      "status": "DELIVRD"
    }
  ]
}

Message statues are stored N days in the service database (number of days can be configured in the service settings).

All settings are stored in the file .env; environment variables with the same names as in the .env file override the latter ones.

Delivery status reception

If WEB_HOOK is set to some non-empty URL, the service will send notifications about delivery status receipt (a separate update per each phone) to the specified http endpoint in the following form:

{
  "id": 56,
  "sender": "awesome",
  "text": "hello",
  "statuses": [
    {
      "phone": "996XXXZZZZZZ",
      "status": "DELIVRD"
    }
  ]
}

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
dto

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL