Webhooks
Add a webhook
Post an agent’s events to a URL, signed as Standard Webhooks describes. A Claude scheduled task’s fire URL gets each event as the text its session starts with. Adding the same URL again returns its webhook with the same secret.
POST
/
agents
/
{id}
/
webhooks
Add a webhook
curl --request POST \
--url https://app.artil.ai/api/agents/{id}/webhooks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "<string>",
"bearerToken": "<string>"
}
'import requests
url = "https://app.artil.ai/api/agents/{id}/webhooks"
payload = {
"url": "<string>",
"bearerToken": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({url: '<string>', bearerToken: '<string>'})
};
fetch('https://app.artil.ai/api/agents/{id}/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.artil.ai/api/agents/{id}/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>',
'bearerToken' => '<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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.artil.ai/api/agents/{id}/webhooks"
payload := strings.NewReader("{\n \"url\": \"<string>\",\n \"bearerToken\": \"<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))
}HttpResponse<String> response = Unirest.post("https://app.artil.ai/api/agents/{id}/webhooks")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"<string>\",\n \"bearerToken\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.artil.ai/api/agents/{id}/webhooks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"<string>\",\n \"bearerToken\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"url": "<string>",
"deliveredAt": "2023-11-07T05:31:56Z",
"error": "<string>",
"erroredAt": "2023-11-07T05:31:56Z",
"attempts": 0,
"retryAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"secret": "<string>"
}{
"error": {
"code": "invalid_input",
"message": "<string>"
}
}{
"error": {
"code": "invalid_input",
"message": "<string>"
}
}Authorizations
tokenoauth
Body
application/json
A token Artil sends as Authorization: Bearer with each delivery, for an endpoint that checks one instead of the signature, like a Grok Bot routine or a Claude scheduled task's API trigger. A new one replaces the token of a URL added before.
Maximum string length:
1000Pattern:
^[\w.~+\/\-]+=*$Response
The webhook and its secret
Add a webhook
curl --request POST \
--url https://app.artil.ai/api/agents/{id}/webhooks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "<string>",
"bearerToken": "<string>"
}
'import requests
url = "https://app.artil.ai/api/agents/{id}/webhooks"
payload = {
"url": "<string>",
"bearerToken": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({url: '<string>', bearerToken: '<string>'})
};
fetch('https://app.artil.ai/api/agents/{id}/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.artil.ai/api/agents/{id}/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>',
'bearerToken' => '<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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.artil.ai/api/agents/{id}/webhooks"
payload := strings.NewReader("{\n \"url\": \"<string>\",\n \"bearerToken\": \"<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))
}HttpResponse<String> response = Unirest.post("https://app.artil.ai/api/agents/{id}/webhooks")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"<string>\",\n \"bearerToken\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.artil.ai/api/agents/{id}/webhooks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"<string>\",\n \"bearerToken\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"url": "<string>",
"deliveredAt": "2023-11-07T05:31:56Z",
"error": "<string>",
"erroredAt": "2023-11-07T05:31:56Z",
"attempts": 0,
"retryAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"secret": "<string>"
}{
"error": {
"code": "invalid_input",
"message": "<string>"
}
}{
"error": {
"code": "invalid_input",
"message": "<string>"
}
}