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

# WebhooksClient

> Methods for X API v2 Webhooks endpoints.

Access **Webhooks** endpoints via `client.webhooks` (`WebhooksClient`).

## Methods

| Method | Endpoint | Behavior | Summary |
| :- | :- | :- | :- |
| [`create`](#create) | `POST /2/webhooks` | Standard | Create Webhook |
| [`create_stream_link`](#create_stream_link) | `POST /2/tweets/search/webhooks/{webhook_id}` | Standard | Create Stream Link |
| [`create_webhook_replay_job`](#create_webhook_replay_job) | `POST /2/webhooks/replay` | Standard | Create Replay Job for Webhook |
| [`delete`](#delete) | `DELETE /2/webhooks/{webhook_id}` | Standard | Delete Webhook |
| [`delete_stream_link`](#delete_stream_link) | `DELETE /2/tweets/search/webhooks/{webhook_id}` | Standard | Delete Stream Link |
| [`get`](#get) | `GET /2/webhooks` | Standard | Get Webhook |
| [`get_stream_links`](#get_stream_links) | `GET /2/tweets/search/webhooks` | Standard | Get Stream Links |
| [`validate`](#validate) | `PUT /2/webhooks/{webhook_id}` | Standard | Validate Webhook |

## `create`

POST `/2/webhooks`

**Create Webhook**

Creates a new webhook configuration.

```ruby theme={null}
require "xdk"

client = Xdk::Client.new(bearer_token: ENV.fetch("X_BEARER_TOKEN"))

response = client.webhooks.create(body: { "url" => "https://example.com/webhook" })
puts response
```

### Parameters

**body** `Hash` *required*

Request payload.

**Returns:** `Hash`

***

## `create_stream_link`

POST `/2/tweets/search/webhooks/{webhook_id}`

**Create Stream Link**

Creates a link to deliver FilteredStream events to the given webhook.

```ruby theme={null}
require "xdk"

client = Xdk::Client.new(bearer_token: ENV.fetch("X_BEARER_TOKEN"))

response = client.webhooks.create_stream_link(webhook_id: "1234567890")
puts response
```

### Parameters

**webhook\_id** `String` *required*

`webhook_id` (path parameter).

**Returns:** `Hash`

***

## `create_webhook_replay_job`

POST `/2/webhooks/replay`

**Create Replay Job for Webhook**

Creates a replay job to retrieve events from up to the past 24 hours for all events delivered or attempted to be delivered to the webhook.

```ruby theme={null}
require "xdk"

client = Xdk::Client.new(bearer_token: ENV.fetch("X_BEARER_TOKEN"))

response = client.webhooks.create_webhook_replay_job(
  body: { "webhook_id" => "1234567890", "from_date" => "example", "to_date" => "example" }
)
puts response
```

### Parameters

**body** `Hash` *required*

Request payload.

**Returns:** `Hash`

***

## `delete`

DELETE `/2/webhooks/{webhook_id}`

**Delete Webhook**

Deletes an existing webhook configuration.

```ruby theme={null}
require "xdk"

client = Xdk::Client.new(bearer_token: ENV.fetch("X_BEARER_TOKEN"))

response = client.webhooks.delete(webhook_id: "1234567890")
puts response
```

### Parameters

**webhook\_id** `String` *required*

`webhook_id` (path parameter).

**Returns:** `Hash`

***

## `delete_stream_link`

DELETE `/2/tweets/search/webhooks/{webhook_id}`

**Delete Stream Link**

Deletes the link delivering FilteredStream events to the given webhook.

```ruby theme={null}
require "xdk"

client = Xdk::Client.new(bearer_token: ENV.fetch("X_BEARER_TOKEN"))

response = client.webhooks.delete_stream_link(webhook_id: "1234567890")
puts response
```

### Parameters

**webhook\_id** `String` *required*

`webhook_id` (path parameter).

**Returns:** `Hash`

***

## `get`

GET `/2/webhooks`

**Get Webhook**

Get a list of webhook configs associated with a client app.

```ruby theme={null}
require "xdk"

client = Xdk::Client.new(bearer_token: ENV.fetch("X_BEARER_TOKEN"))

response = client.webhooks.get
puts response
```

### Parameters

**Optional keyword arguments (1)**

**webhook\_config\_fields** `Array\<String\>`

A comma separated list of WebhookConfig fields to display.

**Returns:** `Hash`

***

## `get_stream_links`

GET `/2/tweets/search/webhooks`

**Get Stream Links**

Get a list of webhook links associated with a filtered stream ruleset.

```ruby theme={null}
require "xdk"

client = Xdk::Client.new(bearer_token: ENV.fetch("X_BEARER_TOKEN"))

response = client.webhooks.get_stream_links
puts response
```

**Returns:** `Hash`

***

## `validate`

PUT `/2/webhooks/{webhook_id}`

**Validate Webhook**

Triggers a CRC check for a given webhook.

```ruby theme={null}
require "xdk"

client = Xdk::Client.new(bearer_token: ENV.fetch("X_BEARER_TOKEN"))

response = client.webhooks.validate(webhook_id: "1234567890")
puts response
```

### Parameters

**webhook\_id** `String` *required*

`webhook_id` (path parameter).

**Returns:** `Hash`

***
