curl --request PUT \
--url https://api.trysela.com/api/webhooks/<webhook-id>/ \
--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)",
"is_enabled": true
}'import requests
url = "https://api.trysela.com/api/webhooks/{id}/"
payload = {
"url": "https://crm.example.com/leads/{{id}}/events",
"trigger": ["LEAD_CREATED", "CALL_COMPLETE"],
"method": "POST",
"filter_condition": "get('last_chat.is_contact', False)",
"is_enabled": True
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
url: 'https://crm.example.com/leads/{{id}}/events',
trigger: ['LEAD_CREATED', 'CALL_COMPLETE'],
method: 'POST',
filter_condition: 'get(\'last_chat.is_contact\', False)',
is_enabled: true
})
};
fetch('https://api.trysela.com/api/webhooks/{id}/', 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/{id}/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'url' => 'https://crm.example.com/leads/{{id}}/events',
'trigger' => [
'LEAD_CREATED',
'CALL_COMPLETE'
],
'method' => 'POST',
'filter_condition' => 'get(\'last_chat.is_contact\', False)',
'is_enabled' => true
]),
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/{id}/"
payload := strings.NewReader("{\n \"url\": \"https://crm.example.com/leads/{{id}}/events\",\n \"trigger\": [\n \"LEAD_CREATED\",\n \"CALL_COMPLETE\"\n ],\n \"method\": \"POST\",\n \"filter_condition\": \"get('last_chat.is_contact', False)\",\n \"is_enabled\": true\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.trysela.com/api/webhooks/{id}/")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"https://crm.example.com/leads/{{id}}/events\",\n \"trigger\": [\n \"LEAD_CREATED\",\n \"CALL_COMPLETE\"\n ],\n \"method\": \"POST\",\n \"filter_condition\": \"get('last_chat.is_contact', False)\",\n \"is_enabled\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.trysela.com/api/webhooks/{id}/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"https://crm.example.com/leads/{{id}}/events\",\n \"trigger\": [\n \"LEAD_CREATED\",\n \"CALL_COMPLETE\"\n ],\n \"method\": \"POST\",\n \"filter_condition\": \"get('last_chat.is_contact', False)\",\n \"is_enabled\": true\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)",
"is_enabled": true
}Update a Webhook Subscription
Replaces one webhook subscription owned by the authenticated API user. Destination URLs follow the same https and public-host rules as creation. headers cannot be changed by this endpoint; delete the subscription and create a new one to change them. Requires permission to change webhooks; other callers receive a 403. For security reasons, webhooks you create may start disabled, and editing or enabling them requires extra permissions. Contact Sela staff to enable your webhooks, or to grant your API user permission to edit and enable webhooks.
curl --request PUT \
--url https://api.trysela.com/api/webhooks/<webhook-id>/ \
--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)",
"is_enabled": true
}'import requests
url = "https://api.trysela.com/api/webhooks/{id}/"
payload = {
"url": "https://crm.example.com/leads/{{id}}/events",
"trigger": ["LEAD_CREATED", "CALL_COMPLETE"],
"method": "POST",
"filter_condition": "get('last_chat.is_contact', False)",
"is_enabled": True
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
url: 'https://crm.example.com/leads/{{id}}/events',
trigger: ['LEAD_CREATED', 'CALL_COMPLETE'],
method: 'POST',
filter_condition: 'get(\'last_chat.is_contact\', False)',
is_enabled: true
})
};
fetch('https://api.trysela.com/api/webhooks/{id}/', 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/{id}/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'url' => 'https://crm.example.com/leads/{{id}}/events',
'trigger' => [
'LEAD_CREATED',
'CALL_COMPLETE'
],
'method' => 'POST',
'filter_condition' => 'get(\'last_chat.is_contact\', False)',
'is_enabled' => true
]),
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/{id}/"
payload := strings.NewReader("{\n \"url\": \"https://crm.example.com/leads/{{id}}/events\",\n \"trigger\": [\n \"LEAD_CREATED\",\n \"CALL_COMPLETE\"\n ],\n \"method\": \"POST\",\n \"filter_condition\": \"get('last_chat.is_contact', False)\",\n \"is_enabled\": true\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.trysela.com/api/webhooks/{id}/")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"https://crm.example.com/leads/{{id}}/events\",\n \"trigger\": [\n \"LEAD_CREATED\",\n \"CALL_COMPLETE\"\n ],\n \"method\": \"POST\",\n \"filter_condition\": \"get('last_chat.is_contact', False)\",\n \"is_enabled\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.trysela.com/api/webhooks/{id}/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"https://crm.example.com/leads/{{id}}/events\",\n \"trigger\": [\n \"LEAD_CREATED\",\n \"CALL_COMPLETE\"\n ],\n \"method\": \"POST\",\n \"filter_condition\": \"get('last_chat.is_contact', False)\",\n \"is_enabled\": true\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)",
"is_enabled": true
}Authorizations
Body
Webhook URL. Must use https and point to a public internet host. Supports {{variable}} placeholders in the path and query, 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, RECORDING_AVAILABLE, CALL_TRANSFER_INITIATED, SMS_COMPLETE, SMS_DNC, CALL_DNC 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'
Response
Webhook subscription updated successfully.
Webhook URL. Must use https and point to a public internet host. Supports {{variable}} placeholders in the path and query, 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, RECORDING_AVAILABLE, CALL_TRANSFER_INITIATED, SMS_COMPLETE, SMS_DNC, CALL_DNC 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'