Inbound Webhooks
curl --request POST \
--url https://composer.personal.ai/hook/v1/{instance} \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--data '
{
"type": "<string>",
"data": {},
"id": "<string>",
"version": 123
}
'import requests
url = "https://composer.personal.ai/hook/v1/{instance}"
payload = {
"type": "<string>",
"data": {},
"id": "<string>",
"version": 123
}
headers = {
"x-api-key": "<x-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': '<x-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({type: '<string>', data: {}, id: '<string>', version: 123})
};
fetch('https://composer.personal.ai/hook/v1/{instance}', 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://composer.personal.ai/hook/v1/{instance}",
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([
'type' => '<string>',
'data' => [
],
'id' => '<string>',
'version' => 123
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <x-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://composer.personal.ai/hook/v1/{instance}"
payload := strings.NewReader("{\n \"type\": \"<string>\",\n \"data\": {},\n \"id\": \"<string>\",\n \"version\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<x-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://composer.personal.ai/hook/v1/{instance}")
.header("x-api-key", "<x-api-key>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"<string>\",\n \"data\": {},\n \"id\": \"<string>\",\n \"version\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://composer.personal.ai/hook/v1/{instance}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<x-api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"<string>\",\n \"data\": {},\n \"id\": \"<string>\",\n \"version\": 123\n}"
response = http.request(request)
puts response.read_bodyEvents & Webhooks
Inbound Webhooks
Send events from a device or outside system to start recipes
POST
/
hook
/
v1
/
{instance}
Inbound Webhooks
curl --request POST \
--url https://composer.personal.ai/hook/v1/{instance} \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--data '
{
"type": "<string>",
"data": {},
"id": "<string>",
"version": 123
}
'import requests
url = "https://composer.personal.ai/hook/v1/{instance}"
payload = {
"type": "<string>",
"data": {},
"id": "<string>",
"version": 123
}
headers = {
"x-api-key": "<x-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': '<x-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({type: '<string>', data: {}, id: '<string>', version: 123})
};
fetch('https://composer.personal.ai/hook/v1/{instance}', 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://composer.personal.ai/hook/v1/{instance}",
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([
'type' => '<string>',
'data' => [
],
'id' => '<string>',
'version' => 123
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <x-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://composer.personal.ai/hook/v1/{instance}"
payload := strings.NewReader("{\n \"type\": \"<string>\",\n \"data\": {},\n \"id\": \"<string>\",\n \"version\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<x-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://composer.personal.ai/hook/v1/{instance}")
.header("x-api-key", "<x-api-key>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"<string>\",\n \"data\": {},\n \"id\": \"<string>\",\n \"version\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://composer.personal.ai/hook/v1/{instance}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<x-api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"<string>\",\n \"data\": {},\n \"id\": \"<string>\",\n \"version\": 123\n}"
response = http.request(request)
puts response.read_bodyOverview
Lets a device or another system, such as a doorbell, a POS or a form tool, send events into Composer. Each accepted event can start a recipe. Each device is registered as an instance, declares the event types it sends, and has its own webhook key. A webhook key can only send events for its own instance. To see what a device has sent and why anything was refused, use List Webhook Deliveries.Authorization
Path
Body
The event type. It must be one the instance declares.
Example
"type": "doorbell.pressed"
Example Request
{
"type": "doorbell.pressed",
"id": "evt_01",
"data": { "door": "front" }
}
Response
202 Accepted for a new event:
Example Success Response
{
"accepted": true,
"event_id": "8c7b6a59-4837-4261-9f0e-1d2c3b4a5968",
"type": "doorbell.pressed"
}
200 for an event with an id that was already received:
{ "accepted": true, "duplicate": true }
Example cURL
cURL
curl --request POST 'https://composer.personal.ai/hook/v1/front-door' \
--header 'Content-Type: application/json' \
--header 'x-api-key: <webhook-key>' \
--data '{"type": "doorbell.pressed", "id": "evt_01", "data": {"door": "front"}}'
Error Codes
Errors come back as JSON:{ "error": "..." }.
| Code | Description |
|---|---|
| 400 | The body isn’t valid JSON, has no type, or data doesn’t match the event type’s schema |
| 401 | Missing or invalid key |
| 403 | The key doesn’t belong to this instance, or the instance doesn’t declare this event type |
| 413 | The body is larger than 64 KB |
| 429 | More than 120 events in a minute from this instance |