Create Webhook
curl --request POST \
--url https://app.tuco.ai/api/webhooks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "<string>",
"events": [
"<string>"
],
"name": "<string>",
"description": "<string>"
}
'import requests
url = "https://app.tuco.ai/api/webhooks"
payload = {
"url": "<string>",
"events": ["<string>"],
"name": "<string>",
"description": "<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>',
events: ['<string>'],
name: '<string>',
description: '<string>'
})
};
fetch('https://app.tuco.ai/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://app.tuco.ai/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>',
'events' => [
'<string>'
],
'name' => '<string>',
'description' => '<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.tuco.ai/api/webhooks"
payload := strings.NewReader("{\n \"url\": \"<string>\",\n \"events\": [\n \"<string>\"\n ],\n \"name\": \"<string>\",\n \"description\": \"<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.tuco.ai/api/webhooks")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"<string>\",\n \"events\": [\n \"<string>\"\n ],\n \"name\": \"<string>\",\n \"description\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.tuco.ai/api/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 \"events\": [\n \"<string>\"\n ],\n \"name\": \"<string>\",\n \"description\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"secret": "<string>",
"url": "<string>",
"events": [
"<string>"
],
"name": "<string>",
"createdAt": "<string>",
"warning": "<string>"
}Webhooks
Create Webhook
Register a new webhook endpoint — the signing secret is returned once. REST endpoint in the Tuco AI iMessage API — bearer-token auth, JSON request/response.
POST
/
api
/
webhooks
Create Webhook
curl --request POST \
--url https://app.tuco.ai/api/webhooks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "<string>",
"events": [
"<string>"
],
"name": "<string>",
"description": "<string>"
}
'import requests
url = "https://app.tuco.ai/api/webhooks"
payload = {
"url": "<string>",
"events": ["<string>"],
"name": "<string>",
"description": "<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>',
events: ['<string>'],
name: '<string>',
description: '<string>'
})
};
fetch('https://app.tuco.ai/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://app.tuco.ai/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>',
'events' => [
'<string>'
],
'name' => '<string>',
'description' => '<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.tuco.ai/api/webhooks"
payload := strings.NewReader("{\n \"url\": \"<string>\",\n \"events\": [\n \"<string>\"\n ],\n \"name\": \"<string>\",\n \"description\": \"<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.tuco.ai/api/webhooks")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"<string>\",\n \"events\": [\n \"<string>\"\n ],\n \"name\": \"<string>\",\n \"description\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.tuco.ai/api/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 \"events\": [\n \"<string>\"\n ],\n \"name\": \"<string>\",\n \"description\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"secret": "<string>",
"url": "<string>",
"events": [
"<string>"
],
"name": "<string>",
"createdAt": "<string>",
"warning": "<string>"
}Register a URL to receive real-time event notifications. The HMAC signing secret is returned once in the response. Save it immediately — you can’t retrieve it later.
Authentication
Authorization: Bearer tuco_sk_xxxxxxxxxxxxx
Request body
HTTPS endpoint URL that will receive webhook POSTs.
Event types to subscribe to. At least one required.
| Event | When fired |
|---|---|
message.sent | Message accepted by Tuco |
message.failed | Message failed after retries |
message.fallback | Recipient has no iMessage |
message.reply | Lead replied |
message.opened | Message read (read receipt) |
User-friendly name for this webhook.
Optional description.
Response
Webhook ID
HMAC-SHA256 signing secret. Shown once. Use this to verify
X-Tuco-Signature on incoming webhooks.Endpoint URL
Subscribed events
Webhook name
Creation timestamp (ISO UTC)
Reminder to save the secret
Examples
curl -X POST "https://app.tuco.ai/api/webhooks" \
-H "Authorization: Bearer tuco_sk_xxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/webhooks/tuco",
"events": ["message.sent", "message.failed", "message.fallback", "message.reply", "message.opened"],
"name": "Production webhook"
}'
curl -X POST "https://app.tuco.ai/api/webhooks" \
-H "Authorization: Bearer tuco_sk_xxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/webhooks/replies",
"events": ["message.reply"],
"name": "Reply listener",
"description": "Forwards replies to Slack"
}'
201 Response
{
"id": "680a1b2c3d4e5f6789012345",
"secret": "dGhpcyBpcyBhIHNhbXBsZSBzZWNyZXQ=",
"url": "https://example.com/webhooks/tuco",
"events": ["message.sent", "message.failed", "message.fallback", "message.reply", "message.opened"],
"name": "Production webhook",
"description": null,
"createdAt": "2026-04-12T12:00:00.000Z",
"warning": "Save this secret now. You will not be able to see it again."
}
Copy the
secret from the response and store it securely (e.g. environment variable).
This is the only time it’s returned. If you lose it, delete the webhook and create a new one.Errors
| Status | When |
|---|---|
400 | URL missing, invalid URL format, no events, invalid event types, name missing |
401 | Invalid or missing API key |
402 | Subscription past due (workspace is read-only) |
⌘I