# `Attio.Webhooks`
[🔗](https://github.com/sgerrand/ex_attio/blob/v0.2.0/lib/attio/webhooks.ex#L1)

Functions for managing webhook subscriptions.

Webhooks allow your application to receive real-time notifications when data
changes in Attio. Requires the `webhook:read` scope for read operations and
`webhook:read-write` for mutations.

# `create`

```elixir
@spec create(Attio.Client.t(), map()) :: {:ok, map()} | {:error, term()}
```

Creates a webhook.

## Required attributes

  * `"target_url"` - The HTTPS URL that will receive event payloads.
  * `"subscriptions"` - List of event subscription objects, each with an
    `"event_type"` field.

## Example

    Attio.Webhooks.create(client, %{
      "target_url" => "https://my-app.example.com/webhooks/attio",
      "subscriptions" => [
        %{"event_type" => "record.created"},
        %{"event_type" => "record.updated"}
      ]
    })

# `delete`

```elixir
@spec delete(Attio.Client.t(), String.t()) :: {:ok, map()} | {:error, term()}
```

Deletes a webhook.

# `get`

```elixir
@spec get(Attio.Client.t(), String.t()) :: {:ok, map()} | {:error, term()}
```

Gets a single webhook by its ID.

# `list`

```elixir
@spec list(Attio.Client.t()) :: {:ok, map()} | {:error, term()}
```

Lists all webhooks in the workspace.

# `update`

```elixir
@spec update(Attio.Client.t(), String.t(), map()) :: {:ok, map()} | {:error, term()}
```

Updates a webhook (e.g. to change its target URL or subscriptions).

---

*Consult [api-reference.md](api-reference.md) for complete listing*
