curl --request POST \
--url https://your-instance.example.com/api/webhooks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "https://example.com/webhook",
"events": [
"<string>"
],
"headers": [
{
"name": "X-Custom-Header",
"value": "my-value"
}
],
"hmacKey": "my-secret-key",
"retries": {
"attempts": 3,
"delaySeconds": 5,
"policy": "exponential"
},
"session": "<string>"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
url: 'https://example.com/webhook',
events: ['<string>'],
headers: [{name: 'X-Custom-Header', value: 'my-value'}],
hmacKey: 'my-secret-key',
retries: {attempts: 3, delaySeconds: 5, policy: 'exponential'},
session: '<string>'
})
};
fetch('https://your-instance.example.com/api/webhooks', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://your-instance.example.com/api/webhooks"
payload = {
"url": "https://example.com/webhook",
"events": ["<string>"],
"headers": [
{
"name": "X-Custom-Header",
"value": "my-value"
}
],
"hmacKey": "my-secret-key",
"retries": {
"attempts": 3,
"delaySeconds": 5,
"policy": "exponential"
},
"session": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://your-instance.example.com/api/webhooks"
payload := strings.NewReader("{\n \"url\": \"https://example.com/webhook\",\n \"events\": [\n \"<string>\"\n ],\n \"headers\": [\n {\n \"name\": \"X-Custom-Header\",\n \"value\": \"my-value\"\n }\n ],\n \"hmacKey\": \"my-secret-key\",\n \"retries\": {\n \"attempts\": 3,\n \"delaySeconds\": 5,\n \"policy\": \"exponential\"\n },\n \"session\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://your-instance.example.com/api/webhooks",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'url' => 'https://example.com/webhook',
'events' => [
'<string>'
],
'headers' => [
[
'name' => 'X-Custom-Header',
'value' => 'my-value'
]
],
'hmacKey' => 'my-secret-key',
'retries' => [
'attempts' => 3,
'delaySeconds' => 5,
'policy' => 'exponential'
],
'session' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"createdAt": "<string>",
"enabled": true,
"events": [
"<string>"
],
"headers": [
{
"name": "X-Custom-Header",
"value": "my-value"
}
],
"id": 123,
"retries": {
"attempts": 3,
"delaySeconds": 5,
"policy": "exponential"
},
"session": "<string>",
"tenantId": "<string>",
"url": "<string>"
}{
"docs": "https://docs.polymorfa.com/api/messages/send",
"error": "missing required field: chatId"
}{
"error": "internal server error"
}{
"docs": "<string>",
"error": "<string>"
}Create webhook
Creates a new webhook configuration
curl --request POST \
--url https://your-instance.example.com/api/webhooks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "https://example.com/webhook",
"events": [
"<string>"
],
"headers": [
{
"name": "X-Custom-Header",
"value": "my-value"
}
],
"hmacKey": "my-secret-key",
"retries": {
"attempts": 3,
"delaySeconds": 5,
"policy": "exponential"
},
"session": "<string>"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
url: 'https://example.com/webhook',
events: ['<string>'],
headers: [{name: 'X-Custom-Header', value: 'my-value'}],
hmacKey: 'my-secret-key',
retries: {attempts: 3, delaySeconds: 5, policy: 'exponential'},
session: '<string>'
})
};
fetch('https://your-instance.example.com/api/webhooks', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://your-instance.example.com/api/webhooks"
payload = {
"url": "https://example.com/webhook",
"events": ["<string>"],
"headers": [
{
"name": "X-Custom-Header",
"value": "my-value"
}
],
"hmacKey": "my-secret-key",
"retries": {
"attempts": 3,
"delaySeconds": 5,
"policy": "exponential"
},
"session": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://your-instance.example.com/api/webhooks"
payload := strings.NewReader("{\n \"url\": \"https://example.com/webhook\",\n \"events\": [\n \"<string>\"\n ],\n \"headers\": [\n {\n \"name\": \"X-Custom-Header\",\n \"value\": \"my-value\"\n }\n ],\n \"hmacKey\": \"my-secret-key\",\n \"retries\": {\n \"attempts\": 3,\n \"delaySeconds\": 5,\n \"policy\": \"exponential\"\n },\n \"session\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://your-instance.example.com/api/webhooks",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'url' => 'https://example.com/webhook',
'events' => [
'<string>'
],
'headers' => [
[
'name' => 'X-Custom-Header',
'value' => 'my-value'
]
],
'hmacKey' => 'my-secret-key',
'retries' => [
'attempts' => 3,
'delaySeconds' => 5,
'policy' => 'exponential'
],
'session' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"createdAt": "<string>",
"enabled": true,
"events": [
"<string>"
],
"headers": [
{
"name": "X-Custom-Header",
"value": "my-value"
}
],
"id": 123,
"retries": {
"attempts": 3,
"delaySeconds": 5,
"policy": "exponential"
},
"session": "<string>",
"tenantId": "<string>",
"url": "<string>"
}{
"docs": "https://docs.polymorfa.com/api/messages/send",
"error": "missing required field: chatId"
}{
"error": "internal server error"
}{
"docs": "<string>",
"error": "<string>"
}Authorizations
Scoped API key created via POST /api/account/keys.
Body
Webhook parameters
Target HTTPS URL for webhook delivery
"https://example.com/webhook"
Event types to subscribe to (empty = all events)
Custom HTTP headers to include with each delivery
Show child attributes
Show child attributes
Secret key for HMAC-SHA256 signature verification
"my-secret-key"
Show child attributes
Show child attributes
Session name to filter events for (null = all sessions)
Response
Created
When the webhook was registered
Whether this webhook is active
Subscribed event types (empty = all events)
Custom HTTP headers included with each delivery
Show child attributes
Show child attributes
Unique webhook identifier
Show child attributes
Show child attributes
Session name to filter events for (null = all sessions)
Tenant that owns this webhook
Target URL for webhook delivery