Dry-run a trigger rule
curl --request POST \
--url https://{space}.{region}.api.niadra.com/v1/triggers/dry-run \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"rule_id": "overdue-visit",
"condition": "promise.overdue",
"params": {
"days": 1
},
"endpoint_id": "whe_crm",
"window_hours": 24,
"late_policy": "deliver_marked"
}
'import requests
url = "https://{space}.{region}.api.niadra.com/v1/triggers/dry-run"
payload = {
"rule_id": "overdue-visit",
"condition": "promise.overdue",
"params": { "days": 1 },
"endpoint_id": "whe_crm",
"window_hours": 24,
"late_policy": "deliver_marked"
}
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({
rule_id: 'overdue-visit',
condition: 'promise.overdue',
params: {days: 1},
endpoint_id: 'whe_crm',
window_hours: 24,
late_policy: 'deliver_marked'
})
};
fetch('https://{space}.{region}.api.niadra.com/v1/triggers/dry-run', 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://{space}.{region}.api.niadra.com/v1/triggers/dry-run",
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([
'rule_id' => 'overdue-visit',
'condition' => 'promise.overdue',
'params' => [
'days' => 1
],
'endpoint_id' => 'whe_crm',
'window_hours' => 24,
'late_policy' => 'deliver_marked'
]),
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://{space}.{region}.api.niadra.com/v1/triggers/dry-run"
payload := strings.NewReader("{\n \"rule_id\": \"overdue-visit\",\n \"condition\": \"promise.overdue\",\n \"params\": {\n \"days\": 1\n },\n \"endpoint_id\": \"whe_crm\",\n \"window_hours\": 24,\n \"late_policy\": \"deliver_marked\"\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://{space}.{region}.api.niadra.com/v1/triggers/dry-run")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"rule_id\": \"overdue-visit\",\n \"condition\": \"promise.overdue\",\n \"params\": {\n \"days\": 1\n },\n \"endpoint_id\": \"whe_crm\",\n \"window_hours\": 24,\n \"late_policy\": \"deliver_marked\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{space}.{region}.api.niadra.com/v1/triggers/dry-run")
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 \"rule_id\": \"overdue-visit\",\n \"condition\": \"promise.overdue\",\n \"params\": {\n \"days\": 1\n },\n \"endpoint_id\": \"whe_crm\",\n \"window_hours\": 24,\n \"late_policy\": \"deliver_marked\"\n}"
response = http.request(request)
puts response.read_body{
"rule_id": "overdue-visit",
"window_days": 30,
"subjects_evaluated": 48210,
"would_fire": 214,
"target_problem": null,
"sample": [
{
"subject_id": "0192f7a0-3b2e-7d41-8c5a-2e9f4b7a1c03",
"pseudonym": "psn_7f3a",
"evidence": [
{
"kind": "open_item",
"id": "oi_01J8ZK"
}
]
}
]
}{
"code": "<string>",
"status": 123,
"title": "<string>",
"detail": "<string>",
"request_id": "<string>",
"type": "about:blank"
}Triggers and webhooks
Dry-run a trigger rule
How many firings the rule would have had over the last 30 days, with a sample.
POST
/
v1
/
triggers
/
dry-run
Dry-run a trigger rule
curl --request POST \
--url https://{space}.{region}.api.niadra.com/v1/triggers/dry-run \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"rule_id": "overdue-visit",
"condition": "promise.overdue",
"params": {
"days": 1
},
"endpoint_id": "whe_crm",
"window_hours": 24,
"late_policy": "deliver_marked"
}
'import requests
url = "https://{space}.{region}.api.niadra.com/v1/triggers/dry-run"
payload = {
"rule_id": "overdue-visit",
"condition": "promise.overdue",
"params": { "days": 1 },
"endpoint_id": "whe_crm",
"window_hours": 24,
"late_policy": "deliver_marked"
}
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({
rule_id: 'overdue-visit',
condition: 'promise.overdue',
params: {days: 1},
endpoint_id: 'whe_crm',
window_hours: 24,
late_policy: 'deliver_marked'
})
};
fetch('https://{space}.{region}.api.niadra.com/v1/triggers/dry-run', 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://{space}.{region}.api.niadra.com/v1/triggers/dry-run",
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([
'rule_id' => 'overdue-visit',
'condition' => 'promise.overdue',
'params' => [
'days' => 1
],
'endpoint_id' => 'whe_crm',
'window_hours' => 24,
'late_policy' => 'deliver_marked'
]),
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://{space}.{region}.api.niadra.com/v1/triggers/dry-run"
payload := strings.NewReader("{\n \"rule_id\": \"overdue-visit\",\n \"condition\": \"promise.overdue\",\n \"params\": {\n \"days\": 1\n },\n \"endpoint_id\": \"whe_crm\",\n \"window_hours\": 24,\n \"late_policy\": \"deliver_marked\"\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://{space}.{region}.api.niadra.com/v1/triggers/dry-run")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"rule_id\": \"overdue-visit\",\n \"condition\": \"promise.overdue\",\n \"params\": {\n \"days\": 1\n },\n \"endpoint_id\": \"whe_crm\",\n \"window_hours\": 24,\n \"late_policy\": \"deliver_marked\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{space}.{region}.api.niadra.com/v1/triggers/dry-run")
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 \"rule_id\": \"overdue-visit\",\n \"condition\": \"promise.overdue\",\n \"params\": {\n \"days\": 1\n },\n \"endpoint_id\": \"whe_crm\",\n \"window_hours\": 24,\n \"late_policy\": \"deliver_marked\"\n}"
response = http.request(request)
puts response.read_body{
"rule_id": "overdue-visit",
"window_days": 30,
"subjects_evaluated": 48210,
"would_fire": 214,
"target_problem": null,
"sample": [
{
"subject_id": "0192f7a0-3b2e-7d41-8c5a-2e9f4b7a1c03",
"pseudonym": "psn_7f3a",
"evidence": [
{
"kind": "open_item",
"id": "oi_01J8ZK"
}
]
}
]
}{
"code": "<string>",
"status": 123,
"title": "<string>",
"detail": "<string>",
"request_id": "<string>",
"type": "about:blank"
}Authorizations
sourceKeypersonToken
nia_sk_...
Body
application/json
Available options:
promise.overdue, open_item.due, trait.present, sentiment.drop, identity.ambiguous, fact.contradicted_by_system_event, recontact, context_use.repetition_rate, source.silent Pattern:
^[a-z][a-z0-9_.:-]{0,63}$Available options:
deliver_marked, suppress Required range:
1 <= x <= 2160Response
How many firings the rule would have had, with a sample.

