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

# Test Competitor Alert Webhook

> Send a signed sample competitor alert to your webhook

Queue one sample `competitor_monitoring.alert` to your webhook, with the same headers,
signature and retries as real alerts. The sample is an `attack_critical_comment` with made-up
values and `"test": true`, and a fresh `alert_id` each time. See
[Webhook payloads](https://docs.clustr-ai.com/competitor-monitoring/webhook-payload.md).

The call answers once the request is queued; your endpoint receives it within a few seconds.
Admin only.

Optional. Without a body, the saved `webhook_url` and secret are used.

## Response

| Field | Description |
| - | - |
| `delivery_id` | The queued delivery |
| `alert_id` | The sample's `alert_id`, also sent as `X-ClustR-Job-ID` |
| `event` | `competitor_monitoring.alert` |
| `url` | Where it is sent |
| `signed` | Whether it carries `X-ClustR-Signature` |

A workspace with no URL saved and none sent gets a `400`.

```bash cURL theme={null}
curl -X POST https://api.clustr-ai.com/api/public/notifications/competitor-alerts/test-webhook \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"webhook_url": "https://hooks.example.com/clustr", "webhook_secret": "whsec_example"}'
```

```python Python theme={null}
import requests

requests.post(
    "https://api.clustr-ai.com/api/public/notifications/competitor-alerts/test-webhook",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    json={"webhook_url": "https://hooks.example.com/clustr", "webhook_secret": "whsec_example"},
)
```

```javascript JavaScript theme={null}
await fetch("https://api.clustr-ai.com/api/public/notifications/competitor-alerts/test-webhook", {
  method: "POST",
  headers: { Authorization: "Bearer YOUR_API_KEY", "Content-Type": "application/json" },
  body: JSON.stringify({ webhook_url: "https://hooks.example.com/clustr", webhook_secret: "whsec_example" }),
});
```

```json 200 theme={null}
{
  "success": true,
  "data": {
    "clustr_webhook_delivery_id": "whd_9wz1ymqb21m4nd01ynw4a0dw7d",
    "delivery_id": "8d2f4b6a-1c3e-4a5b-9d7f-0e2c4a6b8d1f",
    "alert_id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
    "event": "competitor_monitoring.alert",
    "url": "https://hooks.example.com/clustr",
    "signed": true
  }
}
```

```json 400 theme={null}
{
  "success": false,
  "error": {
    "message": "Add a webhook URL first.",
    "code": "BAD_REQUEST"
  }
}
```


## OpenAPI

````yaml POST /notifications/competitor-alerts/test-webhook
openapi: 3.1.0
info:
  title: Clustr Public API
  description: >
    Programmatic access to your Clustr network: import connectors, search warm
    intros (opportunities), and manage target accounts.


    ## Authentication

    All endpoints require a Bearer token (API key) in the `Authorization`
    header.


    ```

    Authorization: Bearer <your_api_key>

    ```


    API keys can be created and managed from the [API settings
    page](https://app.clustr-ai.com/api).
  version: '1.0'
  contact:
    name: Clustr Support
    url: https://clustr-ai.com
servers:
  - url: https://api.clustr-ai.com/api/public
    description: Production
security:
  - BearerAuth: []
paths:
  /notifications/competitor-alerts/test-webhook:
    post:
      tags:
        - Competitor Monitoring
      summary: Test Competitor Alert Webhook
      description: >
        Queues one sample `competitor_monitoring.alert` to your webhook, with
        the same headers,

        signature and retries as real alerts. The sample is an
        `attack_critical_comment` filled

        with made-up values, marked `"test": true`, and carries a fresh
        `alert_id` each time.


        The call answers once the sample is queued, and your endpoint receives
        it within a few

        seconds. Without a body, the saved webhook URL and secret are used.
        Admin only.
      operationId: testCompetitorAlertWebhook
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                webhook_url:
                  type: string
                  format: uri
                  maxLength: 2048
                  description: >-
                    Test this URL in place of the saved one, for example before
                    you save it. It must start with https:// or http:// and name
                    a host.
                  example: https://hooks.example.com/clustr
                webhook_secret:
                  type: string
                  writeOnly: true
                  description: >-
                    Sign the sample with this secret in place of the saved one.
                    An empty string sends the sample unsigned.
                  example: whsec_example
            examples:
              new_url:
                summary: Test a URL and secret before saving them
                value:
                  webhook_url: https://hooks.example.com/clustr
                  webhook_secret: whsec_example
      responses:
        '200':
          description: The sample is queued
          content:
            application/json:
              schema:
                type: object
                required:
                  - success
                  - data
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    properties:
                      clustr_webhook_delivery_id:
                        type: string
                        description: >-
                          The Clustr ID of the queued delivery, for example
                          `whd_9wz1ymqb21m4nd01ynw4a0dw7d`.
                        example: whd_9wz1ymqb21m4nd01ynw4a0dw7d
                      delivery_id:
                        type: string
                        description: >-
                          Kept for integrations built before Clustr IDs. New
                          integrations should use `clustr_webhook_delivery_id`.
                        example: 8d2f4b6a-1c3e-4a5b-9d7f-0e2c4a6b8d1f
                      alert_id:
                        type: string
                        description: >-
                          The sample's `alert_id`, also sent as
                          `X-ClustR-Job-ID`.
                        example: f47ac10b-58cc-4372-a567-0e02b2c3d479
                      event:
                        type: string
                        example: competitor_monitoring.alert
                      url:
                        type: string
                        description: Where the sample is sent.
                        example: https://hooks.example.com/clustr
                      signed:
                        type: boolean
                        description: Whether the sample carries `X-ClustR-Signature`.
                        example: true
        '400':
          description: >-
            Your workspace has no webhook URL saved and the request sends none,
            the URL is invalid, or the body cannot be read
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  message: Add a webhook URL first.
                  code: BAD_REQUEST
        '401':
          description: Invalid or missing API key
        '403':
          description: The caller is not a workspace admin
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    ErrorResponse:
      type: object
      required:
        - success
        - error
      properties:
        success:
          type: boolean
          example: false
        error:
          type: object
          properties:
            message:
              type: string
              example: Invalid request body
            code:
              type: string
              example: BAD_REQUEST
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: The API key you created on the API settings page of the Clustr app.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.