Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/johnhamelink/sms_blitz
Send SMS messages through multiple different providers
https://github.com/johnhamelink/sms_blitz
elixir elixir-lang itagg nexmo phoenix plivo sms-api sms-blitz sms-messages telecom telephony twilio
Last synced: about 2 months ago
JSON representation
Send SMS messages through multiple different providers
- Host: GitHub
- URL: https://github.com/johnhamelink/sms_blitz
- Owner: johnhamelink
- License: mit
- Created: 2016-04-04T00:10:15.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-02-14T09:23:56.000Z (almost 6 years ago)
- Last Synced: 2024-04-25T05:40:53.770Z (8 months ago)
- Topics: elixir, elixir-lang, itagg, nexmo, phoenix, plivo, sms-api, sms-blitz, sms-messages, telecom, telephony, twilio
- Language: Elixir
- Homepage: https://hex.pm/packages/sms_blitz
- Size: 60.5 KB
- Stars: 31
- Watchers: 5
- Forks: 8
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SmsBlitz
[![Build Status](https://travis-ci.org/johnhamelink/sms_blitz.svg?branch=master)](https://travis-ci.org/johnhamelink/sms_blitz)SmsBlitz is a library for elixir that allows you to send SMS messages through multiple different providers.
SmsBlitz provides a generic behaviour to make it easy to write conforming client libraries, while also making it simple for developers to choose which provider to use (you could use [ex_phone_number](https://github.com/socialpaymentsbv/ex_phone_number) to detect the destination country and use the cheapest provider for that country, for example).
## Installation
If [available in Hex](https://hex.pm/docs/publish), the package can be installed as:
1. Add sms_blitz to your list of dependencies in `mix.exs`:
```elixir
def deps do
[{:sms_blitz, "~> 0.1.1"}]
end
```2. Ensure sms_blitz is started before your application:
```elixir
def application do
[applications: [:sms_blitz]]
end
```## Setup
Setting up with SmsBlitz is easy. You simply add the authentication details for the providers you want to use into to your config:
```elixir
config :sms_blitz, plivo: {"api_token", "api_key"}
config :sms_blitz, itagg: {"username", "password", "route"}
config :sms_blitz, twilio: {"account_sid", "auth_token"}
config :sms_blitz, nexmo: {"account_key", "account_secret"}
```You can find out which adapters are available like so (note that the list of adapters is not the same as the list of adapters which has been configured correctly!):
```elixir
SmsBlitz.adapters
# [:plivo, :itagg, :twilio, :nexmo]
```Then you can send the SMS to the provider as simply as this:
```elixir
SmsBlitz.send_sms(:adapter, from: "Johnny", to: "07123456789", message: "Here's Johnny!")
```Where `:adapter` is the adapter you've chosen from the list.
The output of the `send_sms/2` command above will either be like:
```elixir
%{
id: "id here",
result_string: "Things went well",
status_code: "1337"
}
```Or an Array of maps formatted as above. **It's important that you handle both types of responses!**