# Ask before an outbound contact; with Niadra out of reach the purpose decides (marketing waits)
decision = conversation.check("proposal_followup", purpose="marketing", channel="whatsapp")
if decision.decision == "allow":
gateway.send(message, token=decision.contact_token)
conversation.declare.contact_made(decision, purpose="marketing", channel="whatsapp")// Ask before an outbound contact; with Niadra out of reach the purpose decides (marketing waits)
const decision = await convo.check("proposal_followup", { purpose: "marketing", channel: "whatsapp" });
if (decision.decision === "allow") {
await gateway.send(message, { token: decision.contact_token });
convo.declare.contactMade(decision, { purpose: "marketing", channel: "whatsapp" });
}curl --request POST \
--url https://{space}.{region}.api.niadra.com/v1/coordination/check \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agent": "<string>",
"intent": "<string>",
"purpose": "<string>",
"channel": "<string>",
"destination_hash": "<string>",
"effect_key": "<string>",
"effect_kind": "delivery",
"gateway_id": "<string>",
"object": {
"id": "<string>",
"namespace": "<string>",
"type": "<string>"
},
"subject": {
"value": "<string>",
"scope": "<string>"
},
"task": "<string>"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
agent: '<string>',
intent: '<string>',
purpose: '<string>',
channel: '<string>',
destination_hash: '<string>',
effect_key: '<string>',
effect_kind: 'delivery',
gateway_id: '<string>',
object: {id: '<string>', namespace: '<string>', type: '<string>'},
subject: {value: '<string>', scope: '<string>'},
task: '<string>'
})
};
fetch('https://{space}.{region}.api.niadra.com/v1/coordination/check', 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/coordination/check",
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([
'agent' => '<string>',
'intent' => '<string>',
'purpose' => '<string>',
'channel' => '<string>',
'destination_hash' => '<string>',
'effect_key' => '<string>',
'effect_kind' => 'delivery',
'gateway_id' => '<string>',
'object' => [
'id' => '<string>',
'namespace' => '<string>',
'type' => '<string>'
],
'subject' => [
'value' => '<string>',
'scope' => '<string>'
],
'task' => '<string>'
]),
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/coordination/check"
payload := strings.NewReader("{\n \"agent\": \"<string>\",\n \"intent\": \"<string>\",\n \"purpose\": \"<string>\",\n \"channel\": \"<string>\",\n \"destination_hash\": \"<string>\",\n \"effect_key\": \"<string>\",\n \"effect_kind\": \"delivery\",\n \"gateway_id\": \"<string>\",\n \"object\": {\n \"id\": \"<string>\",\n \"namespace\": \"<string>\",\n \"type\": \"<string>\"\n },\n \"subject\": {\n \"value\": \"<string>\",\n \"scope\": \"<string>\"\n },\n \"task\": \"<string>\"\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/coordination/check")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agent\": \"<string>\",\n \"intent\": \"<string>\",\n \"purpose\": \"<string>\",\n \"channel\": \"<string>\",\n \"destination_hash\": \"<string>\",\n \"effect_key\": \"<string>\",\n \"effect_kind\": \"delivery\",\n \"gateway_id\": \"<string>\",\n \"object\": {\n \"id\": \"<string>\",\n \"namespace\": \"<string>\",\n \"type\": \"<string>\"\n },\n \"subject\": {\n \"value\": \"<string>\",\n \"scope\": \"<string>\"\n },\n \"task\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{space}.{region}.api.niadra.com/v1/coordination/check")
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 \"agent\": \"<string>\",\n \"intent\": \"<string>\",\n \"purpose\": \"<string>\",\n \"channel\": \"<string>\",\n \"destination_hash\": \"<string>\",\n \"effect_key\": \"<string>\",\n \"effect_kind\": \"delivery\",\n \"gateway_id\": \"<string>\",\n \"object\": {\n \"id\": \"<string>\",\n \"namespace\": \"<string>\",\n \"type\": \"<string>\"\n },\n \"subject\": {\n \"value\": \"<string>\",\n \"scope\": \"<string>\"\n },\n \"task\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"decision": "allow",
"decision_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"valid_for_s": 1,
"channel": {
"free_form_until": "2023-11-07T05:31:56Z",
"quiet_until": "2023-11-07T05:31:56Z",
"template_required": false
},
"commitments_active": [
{
"id": "<string>",
"type": "<string>",
"valid_until": "2023-11-07T05:31:56Z"
}
],
"contact_budget": {},
"contact_token": "<string>",
"effect": {
"state": "none",
"attempt": 123
},
"holder": "<string>",
"locks": [
{
"holder": "<string>",
"kind": "<string>",
"until": "2023-11-07T05:31:56Z",
"task": "<string>"
}
],
"owner": {
"epoch": 123,
"holder": "<string>",
"kind": "owner",
"level": "<string>",
"since": "2023-11-07T05:31:56Z",
"source": "<string>",
"valid_until": "2023-11-07T05:31:56Z",
"via": "declaration"
},
"promises_open": [
{
"id": "<string>",
"owner": "<string>",
"due": "2023-11-07T05:31:56Z"
}
],
"reasons": [
"<string>"
],
"suppressions": [
"<string>"
]
}{
"code": "<string>",
"status": 123,
"title": "<string>",
"detail": "<string>",
"request_id": "<string>",
"type": "about:blank"
}Ask before acting
The coordination decision for an intent: allow, defer, deny or handoff_to, with who holds the customer, the effect’s state, the channel, the contact budget and, when the purpose needs it, the contact token. The coordinate scope; the coordination feature.
# Ask before an outbound contact; with Niadra out of reach the purpose decides (marketing waits)
decision = conversation.check("proposal_followup", purpose="marketing", channel="whatsapp")
if decision.decision == "allow":
gateway.send(message, token=decision.contact_token)
conversation.declare.contact_made(decision, purpose="marketing", channel="whatsapp")// Ask before an outbound contact; with Niadra out of reach the purpose decides (marketing waits)
const decision = await convo.check("proposal_followup", { purpose: "marketing", channel: "whatsapp" });
if (decision.decision === "allow") {
await gateway.send(message, { token: decision.contact_token });
convo.declare.contactMade(decision, { purpose: "marketing", channel: "whatsapp" });
}curl --request POST \
--url https://{space}.{region}.api.niadra.com/v1/coordination/check \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agent": "<string>",
"intent": "<string>",
"purpose": "<string>",
"channel": "<string>",
"destination_hash": "<string>",
"effect_key": "<string>",
"effect_kind": "delivery",
"gateway_id": "<string>",
"object": {
"id": "<string>",
"namespace": "<string>",
"type": "<string>"
},
"subject": {
"value": "<string>",
"scope": "<string>"
},
"task": "<string>"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
agent: '<string>',
intent: '<string>',
purpose: '<string>',
channel: '<string>',
destination_hash: '<string>',
effect_key: '<string>',
effect_kind: 'delivery',
gateway_id: '<string>',
object: {id: '<string>', namespace: '<string>', type: '<string>'},
subject: {value: '<string>', scope: '<string>'},
task: '<string>'
})
};
fetch('https://{space}.{region}.api.niadra.com/v1/coordination/check', 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/coordination/check",
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([
'agent' => '<string>',
'intent' => '<string>',
'purpose' => '<string>',
'channel' => '<string>',
'destination_hash' => '<string>',
'effect_key' => '<string>',
'effect_kind' => 'delivery',
'gateway_id' => '<string>',
'object' => [
'id' => '<string>',
'namespace' => '<string>',
'type' => '<string>'
],
'subject' => [
'value' => '<string>',
'scope' => '<string>'
],
'task' => '<string>'
]),
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/coordination/check"
payload := strings.NewReader("{\n \"agent\": \"<string>\",\n \"intent\": \"<string>\",\n \"purpose\": \"<string>\",\n \"channel\": \"<string>\",\n \"destination_hash\": \"<string>\",\n \"effect_key\": \"<string>\",\n \"effect_kind\": \"delivery\",\n \"gateway_id\": \"<string>\",\n \"object\": {\n \"id\": \"<string>\",\n \"namespace\": \"<string>\",\n \"type\": \"<string>\"\n },\n \"subject\": {\n \"value\": \"<string>\",\n \"scope\": \"<string>\"\n },\n \"task\": \"<string>\"\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/coordination/check")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agent\": \"<string>\",\n \"intent\": \"<string>\",\n \"purpose\": \"<string>\",\n \"channel\": \"<string>\",\n \"destination_hash\": \"<string>\",\n \"effect_key\": \"<string>\",\n \"effect_kind\": \"delivery\",\n \"gateway_id\": \"<string>\",\n \"object\": {\n \"id\": \"<string>\",\n \"namespace\": \"<string>\",\n \"type\": \"<string>\"\n },\n \"subject\": {\n \"value\": \"<string>\",\n \"scope\": \"<string>\"\n },\n \"task\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{space}.{region}.api.niadra.com/v1/coordination/check")
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 \"agent\": \"<string>\",\n \"intent\": \"<string>\",\n \"purpose\": \"<string>\",\n \"channel\": \"<string>\",\n \"destination_hash\": \"<string>\",\n \"effect_key\": \"<string>\",\n \"effect_kind\": \"delivery\",\n \"gateway_id\": \"<string>\",\n \"object\": {\n \"id\": \"<string>\",\n \"namespace\": \"<string>\",\n \"type\": \"<string>\"\n },\n \"subject\": {\n \"value\": \"<string>\",\n \"scope\": \"<string>\"\n },\n \"task\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"decision": "allow",
"decision_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"valid_for_s": 1,
"channel": {
"free_form_until": "2023-11-07T05:31:56Z",
"quiet_until": "2023-11-07T05:31:56Z",
"template_required": false
},
"commitments_active": [
{
"id": "<string>",
"type": "<string>",
"valid_until": "2023-11-07T05:31:56Z"
}
],
"contact_budget": {},
"contact_token": "<string>",
"effect": {
"state": "none",
"attempt": 123
},
"holder": "<string>",
"locks": [
{
"holder": "<string>",
"kind": "<string>",
"until": "2023-11-07T05:31:56Z",
"task": "<string>"
}
],
"owner": {
"epoch": 123,
"holder": "<string>",
"kind": "owner",
"level": "<string>",
"since": "2023-11-07T05:31:56Z",
"source": "<string>",
"valid_until": "2023-11-07T05:31:56Z",
"via": "declaration"
},
"promises_open": [
{
"id": "<string>",
"owner": "<string>",
"due": "2023-11-07T05:31:56Z"
}
],
"reasons": [
"<string>"
],
"suppressions": [
"<string>"
]
}{
"code": "<string>",
"status": 123,
"title": "<string>",
"detail": "<string>",
"request_id": "<string>",
"type": "about:blank"
}Authorizations
nia_sk_...
Body
What an agent is about to do. Without a subject there is no budget, suppression or owner to consult: such a check only asks about the effect key.
1 - 256inbound, outbound ^[a-z][a-z0-9_]{0,39}$^[a-z][a-z0-9_]{0,39}$^[a-z][a-z0-9_]{0,39}$The token's rcpt, computed by a caller that holds the gateway's key, when the destination is not the subject's handle.
^[A-Za-z0-9_-]{43}$The business fact's key; reserved atomically when nothing holds it.
1 - 512delivery, document, notice, filing, paid_call, external_action ^[a-z][a-z0-9_]{0,39}$A business object in a system of record, e.g. invoice / erp / 0823.
Show child attributes
Show child attributes
An identifier of a subject in some channel or system: a phone, an e-mail, a CRM id.
Show child attributes
Show child attributes
^[a-z][a-z0-9_]{0,39}$Response
The decision, valid for valid_for_s seconds; a caller that acts later asks again.
The coordination decision. reasons are codes (the coordination spec, 4); holder is who to hand
off to with handoff_to. contact_token comes only with an allowed outbound contact of a purpose that
needs one.
allow, defer, deny, handoff_to x >= 0Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
1024^nct1\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]{86}$none means nothing held the key and this check reserved it: the caller acts and then declares.
Show child attributes
Show child attributes
1 - 256Show child attributes
Show child attributes
Who holds the subject or the object now: the most restrictive valid claim, where it came from and
until when. epoch fences a release.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
1 - 256^[a-z][a-z0-9_]{0,39}$
