curl --request POST \
--url https://api.canary.effectiveai.app/api/v2/procedures/triggers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"procedureId": "<string>",
"enabled": true,
"version": "live",
"projectId": "<string>",
"schedule": {
"expressions": [
"<string>"
],
"timezone": "<string>"
},
"folder": {
"uri": "<string>",
"input": "<string>"
},
"event": {
"type": "email_received",
"input": "<string>",
"match": {
"senderEmails": [
"[email protected]"
]
}
},
"inputs": {},
"runAs": "self"
}
'import requests
url = "https://api.canary.effectiveai.app/api/v2/procedures/triggers"
payload = {
"name": "<string>",
"procedureId": "<string>",
"enabled": True,
"version": "live",
"projectId": "<string>",
"schedule": {
"expressions": ["<string>"],
"timezone": "<string>"
},
"folder": {
"uri": "<string>",
"input": "<string>"
},
"event": {
"type": "email_received",
"input": "<string>",
"match": { "senderEmails": ["[email protected]"] }
},
"inputs": {},
"runAs": "self"
}
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({
name: '<string>',
procedureId: '<string>',
enabled: true,
version: 'live',
projectId: '<string>',
schedule: {expressions: ['<string>'], timezone: '<string>'},
folder: {uri: '<string>', input: '<string>'},
event: {
type: 'email_received',
input: '<string>',
match: {senderEmails: ['[email protected]']}
},
inputs: {},
runAs: 'self'
})
};
fetch('https://api.canary.effectiveai.app/api/v2/procedures/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.canary.effectiveai.app/api/v2/procedures/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([
'name' => '<string>',
'procedureId' => '<string>',
'enabled' => true,
'version' => 'live',
'projectId' => '<string>',
'schedule' => [
'expressions' => [
'<string>'
],
'timezone' => '<string>'
],
'folder' => [
'uri' => '<string>',
'input' => '<string>'
],
'event' => [
'type' => 'email_received',
'input' => '<string>',
'match' => [
'senderEmails' => [
'[email protected]'
]
]
],
'inputs' => [
],
'runAs' => 'self'
]),
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.canary.effectiveai.app/api/v2/procedures/triggers"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"procedureId\": \"<string>\",\n \"enabled\": true,\n \"version\": \"live\",\n \"projectId\": \"<string>\",\n \"schedule\": {\n \"expressions\": [\n \"<string>\"\n ],\n \"timezone\": \"<string>\"\n },\n \"folder\": {\n \"uri\": \"<string>\",\n \"input\": \"<string>\"\n },\n \"event\": {\n \"type\": \"email_received\",\n \"input\": \"<string>\",\n \"match\": {\n \"senderEmails\": [\n \"[email protected]\"\n ]\n }\n },\n \"inputs\": {},\n \"runAs\": \"self\"\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.canary.effectiveai.app/api/v2/procedures/triggers")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"procedureId\": \"<string>\",\n \"enabled\": true,\n \"version\": \"live\",\n \"projectId\": \"<string>\",\n \"schedule\": {\n \"expressions\": [\n \"<string>\"\n ],\n \"timezone\": \"<string>\"\n },\n \"folder\": {\n \"uri\": \"<string>\",\n \"input\": \"<string>\"\n },\n \"event\": {\n \"type\": \"email_received\",\n \"input\": \"<string>\",\n \"match\": {\n \"senderEmails\": [\n \"[email protected]\"\n ]\n }\n },\n \"inputs\": {},\n \"runAs\": \"self\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.canary.effectiveai.app/api/v2/procedures/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 \"name\": \"<string>\",\n \"procedureId\": \"<string>\",\n \"enabled\": true,\n \"version\": \"live\",\n \"projectId\": \"<string>\",\n \"schedule\": {\n \"expressions\": [\n \"<string>\"\n ],\n \"timezone\": \"<string>\"\n },\n \"folder\": {\n \"uri\": \"<string>\",\n \"input\": \"<string>\"\n },\n \"event\": {\n \"type\": \"email_received\",\n \"input\": \"<string>\",\n \"match\": {\n \"senderEmails\": [\n \"[email protected]\"\n ]\n }\n },\n \"inputs\": {},\n \"runAs\": \"self\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"procedureId": "<string>",
"version": "live",
"projectId": "<string>",
"schedule": {
"expressions": [
"<string>"
],
"timezone": "<string>"
},
"folder": {
"uri": "<string>",
"input": "<string>"
},
"event": {
"type": "email_received",
"input": "<string>",
"match": {
"senderEmails": [
"[email protected]"
]
}
},
"inputs": {},
"kind": "schedule",
"revision": 1,
"enabled": true,
"runAs": {
"userId": "<string>",
"state": "valid"
},
"nextRunAt": "2023-11-07T05:31:56Z",
"runCount": 1,
"lastError": {
"message": "<string>",
"at": "2023-11-07T05:31:56Z"
},
"runTriggerId": "<string>"
}{
"error": "<string>",
"code": "<string>",
"details": [
{
"location": "path",
"path": [
"<string>"
],
"code": "required",
"message": "<string>"
}
],
"requestId": "<string>",
"dataset": "naic",
"businessCode": "<string>",
"violations": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"value": "<unknown>",
"constraint": "<string>",
"cite": "<string>"
}
],
"violationsTruncated": true,
"executionId": "<string>",
"accessUrl": "<string>"
}{
"error": "<string>",
"code": "<string>",
"details": [
{
"location": "path",
"path": [
"<string>"
],
"code": "required",
"message": "<string>"
}
],
"requestId": "<string>",
"dataset": "naic",
"businessCode": "<string>",
"violations": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"value": "<unknown>",
"constraint": "<string>",
"cite": "<string>"
}
],
"violationsTruncated": true,
"executionId": "<string>",
"accessUrl": "<string>"
}{
"error": "<string>",
"code": "<string>",
"details": [
{
"location": "path",
"path": [
"<string>"
],
"code": "required",
"message": "<string>"
}
],
"requestId": "<string>",
"dataset": "naic",
"businessCode": "<string>",
"violations": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"value": "<unknown>",
"constraint": "<string>",
"cite": "<string>"
}
],
"violationsTruncated": true,
"executionId": "<string>",
"accessUrl": "<string>"
}{
"error": "<string>",
"code": "<string>",
"details": [
{
"location": "path",
"path": [
"<string>"
],
"code": "required",
"message": "<string>"
}
],
"requestId": "<string>",
"dataset": "naic",
"businessCode": "<string>",
"violations": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"value": "<unknown>",
"constraint": "<string>",
"cite": "<string>"
}
],
"violationsTruncated": true,
"executionId": "<string>",
"accessUrl": "<string>"
}{
"error": "<string>",
"code": "<string>",
"details": [
{
"location": "path",
"path": [
"<string>"
],
"code": "required",
"message": "<string>"
}
],
"requestId": "<string>",
"dataset": "naic",
"businessCode": "<string>",
"violations": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"value": "<unknown>",
"constraint": "<string>",
"cite": "<string>"
}
],
"violationsTruncated": true,
"executionId": "<string>",
"accessUrl": "<string>"
}{
"error": "<string>",
"code": "<string>",
"details": [
{
"location": "path",
"path": [
"<string>"
],
"code": "required",
"message": "<string>"
}
],
"requestId": "<string>",
"dataset": "naic",
"businessCode": "<string>",
"violations": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"value": "<unknown>",
"constraint": "<string>",
"cite": "<string>"
}
],
"violationsTruncated": true,
"executionId": "<string>",
"accessUrl": "<string>"
}{
"error": "<string>",
"code": "<string>",
"details": [
{
"location": "path",
"path": [
"<string>"
],
"code": "required",
"message": "<string>"
}
],
"requestId": "<string>",
"dataset": "naic",
"businessCode": "<string>",
"violations": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"value": "<unknown>",
"constraint": "<string>",
"cite": "<string>"
}
],
"violationsTruncated": true,
"executionId": "<string>",
"accessUrl": "<string>"
}{
"error": "<string>",
"code": "<string>",
"details": [
{
"location": "path",
"path": [
"<string>"
],
"code": "required",
"message": "<string>"
}
],
"requestId": "<string>",
"dataset": "naic",
"businessCode": "<string>",
"violations": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"value": "<unknown>",
"constraint": "<string>",
"cite": "<string>"
}
],
"violationsTruncated": true,
"executionId": "<string>",
"accessUrl": "<string>"
}Create a procedure trigger
Creates a trigger that starts runs of a published procedure: on a cron schedule, for each new file in a folder, or for matching workspace events (email to one of the workspace’s addresses, a program log write, or a finished procedure run).
enabled is required. With enabled: true and runAs: "self" the trigger is created on, with its runs acting as you, and a schedule fires from its next time. It is created and enabled together: if it cannot be enabled, nothing is created. With enabled: false it is created off and running as no one; enable it later with enableProcedureTrigger.
The procedure version and static inputs are checked as a run’s would be, and a folder or project must exist. Needs procedures:manage on the procedure, and manage access to the project when projectId is set; scoped API keys need it on the procedure through their grants. Enabling also needs a member signed in or with an API key that acts as them in full: scoped API keys and app credentials are refused with 403 before anything is created, since later runs would not keep their limits.
Names are unique in the workspace, and a deleted trigger’s name stays taken, so a retry after a create that succeeded is refused with 409. After a 409 or a server error, read the trigger by name with getProcedureTrigger to see what was stored.
Alpha: this operation may change or be removed without notice.
curl --request POST \
--url https://api.canary.effectiveai.app/api/v2/procedures/triggers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"procedureId": "<string>",
"enabled": true,
"version": "live",
"projectId": "<string>",
"schedule": {
"expressions": [
"<string>"
],
"timezone": "<string>"
},
"folder": {
"uri": "<string>",
"input": "<string>"
},
"event": {
"type": "email_received",
"input": "<string>",
"match": {
"senderEmails": [
"[email protected]"
]
}
},
"inputs": {},
"runAs": "self"
}
'import requests
url = "https://api.canary.effectiveai.app/api/v2/procedures/triggers"
payload = {
"name": "<string>",
"procedureId": "<string>",
"enabled": True,
"version": "live",
"projectId": "<string>",
"schedule": {
"expressions": ["<string>"],
"timezone": "<string>"
},
"folder": {
"uri": "<string>",
"input": "<string>"
},
"event": {
"type": "email_received",
"input": "<string>",
"match": { "senderEmails": ["[email protected]"] }
},
"inputs": {},
"runAs": "self"
}
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({
name: '<string>',
procedureId: '<string>',
enabled: true,
version: 'live',
projectId: '<string>',
schedule: {expressions: ['<string>'], timezone: '<string>'},
folder: {uri: '<string>', input: '<string>'},
event: {
type: 'email_received',
input: '<string>',
match: {senderEmails: ['[email protected]']}
},
inputs: {},
runAs: 'self'
})
};
fetch('https://api.canary.effectiveai.app/api/v2/procedures/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.canary.effectiveai.app/api/v2/procedures/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([
'name' => '<string>',
'procedureId' => '<string>',
'enabled' => true,
'version' => 'live',
'projectId' => '<string>',
'schedule' => [
'expressions' => [
'<string>'
],
'timezone' => '<string>'
],
'folder' => [
'uri' => '<string>',
'input' => '<string>'
],
'event' => [
'type' => 'email_received',
'input' => '<string>',
'match' => [
'senderEmails' => [
'[email protected]'
]
]
],
'inputs' => [
],
'runAs' => 'self'
]),
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.canary.effectiveai.app/api/v2/procedures/triggers"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"procedureId\": \"<string>\",\n \"enabled\": true,\n \"version\": \"live\",\n \"projectId\": \"<string>\",\n \"schedule\": {\n \"expressions\": [\n \"<string>\"\n ],\n \"timezone\": \"<string>\"\n },\n \"folder\": {\n \"uri\": \"<string>\",\n \"input\": \"<string>\"\n },\n \"event\": {\n \"type\": \"email_received\",\n \"input\": \"<string>\",\n \"match\": {\n \"senderEmails\": [\n \"[email protected]\"\n ]\n }\n },\n \"inputs\": {},\n \"runAs\": \"self\"\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.canary.effectiveai.app/api/v2/procedures/triggers")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"procedureId\": \"<string>\",\n \"enabled\": true,\n \"version\": \"live\",\n \"projectId\": \"<string>\",\n \"schedule\": {\n \"expressions\": [\n \"<string>\"\n ],\n \"timezone\": \"<string>\"\n },\n \"folder\": {\n \"uri\": \"<string>\",\n \"input\": \"<string>\"\n },\n \"event\": {\n \"type\": \"email_received\",\n \"input\": \"<string>\",\n \"match\": {\n \"senderEmails\": [\n \"[email protected]\"\n ]\n }\n },\n \"inputs\": {},\n \"runAs\": \"self\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.canary.effectiveai.app/api/v2/procedures/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 \"name\": \"<string>\",\n \"procedureId\": \"<string>\",\n \"enabled\": true,\n \"version\": \"live\",\n \"projectId\": \"<string>\",\n \"schedule\": {\n \"expressions\": [\n \"<string>\"\n ],\n \"timezone\": \"<string>\"\n },\n \"folder\": {\n \"uri\": \"<string>\",\n \"input\": \"<string>\"\n },\n \"event\": {\n \"type\": \"email_received\",\n \"input\": \"<string>\",\n \"match\": {\n \"senderEmails\": [\n \"[email protected]\"\n ]\n }\n },\n \"inputs\": {},\n \"runAs\": \"self\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"procedureId": "<string>",
"version": "live",
"projectId": "<string>",
"schedule": {
"expressions": [
"<string>"
],
"timezone": "<string>"
},
"folder": {
"uri": "<string>",
"input": "<string>"
},
"event": {
"type": "email_received",
"input": "<string>",
"match": {
"senderEmails": [
"[email protected]"
]
}
},
"inputs": {},
"kind": "schedule",
"revision": 1,
"enabled": true,
"runAs": {
"userId": "<string>",
"state": "valid"
},
"nextRunAt": "2023-11-07T05:31:56Z",
"runCount": 1,
"lastError": {
"message": "<string>",
"at": "2023-11-07T05:31:56Z"
},
"runTriggerId": "<string>"
}{
"error": "<string>",
"code": "<string>",
"details": [
{
"location": "path",
"path": [
"<string>"
],
"code": "required",
"message": "<string>"
}
],
"requestId": "<string>",
"dataset": "naic",
"businessCode": "<string>",
"violations": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"value": "<unknown>",
"constraint": "<string>",
"cite": "<string>"
}
],
"violationsTruncated": true,
"executionId": "<string>",
"accessUrl": "<string>"
}{
"error": "<string>",
"code": "<string>",
"details": [
{
"location": "path",
"path": [
"<string>"
],
"code": "required",
"message": "<string>"
}
],
"requestId": "<string>",
"dataset": "naic",
"businessCode": "<string>",
"violations": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"value": "<unknown>",
"constraint": "<string>",
"cite": "<string>"
}
],
"violationsTruncated": true,
"executionId": "<string>",
"accessUrl": "<string>"
}{
"error": "<string>",
"code": "<string>",
"details": [
{
"location": "path",
"path": [
"<string>"
],
"code": "required",
"message": "<string>"
}
],
"requestId": "<string>",
"dataset": "naic",
"businessCode": "<string>",
"violations": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"value": "<unknown>",
"constraint": "<string>",
"cite": "<string>"
}
],
"violationsTruncated": true,
"executionId": "<string>",
"accessUrl": "<string>"
}{
"error": "<string>",
"code": "<string>",
"details": [
{
"location": "path",
"path": [
"<string>"
],
"code": "required",
"message": "<string>"
}
],
"requestId": "<string>",
"dataset": "naic",
"businessCode": "<string>",
"violations": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"value": "<unknown>",
"constraint": "<string>",
"cite": "<string>"
}
],
"violationsTruncated": true,
"executionId": "<string>",
"accessUrl": "<string>"
}{
"error": "<string>",
"code": "<string>",
"details": [
{
"location": "path",
"path": [
"<string>"
],
"code": "required",
"message": "<string>"
}
],
"requestId": "<string>",
"dataset": "naic",
"businessCode": "<string>",
"violations": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"value": "<unknown>",
"constraint": "<string>",
"cite": "<string>"
}
],
"violationsTruncated": true,
"executionId": "<string>",
"accessUrl": "<string>"
}{
"error": "<string>",
"code": "<string>",
"details": [
{
"location": "path",
"path": [
"<string>"
],
"code": "required",
"message": "<string>"
}
],
"requestId": "<string>",
"dataset": "naic",
"businessCode": "<string>",
"violations": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"value": "<unknown>",
"constraint": "<string>",
"cite": "<string>"
}
],
"violationsTruncated": true,
"executionId": "<string>",
"accessUrl": "<string>"
}{
"error": "<string>",
"code": "<string>",
"details": [
{
"location": "path",
"path": [
"<string>"
],
"code": "required",
"message": "<string>"
}
],
"requestId": "<string>",
"dataset": "naic",
"businessCode": "<string>",
"violations": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"value": "<unknown>",
"constraint": "<string>",
"cite": "<string>"
}
],
"violationsTruncated": true,
"executionId": "<string>",
"accessUrl": "<string>"
}{
"error": "<string>",
"code": "<string>",
"details": [
{
"location": "path",
"path": [
"<string>"
],
"code": "required",
"message": "<string>"
}
],
"requestId": "<string>",
"dataset": "naic",
"businessCode": "<string>",
"violations": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"value": "<unknown>",
"constraint": "<string>",
"cite": "<string>"
}
],
"violationsTruncated": true,
"executionId": "<string>",
"accessUrl": "<string>"
}Authorizations
Body
Response
The trigger: enabled and running as you after enabled: true, otherwise disabled and running as no one.
A procedure trigger. Its spec is name, procedureId, version, projectId, schedule, folder, event and inputs: send those, with enabled (and runAs to enable it), to createProcedureTrigger to copy it under a new name, or with expectedRevision set to its revision to replaceProcedureTrigger. The other fields are the trigger’s state, and a request that sends them is refused.