Register a webhook
curl --request POST \
--url https://app.gomega.ai/api/agents/crm/lead-webhooks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-customer-id: <x-customer-id>' \
--data '
{
"url": "<string>",
"event_types": [
"lead.created"
],
"timeout_seconds": 10,
"retry_attempts": 5,
"description": "<string>",
"is_active": true
}
'import requests
url = "https://app.gomega.ai/api/agents/crm/lead-webhooks"
payload = {
"url": "<string>",
"event_types": ["lead.created"],
"timeout_seconds": 10,
"retry_attempts": 5,
"description": "<string>",
"is_active": True
}
headers = {
"x-customer-id": "<x-customer-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-customer-id': '<x-customer-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
url: '<string>',
event_types: ['lead.created'],
timeout_seconds: 10,
retry_attempts: 5,
description: '<string>',
is_active: true
})
};
fetch('https://app.gomega.ai/api/agents/crm/lead-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://app.gomega.ai/api/agents/crm/lead-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>',
'event_types' => [
'lead.created'
],
'timeout_seconds' => 10,
'retry_attempts' => 5,
'description' => '<string>',
'is_active' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"x-customer-id: <x-customer-id>"
],
]);
$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://app.gomega.ai/api/agents/crm/lead-webhooks"
payload := strings.NewReader("{\n \"url\": \"<string>\",\n \"event_types\": [\n \"lead.created\"\n ],\n \"timeout_seconds\": 10,\n \"retry_attempts\": 5,\n \"description\": \"<string>\",\n \"is_active\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-customer-id", "<x-customer-id>")
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))
}HttpResponse<String> response = Unirest.post("https://app.gomega.ai/api/agents/crm/lead-webhooks")
.header("x-customer-id", "<x-customer-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"<string>\",\n \"event_types\": [\n \"lead.created\"\n ],\n \"timeout_seconds\": 10,\n \"retry_attempts\": 5,\n \"description\": \"<string>\",\n \"is_active\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.gomega.ai/api/agents/crm/lead-webhooks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-customer-id"] = '<x-customer-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"<string>\",\n \"event_types\": [\n \"lead.created\"\n ],\n \"timeout_seconds\": 10,\n \"retry_attempts\": 5,\n \"description\": \"<string>\",\n \"is_active\": true\n}"
response = http.request(request)
puts response.read_body{
"webhook": {
"id": "<string>",
"url": "<string>",
"event_types": [
"<string>"
],
"is_active": true,
"timeout_seconds": 123,
"retry_attempts": 123,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"description": "<string>"
},
"secret": "<string>"
}{
"error": {
"type": "authentication_error",
"code": 123,
"message": "<string>"
}
}{
"error": {
"type": "authentication_error",
"code": 123,
"message": "<string>"
}
}{
"error": {
"type": "authentication_error",
"code": 123,
"message": "<string>"
}
}{
"error": {
"type": "authentication_error",
"code": 123,
"message": "<string>"
}
}{
"error": {
"type": "authentication_error",
"code": 123,
"message": "<string>"
}
}Webhooks
Register a webhook
Registers a webhook URL for lead.created events. The URL is SSRF-validated (must be public HTTPS). The signing secret is returned EXACTLY ONCE — store it. Requires the public_api:webhooks:manage scope.
POST
/
api
/
agents
/
crm
/
lead-webhooks
Register a webhook
curl --request POST \
--url https://app.gomega.ai/api/agents/crm/lead-webhooks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-customer-id: <x-customer-id>' \
--data '
{
"url": "<string>",
"event_types": [
"lead.created"
],
"timeout_seconds": 10,
"retry_attempts": 5,
"description": "<string>",
"is_active": true
}
'import requests
url = "https://app.gomega.ai/api/agents/crm/lead-webhooks"
payload = {
"url": "<string>",
"event_types": ["lead.created"],
"timeout_seconds": 10,
"retry_attempts": 5,
"description": "<string>",
"is_active": True
}
headers = {
"x-customer-id": "<x-customer-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-customer-id': '<x-customer-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
url: '<string>',
event_types: ['lead.created'],
timeout_seconds: 10,
retry_attempts: 5,
description: '<string>',
is_active: true
})
};
fetch('https://app.gomega.ai/api/agents/crm/lead-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://app.gomega.ai/api/agents/crm/lead-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>',
'event_types' => [
'lead.created'
],
'timeout_seconds' => 10,
'retry_attempts' => 5,
'description' => '<string>',
'is_active' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"x-customer-id: <x-customer-id>"
],
]);
$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://app.gomega.ai/api/agents/crm/lead-webhooks"
payload := strings.NewReader("{\n \"url\": \"<string>\",\n \"event_types\": [\n \"lead.created\"\n ],\n \"timeout_seconds\": 10,\n \"retry_attempts\": 5,\n \"description\": \"<string>\",\n \"is_active\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-customer-id", "<x-customer-id>")
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))
}HttpResponse<String> response = Unirest.post("https://app.gomega.ai/api/agents/crm/lead-webhooks")
.header("x-customer-id", "<x-customer-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"<string>\",\n \"event_types\": [\n \"lead.created\"\n ],\n \"timeout_seconds\": 10,\n \"retry_attempts\": 5,\n \"description\": \"<string>\",\n \"is_active\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.gomega.ai/api/agents/crm/lead-webhooks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-customer-id"] = '<x-customer-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"<string>\",\n \"event_types\": [\n \"lead.created\"\n ],\n \"timeout_seconds\": 10,\n \"retry_attempts\": 5,\n \"description\": \"<string>\",\n \"is_active\": true\n}"
response = http.request(request)
puts response.read_body{
"webhook": {
"id": "<string>",
"url": "<string>",
"event_types": [
"<string>"
],
"is_active": true,
"timeout_seconds": 123,
"retry_attempts": 123,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"description": "<string>"
},
"secret": "<string>"
}{
"error": {
"type": "authentication_error",
"code": 123,
"message": "<string>"
}
}{
"error": {
"type": "authentication_error",
"code": 123,
"message": "<string>"
}
}{
"error": {
"type": "authentication_error",
"code": 123,
"message": "<string>"
}
}{
"error": {
"type": "authentication_error",
"code": 123,
"message": "<string>"
}
}{
"error": {
"type": "authentication_error",
"code": 123,
"message": "<string>"
}
}Authorizations
Admin-issued Personal Access Token, e.g. Authorization: Bearer mega_<64 hex>. The key carries scopes (public_api:leads:read, public_api:leads:write, public_api:webhooks:manage) and is locked to one customer.
Headers
The customer this request acts on. Must match the customer your key is locked to.
Body
application/json
Public HTTPS URL. Validated against SSRF before it is stored.
Available options:
lead.created Required range:
1 <= x <= 60Required range:
0 <= x <= 10