API Reference Unicom360 v#0.1.0

Copy Markdown View Source

Modules

The official Elixir client for the Unicom360 API: SMS, email and WhatsApp over one JSON API.

Account balances (POST /api/v1/json/balance and /balance/all), and the struct get/2 returns (canonical name Balance).

The result of Unicom360.Balance.all/2 (canonical name Balances).

A configured, immutable Unicom360 client.

The normalised error codes, and the function that derives them from the gateway's messages.

Send email (POST /api/v1/json/bulk/email).

One recipient of an email send (canonical name EmailResult).

The result of Unicom360.Email.send/3 (canonical name EmailSendResult).

The one error type of the SDK.

Opt-in GSM-7 helpers: the gateway's own answers about an SMS text, before you send it.

The result of Unicom360.health/2 (canonical name Health): status ("ok"), timestamp (an ISO 8601 string, as received), version, environment, raw and extra.

Send SMS (POST /api/v1/json/bulk/sms).

One recipient of an SMS send (canonical name SmsResult).

The result of Unicom360.SMS.send/3 (canonical name SmsSendResult).

A transport failure that states the two facts the retry rules need.

Verify and parse Unicom360 webhooks, and parse the unsigned SMS and email delivery reports.

A Plug.Parsers body reader that keeps the raw body in conn.assigns.raw_body.

An email delivery report, from Unicom360.Webhook.parse_email_callback/1: message_id (a string, though the wire sends a number), status ("SENT", "DELIVERED", "FAILED"; open), email_address, message, raw and extra.

The behaviour of the module Unicom360.Webhook.Plug calls with each verified event.

The media of an inbound WhatsApp message: id, mime_type and filename (nil unless a document), plus raw and extra. A caption arrives in the message's text, not here.

The data of a message.received event.

A verified message.received webhook delivery, from Unicom360.Webhook.construct_event/4.

The data of a message.status event.

A verified message.status webhook delivery, from Unicom360.Webhook.construct_event/4.

A plug that receives Unicom360 webhooks: it verifies the signature, parses the event and calls your handler.

An SMS delivery report, from Unicom360.Webhook.parse_sms_callback/1: message_id, status ("SENT", "DELIVERED", "FAILED", "UNKNOWN_ERROR"; open), mobile_number, raw and extra.

A verified webhook.test webhook delivery, from Unicom360.Webhook.construct_event/4.

The data of a webhook.test event: message, raw and extra.

A verified webhook delivery of an event this version does not know. Never an error.

WhatsApp Business messaging: approved templates, session messages inside the 24-hour customer service window, message status and the template list.

A row of an interactive list message (Unicom360.WhatsApp.Session.list/5). The builder also takes maps.

A section of an interactive list message (Unicom360.WhatsApp.Session.list/5): rows of Unicom360.WhatsApp.ListRow, with an optional title. The builder also takes maps.

Why a WhatsApp message failed: Meta's error code (an integer, or nil) and its message.

The status of one WhatsApp message (canonical name MessageStatus).

A reply button of an interactive buttons message (Unicom360.WhatsApp.Session.buttons/4). The builder also takes {id, title} tuples and maps.

Builders for WhatsApp session messages, sent with Unicom360.WhatsApp.send_session/3 inside the 24-hour customer service window.

The result of Unicom360.WhatsApp.send_session/3 (canonical name SessionSendResult).

The result of Unicom360.WhatsApp.status/3 (canonical name StatusResult): results, one Unicom360.WhatsApp.MessageStatus per distinct id asked for, plus api_reference, message, raw and extra.

A template recipient's body parameters: positional or named.

A template recipient's button parameter.

A button of an approved template (Unicom360.WhatsApp.TemplateInfo): index, type ("url", "quick_reply", "otp", ...; open), and text, url and otp_type when the type has them.

A template recipient's header parameter.

An approved WhatsApp template, as Unicom360.WhatsApp.templates/2 lists it.

An authentication template's otp_type and code_expiration_minutes.

A template's body: its text and the names of its variables.

A template's header: its type and the names of its variables.

The result of Unicom360.WhatsApp.templates/2 (canonical name TemplateList): templates, a list of Unicom360.WhatsApp.TemplateInfo, plus api_reference, message, raw and extra.

One recipient of a template send.

One recipient of a template send (canonical name TemplateResult).

The result of Unicom360.WhatsApp.send_template/3 (canonical name TemplateSendResult).