Miosa.Webhooks (Miosa v1.0.1)

Copy Markdown View Source

Tenant-level outgoing webhooks — CRUD, test delivery, and delivery history.

Mutating calls (create, update, test) send an Idempotency-Key header automatically.

Example

client = Miosa.client(System.fetch_env!("MIOSA_API_KEY"))

{:ok, wh} = Miosa.Webhooks.create(client, %{
  url: "https://api.example.com/hooks/miosa",
  events: ["computer.started", "computer.stopped"],
  secret: "whsec_..."
})

{:ok, _} = Miosa.Webhooks.test(client, wh["id"])
{:ok, deliveries} = Miosa.Webhooks.deliveries(client, wh["id"])

Summary

Functions

Create a webhook.

Delete a webhook by ID.

List recent delivery attempts for a webhook.

Fetch a webhook by ID.

List webhooks for the authenticated tenant.

Send a test event to verify the webhook endpoint is reachable.

Functions

create(client, attrs)

@spec create(Miosa.Client.t(), map()) :: Miosa.Client.result(map())

Create a webhook.

Required: :url, :events (list of event type strings). Optional: :secret, :enabled, :metadata, :idempotency_key.

delete(client, webhook_id)

@spec delete(Miosa.Client.t(), String.t()) :: Miosa.Client.result(map())

Delete a webhook by ID.

deliveries(client, webhook_id, filters \\ [])

@spec deliveries(Miosa.Client.t(), String.t(), keyword() | map()) ::
  Miosa.Client.result(map())

List recent delivery attempts for a webhook.

Accepts optional filters as a keyword list or map (e.g. :limit, :cursor).

get(client, webhook_id)

Fetch a webhook by ID.

list(client, filters \\ [])

@spec list(Miosa.Client.t(), keyword() | map()) :: Miosa.Client.result(map())

List webhooks for the authenticated tenant.

Accepts optional filters as a keyword list or map (e.g. :limit, :cursor).

test(client, webhook_id)

Send a test event to verify the webhook endpoint is reachable.

update(client, webhook_id, attrs)

@spec update(Miosa.Client.t(), String.t(), map()) :: Miosa.Client.result(map())

Update a webhook.

Pass any fields to update; nil values are dropped.