Skip to main content

Webhooks API Reference

Manage webhooks programmatically using the Pollarix REST API.

Authentication

All API requests require authentication:

curl -H "Authorization: Bearer YOUR_API_TOKEN" \
https://api.pollarix.com/department/{departmentId}/webhook/

Base URL

https://api.pollarix.com

Endpoints Overview

MethodEndpointDescription
GET/department/{id}/webhook/List all webhooks
POST/department/{id}/webhook/Create webhook
POST/department/{id}/webhook/addAdd webhook
PUT/department/{id}/webhook/{webhookId}Update webhook
DELETE/department/{id}/webhook/{webhookId}Delete webhook
POST/department/{id}/webhook/test-sendTest webhook

List Webhooks

GET/department/{departmentId}/webhook/Get all webhooks

Retrieve all webhooks for a department.

Parameters

ParameterTypeLocationDescription
departmentIdstringpathDepartment identifier

Response

Success Response (200 OK)
{
"departmentId": "dept_xyz789",
"webhooks": [
{
"id": "wh_abc123",
"name": "CRM Sync",
"url": "https://your-server.com/webhooks/pollarix",
"events": ["SURVEY_COMPLETED"],
"headers": {
"Authorization": "Bearer token123"
},
"isActive": true
},
{
"id": "wh_def456",
"name": "Slack Notifications",
"url": "https://hooks.slack.com/services/...",
"events": ["SURVEY_COMPLETED", "SURVEY_STATUS_CHANGED"],
"headers": {},
"isActive": true
}
]
}

Example

curl -X GET \
'https://api.pollarix.com/department/dept_xyz789/webhook/' \
-H 'Authorization: Bearer YOUR_API_TOKEN' \
-H 'Content-Type: application/json'

Create Webhook

POST/department/{departmentId}/webhook/Create new webhook

Create a new webhook for a department.

Parameters

ParameterTypeLocationDescription
departmentIdstringpathDepartment identifier

Request Body

{
"name": "My Webhook",
"url": "https://your-server.com/webhooks/pollarix",
"events": ["SURVEY_COMPLETED", "COUPON_REDEEMED"],
"headers": {
"Authorization": "Bearer your-secret-token",
"X-Custom-Header": "custom-value"
},
"isActive": true
}
FieldTypeRequiredDescription
namestringYesWebhook display name
urlstringYesTarget endpoint URL
eventsarrayYesEvents to subscribe to
headersobjectNoCustom HTTP headers
isActivebooleanNoEnable webhook (default: true)

Response

Success Response (201 Created)
{
"departmentId": "dept_xyz789",
"webhooks": [
{
"id": "wh_new123",
"name": "My Webhook",
"url": "https://your-server.com/webhooks/pollarix",
"events": ["SURVEY_COMPLETED", "COUPON_REDEEMED"],
"headers": {
"Authorization": "Bearer your-secret-token",
"X-Custom-Header": "custom-value"
},
"isActive": true
}
]
}

Example

curl -X POST \
'https://api.pollarix.com/department/dept_xyz789/webhook/' \
-H 'Authorization: Bearer YOUR_API_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"name": "CRM Integration",
"url": "https://your-server.com/webhooks/pollarix",
"events": ["SURVEY_COMPLETED"],
"headers": {
"Authorization": "Bearer secret123"
},
"isActive": true
}'

Add Webhook

POST/department/{departmentId}/webhook/addAdd additional webhook

Add an additional webhook to a department that already has webhooks.

Parameters

ParameterTypeLocationDescription
departmentIdstringpathDepartment identifier

Request Body

Same as Create Webhook.

Example

curl -X POST \
'https://api.pollarix.com/department/dept_xyz789/webhook/add' \
-H 'Authorization: Bearer YOUR_API_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"name": "Analytics Pipeline",
"url": "https://analytics.company.com/ingest",
"events": ["SURVEY_COMPLETED"],
"isActive": true
}'

Update Webhook

PUT/department/{departmentId}/webhook/{webhookId}Update webhook

Update an existing webhook configuration.

Parameters

ParameterTypeLocationDescription
departmentIdstringpathDepartment identifier
webhookIdstringpathWebhook identifier

Request Body

{
"id": "wh_abc123",
"name": "Updated Webhook Name",
"url": "https://new-endpoint.com/webhooks",
"events": ["SURVEY_COMPLETED", "SURVEY_STATUS_CHANGED"],
"headers": {
"Authorization": "Bearer new-token"
},
"isActive": true
}

Example

curl -X PUT \
'https://api.pollarix.com/department/dept_xyz789/webhook/wh_abc123' \
-H 'Authorization: Bearer YOUR_API_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"id": "wh_abc123",
"name": "Updated CRM Sync",
"url": "https://your-server.com/webhooks/v2/pollarix",
"events": ["SURVEY_COMPLETED"],
"headers": {},
"isActive": false
}'

