> For the complete documentation index, see [llms.txt](https://developers.incidents.cloud.solarwinds.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.incidents.cloud.solarwinds.com/python-sdk/docs/sdks/webhooks.md).

# Webhooks

## Overview

### Available Operations

* [create](#create) - Create Webhook
* [delete](#delete) - Delete Webhook
* [get\_by\_id](#get_by_id) - Get Webhook By ID
* [update](#update) - Update Webhook

## create

Add webhook to the organization. Returns the webhook object in response. Requires `access_token` as a `Bearer {{token}}` in the `Authorization` header with `user-write` scope.

### Example Usage

```python
from squadcast import SquadcastSDK


with SquadcastSDK(
    refresh_token_auth="<YOUR_REFRESH_TOKEN_AUTH_HERE>",
) as squadcast_sdk:

    res = squadcast_sdk.webhooks.create(name="<value>", triggers=[], urls=[
        {},
    ], trigger_type="<value>")

    # Handle response
    print(res)

```

### Parameters

| Parameter                      | Type                                                                                                                                                                          | Required             | Description                                                         |
| ------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------- | ------------------------------------------------------------------- |
| `name`                         | *str*                                                                                                                                                                         | :heavy\_check\_mark: | Name of the webhook                                                 |
| `triggers`                     | List\[[models.V3ExtensionsWebhooksWebhookTrigger](https://developers.incidents.cloud.solarwinds.com/python-sdk/docs/models/v3extensionswebhookswebhooktrigger.md)]            | :heavy\_check\_mark: | A list of triggers for this webhook                                 |
| `urls`                         | List\[[models.V3ExtensionsWebhooksWebhookURL](https://developers.incidents.cloud.solarwinds.com/python-sdk/docs/models/v3extensionswebhookswebhookurl.md)]                    | :heavy\_check\_mark: | A list of URLs to which the webhook payload will be sent            |
| `trigger_type`                 | *str*                                                                                                                                                                         | :heavy\_check\_mark: | Type of trigger                                                     |
| `description`                  | *Optional\[str]*                                                                                                                                                              | :heavy\_minus\_sign: | Description of the webhook                                          |
| `header`                       | [OptionalNullable\[models.V3ExtensionsWebhooksWebhookHeader\]](https://developers.incidents.cloud.solarwinds.com/python-sdk/docs/models/v3extensionswebhookswebhookheader.md) | :heavy\_minus\_sign: | Headers to be sent with the webhook                                 |
| `filters`                      | [OptionalNullable\[models.V3ExtensionsWebhooksWebhookFilter\]](https://developers.incidents.cloud.solarwinds.com/python-sdk/docs/models/v3extensionswebhookswebhookfilter.md) | :heavy\_minus\_sign: | Filters to apply to the webhook                                     |
| `max_retry`                    | *Optional\[int]*                                                                                                                                                              | :heavy\_minus\_sign: | Maximum number of retries for the webhook                           |
| `teams`                        | List\[*str*]                                                                                                                                                                  | :heavy\_minus\_sign: | List of team IDs to which this webhook is applicable                |
| `is_all_teams_configured`      | *Optional\[bool]*                                                                                                                                                             | :heavy\_minus\_sign: | Set to true if the webhook is configured for all teams              |
| `custom_payload_template_slug` | *Optional\[str]*                                                                                                                                                              | :heavy\_minus\_sign: | Slug of the custom payload template                                 |
| `language`                     | *Optional\[str]*                                                                                                                                                              | :heavy\_minus\_sign: | Language for the webhook payload                                    |
| `mail_ids`                     | List\[*str*]                                                                                                                                                                  | :heavy\_minus\_sign: | List of email IDs for notification                                  |
| `custom_payload`               | *Optional\[str]*                                                                                                                                                              | :heavy\_minus\_sign: | Custom payload for the webhook                                      |
| `payload_type`                 | *Optional\[str]*                                                                                                                                                              | :heavy\_minus\_sign: | Type of payload                                                     |
| `retries`                      | [Optional\[utils.RetryConfig\]](https://developers.incidents.cloud.solarwinds.com/python-sdk/docs/models/utils/retryconfig.md)                                                | :heavy\_minus\_sign: | Configuration to override the default retry behavior of the client. |

### Response

[**models.WebhooksCreateWebhookResponse**](https://developers.incidents.cloud.solarwinds.com/python-sdk/docs/models/webhookscreatewebhookresponse.md)

### Errors

| Error Type                      | Status Code | Content Type     |
| ------------------------------- | ----------- | ---------------- |
| errors.BadRequestError          | 400         | application/json |
| errors.UnauthorizedError        | 401         | application/json |
| errors.PaymentRequiredError     | 402         | application/json |
| errors.ForbiddenError           | 403         | application/json |
| errors.NotFoundError            | 404         | application/json |
| errors.ConflictError            | 409         | application/json |
| errors.UnprocessableEntityError | 422         | application/json |
| errors.InternalServerError      | 500         | application/json |
| errors.BadGatewayError          | 502         | application/json |
| errors.ServiceUnavailableError  | 503         | application/json |
| errors.GatewayTimeoutError      | 504         | application/json |
| errors.SDKDefaultError          | 4XX, 5XX    | \*/\*            |

## delete

Remove webhook from the organization. Upon success, the webhook will be removed from the organization. Requires `access_token` as a `Bearer {{token}}` in the `Authorization` header with `user-write` scope.

### Example Usage

```python
from squadcast import SquadcastSDK


with SquadcastSDK(
    refresh_token_auth="<YOUR_REFRESH_TOKEN_AUTH_HERE>",
) as squadcast_sdk:

    res = squadcast_sdk.webhooks.delete(event_webhook_id="<id>")

    # Handle response
    print(res)

```

### Parameters

| Parameter          | Type                                                                                                                           | Required             | Description                                                         |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------ | -------------------- | ------------------------------------------------------------------- |
| `event_webhook_id` | *str*                                                                                                                          | :heavy\_check\_mark: | (Required) event webhook ID                                         |
| `retries`          | [Optional\[utils.RetryConfig\]](https://developers.incidents.cloud.solarwinds.com/python-sdk/docs/models/utils/retryconfig.md) | :heavy\_minus\_sign: | Configuration to override the default retry behavior of the client. |

### Response

[**bytes**](https://github.com/solarwinds/squadcast-sdk-python/tree/main/squadcastv1/docs/models/.md/README.md)

### Errors

| Error Type                      | Status Code | Content Type     |
| ------------------------------- | ----------- | ---------------- |
| errors.BadRequestError          | 400         | application/json |
| errors.UnauthorizedError        | 401         | application/json |
| errors.PaymentRequiredError     | 402         | application/json |
| errors.ForbiddenError           | 403         | application/json |
| errors.NotFoundError            | 404         | application/json |
| errors.ConflictError            | 409         | application/json |
| errors.UnprocessableEntityError | 422         | application/json |
| errors.InternalServerError      | 500         | application/json |
| errors.BadGatewayError          | 502         | application/json |
| errors.ServiceUnavailableError  | 503         | application/json |
| errors.GatewayTimeoutError      | 504         | application/json |
| errors.SDKDefaultError          | 4XX, 5XX    | \*/\*            |

## get\_by\_id

Returns a webhooks details of the given `eventWebhookID` in the request param. Requires `access_token` as a `Bearer {{token}}` in the `Authorization` header with `read` scope.

### Example Usage

```python
from squadcast import SquadcastSDK


with SquadcastSDK(
    refresh_token_auth="<YOUR_REFRESH_TOKEN_AUTH_HERE>",
) as squadcast_sdk:

    res = squadcast_sdk.webhooks.get_by_id(event_webhook_id="<id>")

    # Handle response
    print(res)

```

### Parameters

| Parameter          | Type                                                                                                                           | Required             | Description                                                         |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------ | -------------------- | ------------------------------------------------------------------- |
| `event_webhook_id` | *str*                                                                                                                          | :heavy\_check\_mark: | (Required) event webhook ID                                         |
| `retries`          | [Optional\[utils.RetryConfig\]](https://developers.incidents.cloud.solarwinds.com/python-sdk/docs/models/utils/retryconfig.md) | :heavy\_minus\_sign: | Configuration to override the default retry behavior of the client. |

### Response

[**models.WebhooksGetWebhookByIDResponse**](https://developers.incidents.cloud.solarwinds.com/python-sdk/docs/models/webhooksgetwebhookbyidresponse.md)

### Errors

| Error Type                      | Status Code | Content Type     |
| ------------------------------- | ----------- | ---------------- |
| errors.BadRequestError          | 400         | application/json |
| errors.UnauthorizedError        | 401         | application/json |
| errors.PaymentRequiredError     | 402         | application/json |
| errors.ForbiddenError           | 403         | application/json |
| errors.NotFoundError            | 404         | application/json |
| errors.ConflictError            | 409         | application/json |
| errors.UnprocessableEntityError | 422         | application/json |
| errors.InternalServerError      | 500         | application/json |
| errors.BadGatewayError          | 502         | application/json |
| errors.ServiceUnavailableError  | 503         | application/json |
| errors.GatewayTimeoutError      | 504         | application/json |
| errors.SDKDefaultError          | 4XX, 5XX    | \*/\*            |

## update

Update organization webhook details. Requires `access_token` as a `Bearer {{token}}` in the `Authorization` header with `user-write` scope.

### Example Usage

```python
from squadcast import SquadcastSDK


with SquadcastSDK(
    refresh_token_auth="<YOUR_REFRESH_TOKEN_AUTH_HERE>",
) as squadcast_sdk:

    res = squadcast_sdk.webhooks.update(event_webhook_id="<id>", name="<value>", triggers=[
        {
            "event_class": "<value>",
            "event_type": "<value>",
        },
    ], urls=[
        {},
    ], trigger_type="<value>")

    # Handle response
    print(res)

```

### Parameters

| Parameter                      | Type                                                                                                                                                                          | Required             | Description                                                         |
| ------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------- | ------------------------------------------------------------------- |
| `event_webhook_id`             | *str*                                                                                                                                                                         | :heavy\_check\_mark: | N/A                                                                 |
| `name`                         | *str*                                                                                                                                                                         | :heavy\_check\_mark: | Name of the webhook                                                 |
| `triggers`                     | List\[[models.V3ExtensionsWebhooksWebhookTrigger](https://developers.incidents.cloud.solarwinds.com/python-sdk/docs/models/v3extensionswebhookswebhooktrigger.md)]            | :heavy\_check\_mark: | A list of triggers for this webhook                                 |
| `urls`                         | List\[[models.V3ExtensionsWebhooksWebhookURL](https://developers.incidents.cloud.solarwinds.com/python-sdk/docs/models/v3extensionswebhookswebhookurl.md)]                    | :heavy\_check\_mark: | A list of URLs to which the webhook payload will be sent            |
| `trigger_type`                 | *str*                                                                                                                                                                         | :heavy\_check\_mark: | Type of trigger                                                     |
| `description`                  | *Optional\[str]*                                                                                                                                                              | :heavy\_minus\_sign: | Description of the webhook                                          |
| `header`                       | [OptionalNullable\[models.V3ExtensionsWebhooksWebhookHeader\]](https://developers.incidents.cloud.solarwinds.com/python-sdk/docs/models/v3extensionswebhookswebhookheader.md) | :heavy\_minus\_sign: | Headers to be sent with the webhook                                 |
| `filters`                      | [OptionalNullable\[models.V3ExtensionsWebhooksWebhookFilter\]](https://developers.incidents.cloud.solarwinds.com/python-sdk/docs/models/v3extensionswebhookswebhookfilter.md) | :heavy\_minus\_sign: | Filters to apply to the webhook                                     |
| `max_retry`                    | *Optional\[int]*                                                                                                                                                              | :heavy\_minus\_sign: | Maximum number of retries for the webhook                           |
| `teams`                        | List\[*str*]                                                                                                                                                                  | :heavy\_minus\_sign: | List of team IDs to which this webhook is applicable                |
| `is_all_teams_configured`      | *Optional\[bool]*                                                                                                                                                             | :heavy\_minus\_sign: | Set to true if the webhook is configured for all teams              |
| `custom_payload_template_slug` | *Optional\[str]*                                                                                                                                                              | :heavy\_minus\_sign: | Slug of the custom payload template                                 |
| `language`                     | *Optional\[str]*                                                                                                                                                              | :heavy\_minus\_sign: | Language for the webhook payload                                    |
| `mail_ids`                     | List\[*str*]                                                                                                                                                                  | :heavy\_minus\_sign: | List of email IDs for notification                                  |
| `custom_payload`               | *Optional\[str]*                                                                                                                                                              | :heavy\_minus\_sign: | Custom payload for the webhook                                      |
| `payload_type`                 | *Optional\[str]*                                                                                                                                                              | :heavy\_minus\_sign: | Type of payload                                                     |
| `retries`                      | [Optional\[utils.RetryConfig\]](https://developers.incidents.cloud.solarwinds.com/python-sdk/docs/models/utils/retryconfig.md)                                                | :heavy\_minus\_sign: | Configuration to override the default retry behavior of the client. |

### Response

[**models.WebhooksUpdateWebhookResponse**](https://developers.incidents.cloud.solarwinds.com/python-sdk/docs/models/webhooksupdatewebhookresponse.md)

### Errors

| Error Type                      | Status Code | Content Type     |
| ------------------------------- | ----------- | ---------------- |
| errors.BadRequestError          | 400         | application/json |
| errors.UnauthorizedError        | 401         | application/json |
| errors.PaymentRequiredError     | 402         | application/json |
| errors.ForbiddenError           | 403         | application/json |
| errors.NotFoundError            | 404         | application/json |
| errors.ConflictError            | 409         | application/json |
| errors.UnprocessableEntityError | 422         | application/json |
| errors.InternalServerError      | 500         | application/json |
| errors.BadGatewayError          | 502         | application/json |
| errors.ServiceUnavailableError  | 503         | application/json |
| errors.GatewayTimeoutError      | 504         | application/json |
| errors.SDKDefaultError          | 4XX, 5XX    | \*/\*            |
