Skip to content

delight-data/sms_factor_elixir

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SMSFactor

Wrapper around SMSFactor API.

This package uses tesla as HTTP client.

Installation

If available in Hex, the package can be installed by adding sms_factor_elixir to your list of dependencies in mix.exs:

def deps do
  [
    {:sms_factor_elixir, "~> 0.3.0"}
  ]
end

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/sms_factor.

Configuration

You can configure your main API key with the following configuration :

config :sms_factor, main_api_key: <your_token>

Usage

The first you need is to create a Tesla.Client with the wanted token, it can be your main token or a sub-account token.

Once you have a client for the account you want to use, you can pass it to any wrapper function.

# Create client
client = SMSFactor.client("my_token")

# Send single SMS
sms_params = %{text: "Hello, World!", to: "3312345678"}
SMSFactor.SendSMS.single_message(client, sms_params)