Nuntly.Webhooks (nuntly v0.1.0)

Copy Markdown View Source

Register HTTP endpoints to receive real-time delivery events such as bounces, opens, and clicks.

Summary

Functions

create_webhook(client, body, opts \\ [])

Create Webhook

Register an endpoint to start receiving webhook events for your organization.

Arguments

  • client — A Nuntly.Client returned by Nuntly.new/1.
  • body — application/json request body using CreateWebhookRequest. Accepted fields:
    • "name" (string, optional) — The name of the webhook
    • "endpointUrl" (string, required) — The endpoint URL of the webhook
    • "status" (string, optional) — The status of the webhook.
    • "events" (list of string, required) — The event types to subscribe to
  • opts — Optional keyword list passed to Req for this request.

Example

client = Nuntly.new(api_key: "ntly_...")

Nuntly.Webhooks.create_webhook(
  client,
  %{
    "endpointUrl" => "https://example.com/webhooks",
    "events" => ["email.queued"]
  }
)

delete_webhook(client, id, opts \\ [])

Delete Webhook

Remove a webhook endpoint. No further events will be delivered to this URL.

Arguments

  • client — A Nuntly.Client returned by Nuntly.new/1.
  • id — Required path parameter, string. The id of the webhook
  • opts — Optional keyword list passed to Req for this request.

Example

client = Nuntly.new(api_key: "ntly_...")

Nuntly.Webhooks.delete_webhook(client, "id")

list_webhooks(client, params \\ %{}, opts \\ [])

List Webhooks

Returns all registered webhook endpoints for the organization.

Arguments

  • client — A Nuntly.Client returned by Nuntly.new/1.
  • params — Optional map of query parameters:
    • "cursor" — Optional query parameter, string. Pagination cursor from a previous response
    • "limit" — Optional query parameter, integer. Maximum number of items to return Defaults to 30.
  • opts — Optional keyword list passed to Req for this request.

Example

client = Nuntly.new(api_key: "ntly_...")

Nuntly.Webhooks.list_webhooks(
  client,
  %{
    "cursor" => "cursor",
    "limit" => 30
  }
)

retrieve_webhook(client, id, opts \\ [])

Retrieve Webhook

Returns a webhook endpoint with its URL, subscribed events, and configuration.

Arguments

  • client — A Nuntly.Client returned by Nuntly.new/1.
  • id — Required path parameter, string. The id of the webhook
  • opts — Optional keyword list passed to Req for this request.

Example

client = Nuntly.new(api_key: "ntly_...")

Nuntly.Webhooks.retrieve_webhook(client, "id")

update_webhook(client, id, body, opts \\ [])

Update Webhook

Update the endpoint URL, subscribed event types, or rotate the signing secret.

Arguments

  • client — A Nuntly.Client returned by Nuntly.new/1.
  • id — Required path parameter, string. The id of the webhook
  • body — application/json request body using UpdateWebhookRequest. Accepted fields:
    • "name" (string, optional) — The name of the webhook
    • "endpointUrl" (string, optional) — The endpoint URL of the webhook
    • "events" (list of string, optional) — The event types to subscribe to
    • "status" (string, optional) — The status of the webhook.
    • "rotateSecret" (boolean, optional) — If true, a new signing secret will be generated
  • opts — Optional keyword list passed to Req for this request.

Example

client = Nuntly.new(api_key: "ntly_...")

Nuntly.Webhooks.update_webhook(
  client,
  "id",
  %{
    "name" => "Production webhook"
  }
)