Twilio (twilio_elixir v0.1.1)

Copy Markdown View Source

Elixir SDK for the Twilio API.

Quick Start

# Configure in config/runtime.exs
config :twilio_elixir,
  account_sid: System.fetch_env!("TWILIO_ACCOUNT_SID"),
  auth_token: System.fetch_env!("TWILIO_AUTH_TOKEN")

# Create a client and make API calls
client = Twilio.client()
{:ok, message} = Twilio.Api.V2010.MessageService.create(client, %{
  "To" => "+15551234567",
  "From" => "+15559876543",
  "Body" => "Hello from Elixir!"
})

Summary

Functions

Create a client from application config.

Create a client with explicit credentials.

Create a client with explicit credentials and options.

Returns the SDK version.

Functions

client()

@spec client() :: Twilio.Client.t()

Create a client from application config.

Reads :account_sid and :auth_token from :twilio_elixir app env.

client(account_sid, auth_token)

@spec client(String.t(), String.t()) :: Twilio.Client.t()

Create a client with explicit credentials.

client(account_sid, auth_token, opts)

@spec client(String.t(), String.t(), keyword()) :: Twilio.Client.t()

Create a client with explicit credentials and options.

Options

  • :region - Twilio region
  • :edge - Twilio edge location
  • :max_retries - Maximum retry attempts
  • :account_sid - Override account SID for subaccounts

version()

@spec version() :: String.t()

Returns the SDK version.