Aurinko.API.Webhooks (Aurinko v0.2.1)

Copy Markdown View Source

Aurinko Webhooks API — subscribe to push notifications for data changes.

Aurinko automatically manages webhook subscriptions and renewals. Your endpoint will receive push events when email, calendar, contacts, or tasks change.

Example

{:ok, sub} = Aurinko.Webhooks.create_subscription(token, %{
  resource: "email",
  notification_url: "https://yourapp.com/webhooks/aurinko",
  client_id: "optional-correlation-id"
})

Summary

Functions

Create a webhook subscription.

Delete a webhook subscription by ID.

List active webhook subscriptions.

Functions

create_subscription(token, params)

@spec create_subscription(String.t(), map()) ::
  {:ok, map()} | {:error, Aurinko.Error.t()}

Create a webhook subscription.

Parameters

  • :resource — Resource to subscribe to: "email", "calendar", "contacts", "tasks" (required)
  • :notification_url — Your HTTPS endpoint to receive events (required)
  • :client_id — Optional client correlation string
  • :expiration — Optional expiration datetime

delete_subscription(token, id)

@spec delete_subscription(String.t(), String.t()) :: :ok | {:error, Aurinko.Error.t()}

Delete a webhook subscription by ID.

list_subscriptions(token, opts \\ [])

@spec list_subscriptions(
  String.t(),
  keyword()
) :: {:ok, [map()]} | {:error, Aurinko.Error.t()}

List active webhook subscriptions.