---
agentTools:
  projectIndex: https://rampwin-api.readme.io/llms.txt
---

# Set Channel Webhook

Registers or updates a webhook URL for a specific channel. Once configured, Rampwin will send event notifications to the provided webhook endpoint whenever the selected events occur.

## Endpoint

`POST /api/integrations/{channel_id}/setWebhook`

**Base URL**

```bash URL
https://api.rampwin.com
```

## Description

This API allows you to configure a webhook endpoint for a channel.

When enabled, Rampwin will automatically send HTTP POST requests to your webhook URL whenever subscribed events are triggered.

Supported events include:

* Incoming messages
* Outgoing messages
* Message status updates
* Template updates
* Channel updates

If a webhook already exists for the channel, the configuration will be updated.

***

## Authentication

This API supports:

* API Key Authentication

### Headers

| Header       | Type   | Required | Description          |
| ------------ | ------ | -------- | -------------------- |
| Content-Type | string | Yes      | `application/json`   |
| X-API-Key    | string | Yes      | Your Rampwin API key |

***

## Path Parameters

| Parameter   | Type   | Required | Description                                         |
| ----------- | ------ | -------- | --------------------------------------------------- |
| channel\_id | string | Yes      | Channel ID for which the webhook will be configured |

***

## Request Body

### Core Fields

| Field  | Type   | Required | Description                                              |
| ------ | ------ | -------- | -------------------------------------------------------- |
| url    | string | Yes      | Public webhook URL that will receive event notifications |
| events | object | Yes      | List of events to subscribe to                           |

### Events Object

| Field             | Type    | Required | Description                                      |
| ----------------- | ------- | -------- | ------------------------------------------------ |
| message\_incoming | boolean | No       | Receive incoming message events                  |
| message\_outgoing | boolean | No       | Receive outgoing message events                  |
| message\_status   | boolean | No       | Receive message delivery and read status updates |
| template\_update  | boolean | No       | Receive template status and update events        |
| channel\_update   | boolean | No       | Receive channel configuration update events      |

***

## Example Request

### cURL

```curl cURL
curl --location --request POST 'https://api.rampwin.com/api/integrations/YOUR_CHANNEL_ID/setWebhook' \
--header 'X-API-Key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
  "url": "https://your-server.com/your-webhook-receiver",
  "events": {
    "message_incoming": true,
    "message_outgoing": true,
    "message_status": true,
    "template_update": true,
    "channel_update": true
  }
}'
```

***

## Response

### Success (200)

```json
{
  "success": true,
  "message": "Webhook configured successfully",
  "data": {
    "channel_id": "YOUR_CHANNEL_ID",
    "url": "https://your-server.com/your-webhook-receiver",
    "events": {
      "message_incoming": true,
      "message_outgoing": true,
      "message_status": true,
      "template_update": true,
      "channel_update": true
    }
  }
}
```

### Error (400)

```json
{
  "success": false,
  "message": "Validation error"
}
```

### Error (401)

```json
{
  "success": false,
  "message": "Unauthorized"
}
```

***

## Business Logic Notes

* Only one webhook configuration can exist per channel.
* Calling this API again will update the existing webhook configuration.
* The webhook URL must be publicly accessible over HTTPS.
* Rampwin will send event payloads only for the events enabled in the `events` object.
* Disabled events will not trigger webhook notifications.

***

## Common Errors

| Error                       | Description                          |
| --------------------------- | ------------------------------------ |
| Validation error            | Missing or invalid request fields    |
| Unauthorized                | Invalid API key                      |
| Invalid channel             | Channel ID does not exist            |
| Invalid webhook URL         | URL is malformed or inaccessible     |
| Webhook registration failed | Unable to save webhook configuration |