Outkit.Message (Outkit v0.0.5) View Source

This module lets you render/send or retrieve a message using Outkit’s API.

Example

# Create a message
{:ok, message} = Outkit.Message.create(%{
  type: "email",                   # Message type - 'email' and 'sms' currently supported
  project: "my-project",           # Outkit project identifier (managed through our web UI)
  template: "my-template",         # Template identifier (managed through our web UI)
  subject: "Welcome, Jane!",       # Email subject (optional, can also be set in the template or omitted for SMS messages)
  to: "some.name@example.com",     # Recipient address (and optional name)
  from: "other.name@example.com",  # Sender address (and optional name)
  data: %{
      name: "John Doe",
      # ...
      # Add the values for any variables used in the template here
  },
})

# Retrieve a message
{:ok, message} = Outkit.Message.get("some-id")

Link to this section Summary

Functions

Create a message based on a map. The client will be derived from your configuration.

Create a message based on a map. Uses an Outkit.Client.

Retrieve a message using an id. The client will be derived from your configuration.

Retrieve a message using an Outkit.Client and an id.

Creates a new Outkit.Message struct. Mostly used indirectly through the get and create functions.

Link to this section Functions

Create a message based on a map. The client will be derived from your configuration.

Examples

create(%{
  type: "email",
  project: "acme-project",
  template: "welcome",
})

Create a message based on a map. Uses an Outkit.Client.

Examples

client = Outkit.Client.new(key: "my-key", secret: "my-secret", passphrase: "my-passphrase")
create(client, %{
  type: "email",
  project: "acme-project",
  template: "welcome",
})

Retrieve a message using an id. The client will be derived from your configuration.

Examples

get("some-id")

Retrieve a message using an Outkit.Client and an id.

Examples

client = Outkit.Client.new(key: "my-key", secret: "my-secret", passphrase: "my-passphrase")
get(client, "some-id")

Creates a new Outkit.Message struct. Mostly used indirectly through the get and create functions.

Examples

new(%{
  type: "email",
  project: "acme-project",
  template: "welcome",
})