> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vzaps.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Webhooks

> Configure webhooks and inspect delivery logs with the Go SDK

Use `client.Webhooks` to receive VZaps events via HTTP callbacks in your application.

Common fields on every call:

| Field           | Type     | Required | Description     |
| --------------- | -------- | -------- | --------------- |
| `InstanceID`    | `string` | Yes      | Instance ID.    |
| `InstanceToken` | `string` | Yes      | Instance token. |

## `Webhooks.Get(ctx, instanceID, options)`

Reads the current webhook configuration.

```go theme={null}
webhook, err := client.Webhooks.Get(ctx, "VZ...", vzaps.InstanceOptions{
	InstanceToken: "instance-token",
})
fmt.Printf("%#v\n", webhook)
```

**Return:** envelope `{ code, success, data }` with `webhook` and `subscribe` (events).

## `Webhooks.Set(ctx, req)`

Sets the callback URL and subscribed events.

```go theme={null}
_, err := client.Webhooks.Set(ctx, vzaps.WebhookConfigRequest{
	InstanceScopedRequest: vzaps.InstanceScopedRequest{
		InstanceID:    "VZ...",
		InstanceToken: "instance-token",
	},
	WebhookURL: "https://example.com/webhooks/vzaps",
	Events:     []string{"Message", "ReadReceipt", "Connected", "Disconnected"},
})
```

**Return:** envelope `{ code, success, data }` with configured `webhook` and `events`.

| Field (JSON)  | Go field     | Required | Description                         |
| ------------- | ------------ | -------- | ----------------------------------- |
| `webhook_url` | `WebhookURL` | Yes      | Public URL that receives callbacks. |
| `events`      | `Events`     | No       | Subscribed events.                  |

Common events: `Message`, `ReadReceipt`, `Connected`, `Disconnected`, `Presence`, `ChatPresence`, `HistorySync`, `GroupParticipantsAdd`, `GroupParticipantsRemove`, `All`.

## `Webhooks.SearchLogs(ctx, req)`

Searches webhook delivery logs.

```go theme={null}
logs, err := client.Webhooks.SearchLogs(ctx, vzaps.WebhookLogSearchRequest{
	InstanceScopedRequest: vzaps.InstanceScopedRequest{
		InstanceID:    "VZ...",
		InstanceToken: "instance-token",
	},
})
fmt.Printf("%#v\n", logs)
```

**Return:** envelope `{ code, success, data }` with paginated logs (`content[]`, totals).

For advanced filters such as `status`, use `client.Request()` with the search endpoint body from the [API reference](/en/api-reference/introduction).

## `Webhooks.GetLog(ctx, req)`

Reads one specific delivery log.

```go theme={null}
log, err := client.Webhooks.GetLog(ctx, vzaps.WebhookLogRequest{
	InstanceScopedRequest: vzaps.InstanceScopedRequest{
		InstanceID:    "VZ...",
		InstanceToken: "instance-token",
	},
	LogID: "log_123",
})
fmt.Printf("%#v\n", log)
```

**Return:** envelope `{ code, success, data }` with one delivery log (status, payload, attempts, etc.).

## `Webhooks.RetryLog(ctx, req)`

Retries a failed delivery.

```go theme={null}
_, err := client.Webhooks.RetryLog(ctx, vzaps.WebhookLogRequest{
	InstanceScopedRequest: vzaps.InstanceScopedRequest{
		InstanceID:    "VZ...",
		InstanceToken: "instance-token",
	},
	LogID: "log_123",
})
```

**Return:** envelope `{ code, success, data }` confirming callback retry.

## When to use webhooks

Use webhooks when:

* your application already has a public URL for callbacks;
* you want to process events asynchronously in the backend;
* your integration pipeline already works with HTTP POST.

For bots, dashboards, and apps that need low latency without exposing a URL, prefer [Realtime](/en/sdk/go/realtime).
