Giter VIP home page Giter VIP logo

sms-api-server's Introduction

HTTP API for sending SMS via SMPP

The sms-api-server is a web server that connects to an SMSC via SMPP v3.4. It provides HTTP and WebSocket APIs for sending short messages and querying their status (when supported by the SMSC). It supports sending delivery receipts via WebSockets or Server-Sent Events.

Build Status

Running

Developers can build the source code and run. For everyone else, the easiest way to run is via Docker:

docker run --rm -i -t fiorix/sms-api-server [--help]

See this link on the Docker hub for details.

Usage

With the server running, send a message:

curl localhost:8080/v1/send -X POST -F src=bart -F dst=lisa -F text=hi

In case of success, the server returns a JSON document containing a message ID that can be used for querying its delivery status later. This functionality is not always available on some SMSCs.

Example:

curl "localhost:8080/v1/query?src=bart&message_id=1234"

To watch for incoming SMS, or delivery receipts:

curl localhost:8080/v1/sse

This is the Server-Sent Events (SSE) endpoint that deliver messages as events, as they arrive on the server.

Send parameters

The /v1/send endpoint supports the following parameters:

  • src: number of sender (optional)
  • dst: number of recipient
  • text: text message, encoded as UTF-8
  • enc: text encoding for short message: latin1 or ucs2 (optional)
  • register: register for delivery: final or failure (optional)

If an encoding is not provided, data is sent as a binary blob and may not display correctly on some devices.

For special characters, try:

curl localhost:8080/v1/send -X POST -F dst=foobar -F enc=ucs2 -F text="é nóis"

WebSocket API

This server provides two websocket APIs:

  • One for sending messages and querying for message status
  • One for sending delivery receipts

See index.html for details.

Have fun!

sms-api-server's People

Contributors

fiorix avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.