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

# Update Webhook

> Change the destination URL or configuration of an existing webhook registration 🔀

Update the destination URL or configuration of an existing webhook registration. Only the fields you include in the request body are changed — omitting a field keeps its current value.

<Note>
  You cannot change the `topic` of an existing registration. To switch topics, [delete](/webhooks/delete-webhook) the registration and [create](/webhooks/create-webhook) a new one.
</Note>

## Endpoint

```json theme={null}
PUT https://api.connectly.ai/v1/businesses/{businessId}/update/webhooks/{webhookId}
```

Retrieve the `webhookId` from the [Get webhooks](/webhooks/get-webhooks) response.

## Request body

<ParamField body="address" type="string">
  New destination URL. Must be a publicly accessible HTTPS endpoint.
</ParamField>

<ParamField body="configuration" type="object">
  Updated configuration. Any fields you provide overwrite the existing values.

  <Expandable title="configuration properties">
    <ParamField body="echo" type="boolean">
      When `true`, outbound messages sent by your business are echoed back to this webhook.
    </ParamField>

    <ParamField body="channelTypes" type="array">
      List of channel types to filter events by (e.g. `["whatsapp"]`).
    </ParamField>

    <ParamField body="filters" type="array">
      Updated filter rules. Replaces the existing filters entirely.

      <Expandable title="filter properties">
        <ParamField body="field" type="string">
          The event field to match on (e.g. `campaign_name`).
        </ParamField>

        <ParamField body="expression" type="string">
          Glob-style expression to match against the field value (e.g. `prod-*`).
        </ParamField>
      </Expandable>
    </ParamField>

    <ParamField body="webengageConfiguration" type="object">
      Required when the webhook type is `webengage`.

      <Expandable title="webengageConfiguration properties">
        <ParamField body="webengageToken" type="string">
          Your WebEngage API token.
        </ParamField>

        <ParamField body="webengageWebhookUrl" type="string">
          Your WebEngage webhook URL.
        </ParamField>
      </Expandable>
    </ParamField>
  </Expandable>
</ParamField>

## Examples

<AccordionGroup>
  <Accordion title="Update address only">
    ```bash theme={null}
    curl --request PUT \
      --url https://api.connectly.ai/v1/businesses/{businessId}/update/webhooks/{webhookId} \
      --header 'Content-Type: application/json' \
      --header 'X-API-Key: YOUR_API_KEY' \
      --data '{
        "address": "https://example.com/webhook-v2"
      }'
    ```
  </Accordion>

  <Accordion title="Update configuration only">
    ```bash theme={null}
    curl --request PUT \
      --url https://api.connectly.ai/v1/businesses/{businessId}/update/webhooks/{webhookId} \
      --header 'Content-Type: application/json' \
      --header 'X-API-Key: YOUR_API_KEY' \
      --data '{
        "configuration": {
          "echo": true,
          "channelTypes": ["whatsapp"],
          "filters": [
            { "field": "campaign_name", "expression": "prod-*" }
          ]
        }
      }'
    ```
  </Accordion>

  <Accordion title="Update both address and configuration">
    ```bash theme={null}
    curl --request PUT \
      --url https://api.connectly.ai/v1/businesses/{businessId}/update/webhooks/{webhookId} \
      --header 'Content-Type: application/json' \
      --header 'X-API-Key: YOUR_API_KEY' \
      --data '{
        "address": "https://example.com/webhook-v2",
        "configuration": {
          "echo": false,
          "channelTypes": ["whatsapp"],
          "filters": [
            { "field": "campaign_name", "expression": "prod-*" }
          ]
        }
      }'
    ```
  </Accordion>
</AccordionGroup>

## Response

```json theme={null}
{ "id": "wh_01ARZ3NDEKTSV4RRFFQ69G5FAV" }
```

## Error responses

| Status | Meaning                                   |
| ------ | ----------------------------------------- |
| `400`  | Malformed body or invalid field values.   |
| `401`  | Missing or invalid `X-API-Key`.           |
| `404`  | The specified `webhookId` does not exist. |
| `500`  | Internal server error.                    |
