curl --request POST \
--url https://api.trysela.com/api/webhooks/ \
--header 'Authorization: Token <api-key>' \
--header 'Content-Type: application/json' \
--data '{
"url": "https://crm.example.com/leads/{{id}}/events",
"trigger": [
"LEAD_CREATED",
"CALL_COMPLETE"
],
"method": "POST",
"filter_condition": "get('"'"'last_chat.is_contact'"'"', False)",
"headers": {
"Authorization": "Bearer <crm-api-token>"
}
}'import requests
url = "https://api.trysela.com/api/webhooks/"
payload = {
"url": "<string>",
"trigger": [],
"filter_condition": "<string>",
"headers": {}
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({url: '<string>', trigger: [], filter_condition: '<string>', headers: {}})
};
fetch('https://api.trysela.com/api/webhooks/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.trysela.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' => '<string>',
'trigger' => [
],
'filter_condition' => '<string>',
'headers' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.trysela.com/api/webhooks/"
payload := strings.NewReader("{\n \"url\": \"<string>\",\n \"trigger\": [],\n \"filter_condition\": \"<string>\",\n \"headers\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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))
}HttpResponse<String> response = Unirest.post("https://api.trysela.com/api/webhooks/")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"<string>\",\n \"trigger\": [],\n \"filter_condition\": \"<string>\",\n \"headers\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.trysela.com/api/webhooks/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"<string>\",\n \"trigger\": [],\n \"filter_condition\": \"<string>\",\n \"headers\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": 42,
"url": "https://crm.example.com/leads/{{id}}/events",
"trigger": [
"LEAD_CREATED",
"CALL_COMPLETE"
],
"method": "POST",
"filter_condition": "get('last_chat.is_contact', False)"
}{
"trigger": [
"\"NOT_A_TRIGGER\" is not a valid choice."
]
}Create a Webhook Subscription
Creates a webhook subscription for the authenticated API user. A subscription may listen for one or more trigger values. Outbound requests default to POST when method is omitted. URL placeholders such as {{id}} and {{metadata.us_state}} are populated from each webhook payload. Optional headers are encrypted at rest and are not returned by the API.
curl --request POST \
--url https://api.trysela.com/api/webhooks/ \
--header 'Authorization: Token <api-key>' \
--header 'Content-Type: application/json' \
--data '{
"url": "https://crm.example.com/leads/{{id}}/events",
"trigger": [
"LEAD_CREATED",
"CALL_COMPLETE"
],
"method": "POST",
"filter_condition": "get('"'"'last_chat.is_contact'"'"', False)",
"headers": {
"Authorization": "Bearer <crm-api-token>"
}
}'import requests
url = "https://api.trysela.com/api/webhooks/"
payload = {
"url": "<string>",
"trigger": [],
"filter_condition": "<string>",
"headers": {}
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({url: '<string>', trigger: [], filter_condition: '<string>', headers: {}})
};
fetch('https://api.trysela.com/api/webhooks/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.trysela.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' => '<string>',
'trigger' => [
],
'filter_condition' => '<string>',
'headers' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.trysela.com/api/webhooks/"
payload := strings.NewReader("{\n \"url\": \"<string>\",\n \"trigger\": [],\n \"filter_condition\": \"<string>\",\n \"headers\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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))
}HttpResponse<String> response = Unirest.post("https://api.trysela.com/api/webhooks/")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"<string>\",\n \"trigger\": [],\n \"filter_condition\": \"<string>\",\n \"headers\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.trysela.com/api/webhooks/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"<string>\",\n \"trigger\": [],\n \"filter_condition\": \"<string>\",\n \"headers\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": 42,
"url": "https://crm.example.com/leads/{{id}}/events",
"trigger": [
"LEAD_CREATED",
"CALL_COMPLETE"
],
"method": "POST",
"filter_condition": "get('last_chat.is_contact', False)"
}{
"trigger": [
"\"NOT_A_TRIGGER\" is not a valid choice."
]
}Authorizations
Token-based authentication with required prefix "Token"
Body
Webhook URL. Supports {{variable}} placeholders resolved from the webhook payload (e.g. https://api.example.com/leads/{{id}}/notify). Use dot notation for nested values (e.g. {{metadata.us_state}}).
1 - 255LEAD_CREATED, LEAD_UPDATED, LEAD_CLOSED, LEAD_CLOSED_INCOMPLETE, LEAD_LOST, LEAD_SCHEDULE_COMPLETED, LEAD_LATE_CALLBACK, LEAD_OUT_OF_TERRITORY, LEAD_BAD_NUMBER, LEAD_CANCELLED, LEAD_CALLBACK_TO_TRANSFER, LEAD_BEFORE_REENGAGEMENT, LEAD_REENGAGEMENT, LEAD_FIRST_INBOUND, CALL_COMPLETE, BEFORE_CALLING, CALL_FAILED, CALL_ENDED, CALL_TRANSFER_INITIATED, SMS_COMPLETE, SMS_DNC, CALL_DNC HTTP method to use when sending the webhook request. NULL or blank defaults to POST.
GET- GETPOST- POSTPUT- PUTPATCH- PATCH
GET, POST, PUT, PATCH Optional filter expression that controls when the webhook fires. The expression is evaluated against the webhook payload - the same data sent in the request body. Leave blank to always fire. Use has('field') to check whether a field exists, get('path.to.value', default) for safe nested access, and comparison operators such as ==, !=, and, or. Examples: status == 'CLOSED', has('last_chat') and last_chat['is_contact'], get('last_chat.call_direction', '') == 'INBOUND'
Optional HTTP headers added to outbound webhook requests. Header values must be strings. Headers are accepted when creating a subscription but are never returned by the API.
Show child attributes
Show child attributes
Response
Webhook subscription created successfully.
Webhook URL. Supports {{variable}} placeholders resolved from the webhook payload (e.g. https://api.example.com/leads/{{id}}/notify). Use dot notation for nested values (e.g. {{metadata.us_state}}).
255LEAD_CREATED, LEAD_UPDATED, LEAD_CLOSED, LEAD_CLOSED_INCOMPLETE, LEAD_LOST, LEAD_SCHEDULE_COMPLETED, LEAD_LATE_CALLBACK, LEAD_OUT_OF_TERRITORY, LEAD_BAD_NUMBER, LEAD_CANCELLED, LEAD_CALLBACK_TO_TRANSFER, LEAD_BEFORE_REENGAGEMENT, LEAD_REENGAGEMENT, LEAD_FIRST_INBOUND, CALL_COMPLETE, BEFORE_CALLING, CALL_FAILED, CALL_ENDED, CALL_TRANSFER_INITIATED, SMS_COMPLETE, SMS_DNC, CALL_DNC HTTP method to use when sending the webhook request. NULL or blank defaults to POST.
GET- GETPOST- POSTPUT- PUTPATCH- PATCH
GET, POST, PUT, PATCH Optional filter expression that controls when the webhook fires. The expression is evaluated against the webhook payload - the same data sent in the request body. Leave blank to always fire. Use has('field') to check whether a field exists, get('path.to.value', default) for safe nested access, and comparison operators such as ==, !=, and, or. Examples: status == 'CLOSED', has('last_chat') and last_chat['is_contact'], get('last_chat.call_direction', '') == 'INBOUND'