Triggers
Create a trigger in a workspace
Requires workspaces:write and agents:read. A key may create time (schedule) triggers only — webhook and api triggers are a 403. workspace_agent_id must name an agent installed in this workspace. The key is recorded as the trigger’s creator. See Schedule triggers.
POST
/
workspaces
/
{workspace_id_or_name}
/
triggers
Create a trigger in a workspace
curl --request POST \
--url https://api.guild.ai/v1/workspaces/{workspace_id_or_name}/triggers \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"workspace_agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"type": "webhook",
"webhook_config_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": null,
"event_type": null,
"action": null,
"service_config": null,
"agent_input": null
}
'import requests
url = "https://api.guild.ai/v1/workspaces/{workspace_id_or_name}/triggers"
payload = {
"workspace_agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"type": "webhook",
"webhook_config_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": None,
"event_type": None,
"action": None,
"service_config": None,
"agent_input": None
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
workspace_agent_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
type: 'webhook',
webhook_config_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
name: null,
event_type: null,
action: null,
service_config: null,
agent_input: null
})
};
fetch('https://api.guild.ai/v1/workspaces/{workspace_id_or_name}/triggers', 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://api.guild.ai/v1/workspaces/{workspace_id_or_name}/triggers",
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([
'workspace_agent_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'type' => 'webhook',
'webhook_config_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'name' => null,
'event_type' => null,
'action' => null,
'service_config' => null,
'agent_input' => null
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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://api.guild.ai/v1/workspaces/{workspace_id_or_name}/triggers"
payload := strings.NewReader("{\n \"workspace_agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"type\": \"webhook\",\n \"webhook_config_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": null,\n \"event_type\": null,\n \"action\": null,\n \"service_config\": null,\n \"agent_input\": null\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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://api.guild.ai/v1/workspaces/{workspace_id_or_name}/triggers")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"workspace_agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"type\": \"webhook\",\n \"webhook_config_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": null,\n \"event_type\": null,\n \"action\": null,\n \"service_config\": null,\n \"agent_input\": null\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.guild.ai/v1/workspaces/{workspace_id_or_name}/triggers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"workspace_agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"type\": \"webhook\",\n \"webhook_config_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": null,\n \"event_type\": null,\n \"action\": null,\n \"service_config\": null,\n \"agent_input\": null\n}"
response = http.request(request)
puts response.read_body{}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}Authorizations
apiKeybearerApiKeyoauth2
API key: key id as the username, secret as the password. An account API key carries the same scopes as an OAuth token and is checked against the scopes listed under oauth2 on each operation. A trigger API key is limited to its trigger's workspace and reaches only the session operations that list this scheme alongside the oauth2 scopes.
Path Parameters
Body
application/json
- CreateWebhookTriggerBody
- CreateTimeTriggerBody
- CreateApiTriggerBody
Installed agent ID
Available options:
webhook Trigger name
Response
The created trigger
The response is of type object.
⌘I
Create a trigger in a workspace
curl --request POST \
--url https://api.guild.ai/v1/workspaces/{workspace_id_or_name}/triggers \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"workspace_agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"type": "webhook",
"webhook_config_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": null,
"event_type": null,
"action": null,
"service_config": null,
"agent_input": null
}
'import requests
url = "https://api.guild.ai/v1/workspaces/{workspace_id_or_name}/triggers"
payload = {
"workspace_agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"type": "webhook",
"webhook_config_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": None,
"event_type": None,
"action": None,
"service_config": None,
"agent_input": None
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
workspace_agent_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
type: 'webhook',
webhook_config_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
name: null,
event_type: null,
action: null,
service_config: null,
agent_input: null
})
};
fetch('https://api.guild.ai/v1/workspaces/{workspace_id_or_name}/triggers', 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://api.guild.ai/v1/workspaces/{workspace_id_or_name}/triggers",
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([
'workspace_agent_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'type' => 'webhook',
'webhook_config_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'name' => null,
'event_type' => null,
'action' => null,
'service_config' => null,
'agent_input' => null
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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://api.guild.ai/v1/workspaces/{workspace_id_or_name}/triggers"
payload := strings.NewReader("{\n \"workspace_agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"type\": \"webhook\",\n \"webhook_config_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": null,\n \"event_type\": null,\n \"action\": null,\n \"service_config\": null,\n \"agent_input\": null\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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://api.guild.ai/v1/workspaces/{workspace_id_or_name}/triggers")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"workspace_agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"type\": \"webhook\",\n \"webhook_config_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": null,\n \"event_type\": null,\n \"action\": null,\n \"service_config\": null,\n \"agent_input\": null\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.guild.ai/v1/workspaces/{workspace_id_or_name}/triggers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"workspace_agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"type\": \"webhook\",\n \"webhook_config_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": null,\n \"event_type\": null,\n \"action\": null,\n \"service_config\": null,\n \"agent_input\": null\n}"
response = http.request(request)
puts response.read_body{}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}