Delete Webhook

DELETE/department/{departmentId}/webhook/{webhookId}Delete webhook

Permanently delete a webhook.

Parameters

ParameterTypeLocationDescription
departmentIdstringpathDepartment identifier
webhookIdstringpathWebhook identifier

Response

Returns 204 No Content on success.

Example

curl -X DELETE \
'https://api.pollarix.com/department/dept_xyz789/webhook/wh_abc123' \
-H 'Authorization: Bearer YOUR_API_TOKEN'

Test Webhook

POST/department/{departmentId}/webhook/test-sendTest webhook

Send a test payload to a webhook URL to verify connectivity.

Parameters

ParameterTypeLocationDescription
departmentIdstringpathDepartment identifier

Request Body

{
"url": "https://your-server.com/webhooks/pollarix"
}

Response

Returns 200 OK if the test request was sent successfully.

Example

curl -X POST \
'https://api.pollarix.com/department/dept_xyz789/webhook/test-send' \
-H 'Authorization: Bearer YOUR_API_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"url": "https://your-server.com/webhooks/pollarix"
}'

Error Responses

Error Format

{
"status": 400,
"detail": [
{
"msg": "Invalid URL format",
"type": "validation_error"
}
]
}

Error Codes

StatusErrorDescription
400Bad RequestInvalid request body or parameters
401UnauthorizedMissing or invalid authentication
403ForbiddenInsufficient permissions or plan restrictions
404Not FoundWebhook or department not found
422Validation ErrorInvalid field values
429Too Many RequestsRate limit exceeded
500Server ErrorInternal server error

Complete Code Examples

Node.js Webhook Manager

const axios = require('axios');

class WebhookManager {
constructor(apiToken, departmentId) {
this.client = axios.create({
baseURL: 'https://api.pollarix.com',
headers: {
'Authorization': `Bearer ${apiToken}`,
'Content-Type': 'application/json'
}
});
this.departmentId = departmentId;
}

async list() {
const { data } = await this.client.get(
`/department/${this.departmentId}/webhook/`
);
return data.webhooks;
}

async create(webhook) {
const { data } = await this.client.post(
`/department/${this.departmentId}/webhook/`,
webhook
);
return data;
}

async update(webhookId, webhook) {
const { data } = await this.client.put(
`/department/${this.departmentId}/webhook/${webhookId}`,
{ id: webhookId, ...webhook }
);
return data;
}

async delete(webhookId) {
await this.client.delete(
`/department/${this.departmentId}/webhook/${webhookId}`
);
}

async test(url) {
await this.client.post(
`/department/${this.departmentId}/webhook/test-send`,
{ url }
);
}
}

// Usage
const manager = new WebhookManager('YOUR_API_TOKEN', 'dept_xyz789');

// List webhooks
const webhooks = await manager.list();
console.log('Webhooks:', webhooks);

// Create webhook
await manager.create({
name: 'My Integration',
url: 'https://my-server.com/webhooks',
events: ['SURVEY_COMPLETED'],
isActive: true
});

Python Webhook Manager

import requests
from typing import List, Dict, Optional

class WebhookManager:
def __init__(self, api_token: str, department_id: str):
self.base_url = 'https://api.pollarix.com'
self.headers = {
'Authorization': f'Bearer {api_token}',
'Content-Type': 'application/json'
}
self.department_id = department_id

def list(self) -> List[Dict]:
response = requests.get(
f'{self.base_url}/department/{self.department_id}/webhook/',
headers=self.headers
)
response.raise_for_status()
return response.json()['webhooks']

def create(self, webhook: Dict) -> Dict:
response = requests.post(
f'{self.base_url}/department/{self.department_id}/webhook/',
json=webhook,
headers=self.headers
)
response.raise_for_status()
return response.json()

def update(self, webhook_id: str, webhook: Dict) -> Dict:
response = requests.put(
f'{self.base_url}/department/{self.department_id}/webhook/{webhook_id}',
json={'id': webhook_id, **webhook},
headers=self.headers
)
response.raise_for_status()
return response.json()

def delete(self, webhook_id: str) -> None:
response = requests.delete(
f'{self.base_url}/department/{self.department_id}/webhook/{webhook_id}',
headers=self.headers
)
response.raise_for_status()

def test(self, url: str) -> None:
response = requests.post(
f'{self.base_url}/department/{self.department_id}/webhook/test-send',
json={'url': url},
headers=self.headers
)
response.raise_for_status()


# Usage
manager = WebhookManager('YOUR_API_TOKEN', 'dept_xyz789')

# List webhooks
webhooks = manager.list()
print('Webhooks:', webhooks)

# Create webhook
manager.create({
'name': 'My Integration',
'url': 'https://my-server.com/webhooks',
'events': ['SURVEY_COMPLETED'],
'isActive': True
})

Next Steps

Was this page helpful?