MillionSend.Webhooks (MillionSend v0.4.0)

Copy Markdown View Source

Webhooks. Input maps are sent as given: create/2 accepts endpoint, events and an optional signing_secret (carry over an existing whsec_ secret so the receiver keeps verifying unchanged); update/3 accepts endpoint, events and status.

MillionSend.Webhooks.create(%{
  endpoint: "https://acme.dev/hooks/email",
  events: ["email.delivered", "email.bounced"]
})

Summary

Functions

POST /webhooks — the response carries the signing_secret.

GET /webhooks/:id — includes the signing_secret.

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

PATCH /webhooks/:idendpoint, events, status (:enabled | :disabled).

Functions

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

@spec create(MillionSend.Client.t(), map()) ::
  {:ok, MillionSend.Webhooks.Webhook.t()} | {:error, MillionSend.Error.t()}

POST /webhooks — the response carries the signing_secret.

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

GET /webhooks/:id — includes the signing_secret.

list()

GET /webhooks — 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 /webhooks/:id

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

@spec update(MillionSend.Client.t(), String.t(), map()) ::
  {:ok, MillionSend.Webhooks.Webhook.t()} | {:error, MillionSend.Error.t()}

PATCH /webhooks/:idendpoint, events, status (:enabled | :disabled).