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

# Create webhook

> Create webhook for a campaign.

### Parameters

<ParamField path="id" type="string" required>
  The ID of the campaign for the webhook.
</ParamField>

### Body

<ParamField body="name" type="string" optional>
  The name for the webhook.
</ParamField>

<ParamField body="url" type="string" required>
  The URL for the webhook.
</ParamField>

<ParamField body="eventTypes" type="string[]" required>
  The webhook events that you want to receive. Options are`message.incoming`, `message.status`, or `recipient.optout` [(read more)](/api-reference/webhooks).
</ParamField>

<ParamField body="numbers" type="string[]" optional>
  Array of phone numbers to receive events for in <Tooltip tip="I.e. +14155552671. Must start with +1 and be followed by the 10 digit number with no spaces or special characters.">E.164 format</Tooltip>. If none are provided, webhook will default to all numbers assigned to the campaign.
</ParamField>

### Response

<ResponseField name="success" type="boolean">
  Whether the webhook was created successfully.
</ResponseField>

<ResponseField name="webhook" type="object">
  The details of the new webhook.

  <Expandable title="webhook fields">
    <ResponseField name="id" type="string">
      The ID of the webhook.
    </ResponseField>

    <ResponseField name="createdAt" type="timestamp">
      The time the webhook was created
    </ResponseField>

    <ResponseField name="name" type="string">
      The name of the webhook (optional).
    </ResponseField>

    <ResponseField name="url" type="string">
      The URL of the webhook.
    </ResponseField>

    <ResponseField name="campaignId" type="string">
      The campaign ID for the webhook.
    </ResponseField>

    <ResponseField name="signature" type="string">
      The signature sent with events. [(read more)](/api-reference/webhooks)
    </ResponseField>

    <ResponseField name="eventTypes" type="string">
      The events the webhook will receive. [(read more)](/api-reference/webhooks)

      <Expandable title="event types">
        <ResponseField name="message.incoming" type="string">
          Subscribed to incoming messages.
        </ResponseField>

        <ResponseField name="message.status" type="string">
          Subscribed to message status updates.
        </ResponseField>

        <ResponseField name="recipient.optout" type="string">
          Subscribed to recipient opt-outs.
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="numbers" type="string[]">
      The phone numbers the webhook is subscribed to.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseExample>
  ```json Success theme={null}
  {
    "success": true,
    "webhook": {
      "id": "d3392dbf-ae4b-43b9-9b50-dcafa5c7h4mn",
      "createdAt": "2023-12-31T03:07:35.826Z",
      "name": "Event Service",
      "url": "https://website.com/webhook",
      "campaignId": "g1tkV7Eq",
      "signature": "aVWS7HTLR9xxMkdE",
      "eventTypes": [
        "message.incoming",
        "message.status"
      ],
      "numbers": [
        "+14159436397"
      ]
    }
  }
  ```

  ```json Error theme={null}
  {
    "success": false,
    "error": "Phone number is invalid: +14155552670"
  }
  ```
</ResponseExample>
