Create webhook
curl --request POST \
--url https://scheduler.studio.lyzr.ai/agent-webhooks/ \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"agent_id": "66e9b0f2a1c3d4e5f6a7b8c9",
"user_id": "user@example.com",
"description": "New Zendesk ticket"
}
'import requests
url = "https://scheduler.studio.lyzr.ai/agent-webhooks/"
payload = {
"agent_id": "66e9b0f2a1c3d4e5f6a7b8c9",
"user_id": "user@example.com",
"description": "New Zendesk ticket"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
agent_id: '66e9b0f2a1c3d4e5f6a7b8c9',
user_id: 'user@example.com',
description: 'New Zendesk ticket'
})
};
fetch('https://scheduler.studio.lyzr.ai/agent-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://scheduler.studio.lyzr.ai/agent-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([
'agent_id' => '66e9b0f2a1c3d4e5f6a7b8c9',
'user_id' => 'user@example.com',
'description' => 'New Zendesk ticket'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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://scheduler.studio.lyzr.ai/agent-webhooks/"
payload := strings.NewReader("{\n \"agent_id\": \"66e9b0f2a1c3d4e5f6a7b8c9\",\n \"user_id\": \"user@example.com\",\n \"description\": \"New Zendesk ticket\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<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://scheduler.studio.lyzr.ai/agent-webhooks/")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"agent_id\": \"66e9b0f2a1c3d4e5f6a7b8c9\",\n \"user_id\": \"user@example.com\",\n \"description\": \"New Zendesk ticket\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://scheduler.studio.lyzr.ai/agent-webhooks/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"agent_id\": \"66e9b0f2a1c3d4e5f6a7b8c9\",\n \"user_id\": \"user@example.com\",\n \"description\": \"New Zendesk ticket\"\n}"
response = http.request(request)
puts response.read_body{
"id": "66f1c3b7e4b0a1b2c3d4e5f7",
"agent_id": "66e9b0f2a1c3d4e5f6a7b8c9",
"user_id": "user@example.com",
"webhook_url": "https://scheduler.studio.lyzr.ai/webhook-trigger/66f1c3b7e4b0a1b2c3d4e5f7",
"secret_key": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"description": "New Zendesk ticket",
"is_active": true,
"updated_at": "2023-11-07T05:31:56Z",
"last_triggered_at": "2023-11-07T05:31:56Z",
"last_trigger_success": true,
"trigger_count": 0
}Agent Webhooks
Create Webhook
Create a webhook URL that triggers an agent.
POST
/
agent-webhooks
/
Create webhook
curl --request POST \
--url https://scheduler.studio.lyzr.ai/agent-webhooks/ \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"agent_id": "66e9b0f2a1c3d4e5f6a7b8c9",
"user_id": "user@example.com",
"description": "New Zendesk ticket"
}
'import requests
url = "https://scheduler.studio.lyzr.ai/agent-webhooks/"
payload = {
"agent_id": "66e9b0f2a1c3d4e5f6a7b8c9",
"user_id": "user@example.com",
"description": "New Zendesk ticket"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
agent_id: '66e9b0f2a1c3d4e5f6a7b8c9',
user_id: 'user@example.com',
description: 'New Zendesk ticket'
})
};
fetch('https://scheduler.studio.lyzr.ai/agent-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://scheduler.studio.lyzr.ai/agent-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([
'agent_id' => '66e9b0f2a1c3d4e5f6a7b8c9',
'user_id' => 'user@example.com',
'description' => 'New Zendesk ticket'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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://scheduler.studio.lyzr.ai/agent-webhooks/"
payload := strings.NewReader("{\n \"agent_id\": \"66e9b0f2a1c3d4e5f6a7b8c9\",\n \"user_id\": \"user@example.com\",\n \"description\": \"New Zendesk ticket\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<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://scheduler.studio.lyzr.ai/agent-webhooks/")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"agent_id\": \"66e9b0f2a1c3d4e5f6a7b8c9\",\n \"user_id\": \"user@example.com\",\n \"description\": \"New Zendesk ticket\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://scheduler.studio.lyzr.ai/agent-webhooks/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"agent_id\": \"66e9b0f2a1c3d4e5f6a7b8c9\",\n \"user_id\": \"user@example.com\",\n \"description\": \"New Zendesk ticket\"\n}"
response = http.request(request)
puts response.read_body{
"id": "66f1c3b7e4b0a1b2c3d4e5f7",
"agent_id": "66e9b0f2a1c3d4e5f6a7b8c9",
"user_id": "user@example.com",
"webhook_url": "https://scheduler.studio.lyzr.ai/webhook-trigger/66f1c3b7e4b0a1b2c3d4e5f7",
"secret_key": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"description": "New Zendesk ticket",
"is_active": true,
"updated_at": "2023-11-07T05:31:56Z",
"last_triggered_at": "2023-11-07T05:31:56Z",
"last_trigger_success": true,
"trigger_count": 0
}The response contains the webhook’s
See Trigger Webhook for how to sign requests.
webhook_url and secret_key. Give the URL to the external system and use the secret to sign each request. The JSON body of each request is passed to the agent as its message.
Store
secret_key securely. Anyone with the secret and the URL can trigger the agent.Authorizations
Lyzr API key. Required on every endpoint except Trigger Webhook.
Body
application/json
Response
Webhook created.
Unique webhook ID.
Example:
"66f1c3b7e4b0a1b2c3d4e5f7"
Example:
"66e9b0f2a1c3d4e5f6a7b8c9"
Example:
"user@example.com"
Public URL external services call to trigger the agent.
Example:
"https://scheduler.studio.lyzr.ai/webhook-trigger/66f1c3b7e4b0a1b2c3d4e5f7"
Secret used to sign requests to webhook_url with HMAC-SHA256. Store it securely.
Example:
"New Zendesk ticket"
false when the webhook is paused.
Total number of times the webhook has been triggered.