Create a trigger
curl --request POST \
--url https://api.devic.ai/v1/triggers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"toolServerId": "<string>",
"triggerSlug": "GMAIL_NEW_GMAIL_MESSAGE",
"agentId": "<string>",
"assistantId": "<string>",
"triggerConfig": {},
"name": "<string>",
"messageTemplate": "<string>",
"chatUidTemplate": "<string>",
"rateLimitPerMinute": 123
}
'import requests
url = "https://api.devic.ai/v1/triggers"
payload = {
"toolServerId": "<string>",
"triggerSlug": "GMAIL_NEW_GMAIL_MESSAGE",
"agentId": "<string>",
"assistantId": "<string>",
"triggerConfig": {},
"name": "<string>",
"messageTemplate": "<string>",
"chatUidTemplate": "<string>",
"rateLimitPerMinute": 123
}
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({
toolServerId: '<string>',
triggerSlug: 'GMAIL_NEW_GMAIL_MESSAGE',
agentId: '<string>',
assistantId: '<string>',
triggerConfig: {},
name: '<string>',
messageTemplate: '<string>',
chatUidTemplate: '<string>',
rateLimitPerMinute: 123
})
};
fetch('https://api.devic.ai/v1/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.devic.ai/v1/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([
'toolServerId' => '<string>',
'triggerSlug' => 'GMAIL_NEW_GMAIL_MESSAGE',
'agentId' => '<string>',
'assistantId' => '<string>',
'triggerConfig' => [
],
'name' => '<string>',
'messageTemplate' => '<string>',
'chatUidTemplate' => '<string>',
'rateLimitPerMinute' => 123
]),
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://api.devic.ai/v1/triggers"
payload := strings.NewReader("{\n \"toolServerId\": \"<string>\",\n \"triggerSlug\": \"GMAIL_NEW_GMAIL_MESSAGE\",\n \"agentId\": \"<string>\",\n \"assistantId\": \"<string>\",\n \"triggerConfig\": {},\n \"name\": \"<string>\",\n \"messageTemplate\": \"<string>\",\n \"chatUidTemplate\": \"<string>\",\n \"rateLimitPerMinute\": 123\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://api.devic.ai/v1/triggers")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"toolServerId\": \"<string>\",\n \"triggerSlug\": \"GMAIL_NEW_GMAIL_MESSAGE\",\n \"agentId\": \"<string>\",\n \"assistantId\": \"<string>\",\n \"triggerConfig\": {},\n \"name\": \"<string>\",\n \"messageTemplate\": \"<string>\",\n \"chatUidTemplate\": \"<string>\",\n \"rateLimitPerMinute\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.devic.ai/v1/triggers")
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 \"toolServerId\": \"<string>\",\n \"triggerSlug\": \"GMAIL_NEW_GMAIL_MESSAGE\",\n \"agentId\": \"<string>\",\n \"assistantId\": \"<string>\",\n \"triggerConfig\": {},\n \"name\": \"<string>\",\n \"messageTemplate\": \"<string>\",\n \"chatUidTemplate\": \"<string>\",\n \"rateLimitPerMinute\": 123\n}"
response = http.request(request)
puts response.read_bodyTriggers
Create a trigger
Starts an agent or assistant when the app emits the chosen event. The tool server must be an app integration; provide exactly one of agentId / assistantId.
POST
/
v1
/
triggers
Create a trigger
curl --request POST \
--url https://api.devic.ai/v1/triggers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"toolServerId": "<string>",
"triggerSlug": "GMAIL_NEW_GMAIL_MESSAGE",
"agentId": "<string>",
"assistantId": "<string>",
"triggerConfig": {},
"name": "<string>",
"messageTemplate": "<string>",
"chatUidTemplate": "<string>",
"rateLimitPerMinute": 123
}
'import requests
url = "https://api.devic.ai/v1/triggers"
payload = {
"toolServerId": "<string>",
"triggerSlug": "GMAIL_NEW_GMAIL_MESSAGE",
"agentId": "<string>",
"assistantId": "<string>",
"triggerConfig": {},
"name": "<string>",
"messageTemplate": "<string>",
"chatUidTemplate": "<string>",
"rateLimitPerMinute": 123
}
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({
toolServerId: '<string>',
triggerSlug: 'GMAIL_NEW_GMAIL_MESSAGE',
agentId: '<string>',
assistantId: '<string>',
triggerConfig: {},
name: '<string>',
messageTemplate: '<string>',
chatUidTemplate: '<string>',
rateLimitPerMinute: 123
})
};
fetch('https://api.devic.ai/v1/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.devic.ai/v1/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([
'toolServerId' => '<string>',
'triggerSlug' => 'GMAIL_NEW_GMAIL_MESSAGE',
'agentId' => '<string>',
'assistantId' => '<string>',
'triggerConfig' => [
],
'name' => '<string>',
'messageTemplate' => '<string>',
'chatUidTemplate' => '<string>',
'rateLimitPerMinute' => 123
]),
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://api.devic.ai/v1/triggers"
payload := strings.NewReader("{\n \"toolServerId\": \"<string>\",\n \"triggerSlug\": \"GMAIL_NEW_GMAIL_MESSAGE\",\n \"agentId\": \"<string>\",\n \"assistantId\": \"<string>\",\n \"triggerConfig\": {},\n \"name\": \"<string>\",\n \"messageTemplate\": \"<string>\",\n \"chatUidTemplate\": \"<string>\",\n \"rateLimitPerMinute\": 123\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://api.devic.ai/v1/triggers")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"toolServerId\": \"<string>\",\n \"triggerSlug\": \"GMAIL_NEW_GMAIL_MESSAGE\",\n \"agentId\": \"<string>\",\n \"assistantId\": \"<string>\",\n \"triggerConfig\": {},\n \"name\": \"<string>\",\n \"messageTemplate\": \"<string>\",\n \"chatUidTemplate\": \"<string>\",\n \"rateLimitPerMinute\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.devic.ai/v1/triggers")
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 \"toolServerId\": \"<string>\",\n \"triggerSlug\": \"GMAIL_NEW_GMAIL_MESSAGE\",\n \"agentId\": \"<string>\",\n \"assistantId\": \"<string>\",\n \"triggerConfig\": {},\n \"name\": \"<string>\",\n \"messageTemplate\": \"<string>\",\n \"chatUidTemplate\": \"<string>\",\n \"rateLimitPerMinute\": 123\n}"
response = http.request(request)
puts response.read_bodyAuthorizations
Use JWT token for authentication
Body
application/json
The app-integration tool server whose events this listens to
Trigger type slug (from GET /integrations/:app/triggers)
Example:
"GMAIL_NEW_GMAIL_MESSAGE"
Agent to start. Exactly one of agentId / assistantId is required.
Assistant to start. Exactly one of agentId / assistantId is required.
Values for the trigger type's config JSON Schema
Template rendering the event into the message. Empty ⇒ raw event JSON.
Assistants only: stable chat id template so related events share a conversation
Agents only: initial thread state
Available options:
queued, paused Per-trigger events/minute ceiling
Response
Trigger created
⌘I