MillionSend.Broadcasts (MillionSend v0.4.0)

Copy Markdown View Source

Broadcasts. Create a draft, then send/3 it (optionally scheduled), or pass send: true (plus an optional scheduled_at) to create/2 to do both at once. Target with an optional segment_id and/or topic_id; neither means every contact of the team.

Input maps are sent as given: name, segment_id, from, subject, html, text, reply_to, preview_text, topic_id, and on create send and scheduled_at. On update/3, topic_id: nil clears the topic.

{:ok, b} = MillionSend.Broadcasts.create(%{
  from: "Acme <news@acme.dev>", subject: "Launch", html: "<p>hi</p>"
})
MillionSend.Broadcasts.send(b.id, scheduled_at: "2026-09-01T09:00:00Z")

Summary

Functions

POST /broadcasts/:id/cancel — scheduled only.

GET /broadcasts — accepts limit:, after:, before:.

DELETE /broadcasts/:id — draft only.

POST /broadcasts/:id/send — pass scheduled_at: to schedule, omit to send now.

PATCH /broadcasts/:id — draft only. topic_id: nil clears the topic.

Functions

cancel(client \\ MillionSend.client(), id)

POST /broadcasts/:id/cancel — scheduled only.

create(client \\ MillionSend.client(), params)

POST /broadcasts

get(client \\ MillionSend.client(), id)

GET /broadcasts/:id

list()

GET /broadcasts — accepts limit:, after:, before:.

list(client)

@spec list(MillionSend.Client.t() | keyword()) ::
  {:ok, MillionSend.List.t()} | {:error, MillionSend.Error.t()}

list(client, opts)

@spec list(
  MillionSend.Client.t(),
  keyword()
) :: {:ok, MillionSend.List.t()} | {:error, MillionSend.Error.t()}

remove(client \\ MillionSend.client(), id)

DELETE /broadcasts/:id — draft only.

send(id)

@spec send(String.t()) ::
  {:ok, MillionSend.Broadcasts.Broadcast.t()} | {:error, MillionSend.Error.t()}

POST /broadcasts/:id/send — pass scheduled_at: to schedule, omit to send now.

send(client, id)

send(client, id, opts)

update(client \\ MillionSend.client(), id, params)

PATCH /broadcasts/:id — draft only. topic_id: nil clears the topic.