Create a WebSocket trigger
curl --request POST \
--url https://app.hookie.ai/admin/api/projects/{project_id}/ws-triggers \
--header 'Content-Type: application/json' \
--cookie hookie_session= \
--data '
{
"name": "<string>",
"url": "<string>",
"headers": {},
"subprotocols": [],
"connect_message": "<string>",
"conditions": [],
"mappings": [
{}
],
"dataset": "<string>"
}
'const options = {
method: 'POST',
headers: {cookie: 'hookie_session=', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
url: '<string>',
headers: {},
subprotocols: [],
connect_message: '<string>',
conditions: [],
mappings: [{}],
dataset: '<string>'
})
};
fetch('https://app.hookie.ai/admin/api/projects/{project_id}/ws-triggers', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://app.hookie.ai/admin/api/projects/{project_id}/ws-triggers"
payload = {
"name": "<string>",
"url": "<string>",
"headers": {},
"subprotocols": [],
"connect_message": "<string>",
"conditions": [],
"mappings": [{}],
"dataset": "<string>"
}
headers = {
"cookie": "hookie_session=",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "<string>"
}{
"error": "<string>",
"retry_after": 123,
"upgrade_url": "<string>"
}{
"error": "<string>",
"retry_after": 123,
"upgrade_url": "<string>"
}{
"error": "<string>",
"retry_after": 123,
"upgrade_url": "<string>"
}{
"error": "<string>",
"retry_after": 123,
"upgrade_url": "<string>"
}{
"error": "<string>",
"retry_after": 123,
"upgrade_url": "<string>"
}WebSocket triggers
Create a WebSocket trigger
POST
/
admin
/
api
/
projects
/
{project_id}
/
ws-triggers
Create a WebSocket trigger
curl --request POST \
--url https://app.hookie.ai/admin/api/projects/{project_id}/ws-triggers \
--header 'Content-Type: application/json' \
--cookie hookie_session= \
--data '
{
"name": "<string>",
"url": "<string>",
"headers": {},
"subprotocols": [],
"connect_message": "<string>",
"conditions": [],
"mappings": [
{}
],
"dataset": "<string>"
}
'const options = {
method: 'POST',
headers: {cookie: 'hookie_session=', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
url: '<string>',
headers: {},
subprotocols: [],
connect_message: '<string>',
conditions: [],
mappings: [{}],
dataset: '<string>'
})
};
fetch('https://app.hookie.ai/admin/api/projects/{project_id}/ws-triggers', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://app.hookie.ai/admin/api/projects/{project_id}/ws-triggers"
payload = {
"name": "<string>",
"url": "<string>",
"headers": {},
"subprotocols": [],
"connect_message": "<string>",
"conditions": [],
"mappings": [{}],
"dataset": "<string>"
}
headers = {
"cookie": "hookie_session=",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "<string>"
}{
"error": "<string>",
"retry_after": 123,
"upgrade_url": "<string>"
}{
"error": "<string>",
"retry_after": 123,
"upgrade_url": "<string>"
}{
"error": "<string>",
"retry_after": 123,
"upgrade_url": "<string>"
}{
"error": "<string>",
"retry_after": 123,
"upgrade_url": "<string>"
}{
"error": "<string>",
"retry_after": 123,
"upgrade_url": "<string>"
}Authorizations
sessionbearerAuth
The console's sealed session cookie, set by WorkOS AuthKit. Mutating requests also require the X-Requested-With CSRF header.
Path Parameters
Body
application/json
Required string length:
1 - 80Must start with ws:// or wss://. Encrypted at rest with the rest of the connection config.
Connection headers. Encrypted; never returned.
Sent once on connect (e.g. a subscribe frame).
Frame filter. An empty array matches every frame. Not validated at write time.
Show child attributes
Show child attributes
Optional [{path,key}] field mappings. Stored as null when not an array.
Response
Created, enabled, and the WsListener Durable Object is armed immediately. NOTE: this handler returns 200, not 201.