sync-message-server

command module
v0.0.0-...-7e70b02 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2021 License: MIT Imports: 20 Imported by: 0

README

sync-message-server

sync-message-server converts Plivo's messaging (SMS, MMS) API from async to sync.

Usage

$ # Edit config.go
$ go build
$ ./sync-message-server
2021/08/19 23:13:35 started reverse proxy; addr=:8090
2021/08/19 23:13:35 started callback server; addr=:8091
2021/08/19 23:37:37 responding; body={"message_uuid":"54ada4a2-0118-11ec-8ca5-0242ac110006","message_state":"sent","message_time":"2021-08-19 18:07:35.315189","sent_time":"2021-08-19 18:07:37.280569","total_rate":"0.03800","total_amount":"0.03800","units":1,"error_code":""}

Example request and response:

$ curl -s -u MAXXXXXXXXXXXXXXXXXX:YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY -X POST http://localhost:8090/v1/Account/MAXXXXXXXXXXXXXXXXXX/Message/ -H 'content-type: application/json' -d '{
  "src" : "+1 xxx-xxx-xxx",
  "dst" :"+91 xxx-xxx-xxx",
  "text" : "Hello World!"
}' | python -m json.tool
{
    "error_code": "",
    "message_state": "sent",
    "message_time": "2021-08-19 18:07:35.315189",
    "message_uuid": "54ada4a2-0118-11ec-8ca5-0242ac110006",
    "sent_time": "2021-08-19 18:07:37.280569",
    "total_amount": "0.03800",
    "total_rate": "0.03800",
    "units": 1
}

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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