Elixir client for the SMS Gora SMS Gateway API.
SMS Gora turns Android phones with ordinary SIM cards into an SMS gateway: your server calls the API, a linked phone sends the text, and replies and delivery reports come back.
client = SmsGora.new(System.fetch_env!("SMSGORA_KEY"))
{:ok, %{"message_ids" => [id]}} = SmsGora.send_sms(client, "+15551234567", "Your code is 482913")Every function returns {:ok, data} (the decoded data field of the answer) or
{:error, %SmsGora.Error{}}. Keep the API key on your server.
API reference: https://tekservix.com/smsgora/docs/
Summary
Functions
Cancels a queued or scheduled message.
Registers a webhook. Options: :events (default ["sms.received"]), :device_id.
The answer includes the secret, returned only once.
Deletes a webhook.
Account, plan and usage.
One bulk batch.
One phone.
One message. Status is queued, dispatched, sent, delivered, failed or cancelled.
Your linked Android phones.
Sent and received messages. Filters: direction, status, device_id, phone, since, after_id, page, limit.
Incoming SMS for all phones, or one phone with device_id:. Other filters as in list_messages/2.
Your webhooks.
Creates a client with your API key (starts with sgk_, from SMS Gora -> API keys).
Calls any documented endpoint, e.g. request(client, :get, "/devices").
Returns the data field of the answer.
Different texts for different people in one call (up to 5,000 recipients).
Sends an SMS to one number or a list (up to 1,000). Uses your best online phone unless
:device_id is given. Returns {:ok, %{"message_ids" => [...]}}.
Checks the X-SmsGora-Signature header (sha256=<hex HMAC-SHA256 of the raw body>).
Pass the raw request body exactly as received, before JSON parsing.
Types
@type result() :: {:ok, term()} | {:error, SmsGora.Error.t()}
Result of every API call.
@type t() :: %SmsGora{req: Req.Request.t()}
A client. Create one with new/2 and reuse it.
Functions
Cancels a queued or scheduled message.
Registers a webhook. Options: :events (default ["sms.received"]), :device_id.
The answer includes the secret, returned only once.
Deletes a webhook.
Account, plan and usage.
One bulk batch.
One phone.
One message. Status is queued, dispatched, sent, delivered, failed or cancelled.
Your linked Android phones.
Sent and received messages. Filters: direction, status, device_id, phone, since, after_id, page, limit.
Incoming SMS for all phones, or one phone with device_id:. Other filters as in list_messages/2.
Your webhooks.
Creates a client with your API key (starts with sgk_, from SMS Gora -> API keys).
Options:
:base_url- change only for testing:receive_timeout- milliseconds to wait for an answer (default 30_000):req_options- extra options passed toReq.new/1(proxy, plug for tests, ...)
Calls any documented endpoint, e.g. request(client, :get, "/devices").
Returns the data field of the answer.
Different texts for different people in one call (up to 5,000 recipients).
SmsGora.send_bulk_sms(client, 42, [
%{recipients: ["+15551234567"], message: "Hi Aline, parcel #1042 is ready."},
%{recipients: ["+15557654321"]}
], message_template: "Hello, your parcel is ready for pickup.")
Sends an SMS to one number or a list (up to 1,000). Uses your best online phone unless
:device_id is given. Returns {:ok, %{"message_ids" => [...]}}.
Options: :device_id, :sim_slot (0 = SIM 1, 1 = SIM 2), :schedule_at
(DateTime or ISO 8601 string).
Checks the X-SmsGora-Signature header (sha256=<hex HMAC-SHA256 of the raw body>).
Pass the raw request body exactly as received, before JSON parsing.
In Phoenix, keep the raw body with a custom body_reader in Plug.Parsers, then:
SmsGora.verify_webhook(raw_body, get_req_header(conn, "x-smsgora-signature") |> List.first(), secret)