curl --request PUT \
--url https://api.canary.effectiveai.app/api/v2/procedures/triggers/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"procedureId": "<string>",
"expectedRevision": 1,
"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/{id}"
payload = {
"name": "<string>",
"procedureId": "<string>",
"expectedRevision": 1,
"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.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
procedureId: '<string>',
expectedRevision: 1,
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/{id}', 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/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'procedureId' => '<string>',
'expectedRevision' => 1,
'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/{id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"procedureId\": \"<string>\",\n \"expectedRevision\": 1,\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("PUT", 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.put("https://api.canary.effectiveai.app/api/v2/procedures/triggers/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"procedureId\": \"<string>\",\n \"expectedRevision\": 1,\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/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"procedureId\": \"<string>\",\n \"expectedRevision\": 1,\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>"
}Replace a procedure trigger’s spec
Replaces the trigger’s whole spec and moves it to the next revision. The access its runs used was given for the old spec, so it is not kept: enabled is required and says what the trigger runs as now. With enabled: true and runAs: "self" the new spec is enabled in the same request, with its runs acting as you. With enabled: false the trigger is disabled and runs as no one.
The trigger is disabled while its spec is replaced. If the request fails after that, the trigger is left disabled, even with enabled: true: read it, then enable it with enableProcedureTrigger or replace it again from its new revision.
Send the trigger’s spec fields as getProcedureTrigger returns them, changed, with expectedRevision set to its revision: a trigger changed since that revision is refused with 409, so a retry after a replace that succeeded is refused too; read the trigger to see its revision. name cannot change. Needs procedures:manage on the trigger’s procedure and on the one the new spec names. 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 the trigger is changed.
Alpha: this operation may change or be removed without notice.
curl --request PUT \
--url https://api.canary.effectiveai.app/api/v2/procedures/triggers/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"procedureId": "<string>",
"expectedRevision": 1,
"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/{id}"
payload = {
"name": "<string>",
"procedureId": "<string>",
"expectedRevision": 1,
"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.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
procedureId: '<string>',
expectedRevision: 1,
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/{id}', 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/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'procedureId' => '<string>',
'expectedRevision' => 1,
'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/{id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"procedureId\": \"<string>\",\n \"expectedRevision\": 1,\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("PUT", 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.put("https://api.canary.effectiveai.app/api/v2/procedures/triggers/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"procedureId\": \"<string>\",\n \"expectedRevision\": 1,\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/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"procedureId\": \"<string>\",\n \"expectedRevision\": 1,\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 at its new revision: 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.