import Roark from '@roarkanalytics/sdk';
const client = new Roark({
bearerToken: process.env['ROARK_API_BEARER_TOKEN'], // This is the default and can be omitted
});
const liveReport = await client.liveReport.create({ name: 'x' });
console.log(liveReport.data);import os
from roark_analytics import Roark
client = Roark(
bearer_token=os.environ.get("ROARK_API_BEARER_TOKEN"), # This is the default and can be omitted
)
live_report = client.live_report.create(
name="x",
)
print(live_report.data)curl --request POST \
--url https://api.roark.ai/v1/live-report \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Front desk weekly",
"agentId": "0b1c2d3e-4f50-4a6b-8c7d-9e0f1a2b3c4d",
"filters": [
{
"type": "CALL_PROPERTY",
"property": "region",
"operator": "EQUALS",
"value": "EU"
}
],
"targets": [
{
"metric": "task_completion_check",
"value": 85
},
{
"metric": "customer_frustration",
"aggregation": "AVG",
"comparator": "AT_MOST",
"value": 2
}
],
"cadence": "WEEKLY",
"timezone": "Europe/London",
"deliveryHour": 9,
"notifications": {
"email": {
"enabled": true,
"recipients": []
},
"slack": []
},
"includeTranscriptExcerpts": true,
"generateNow": true
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.roark.ai/v1/live-report",
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' => 'Front desk weekly',
'agentId' => '0b1c2d3e-4f50-4a6b-8c7d-9e0f1a2b3c4d',
'filters' => [
[
'type' => 'CALL_PROPERTY',
'property' => 'region',
'operator' => 'EQUALS',
'value' => 'EU'
]
],
'targets' => [
[
'metric' => 'task_completion_check',
'value' => 85
],
[
'metric' => 'customer_frustration',
'aggregation' => 'AVG',
'comparator' => 'AT_MOST',
'value' => 2
]
],
'cadence' => 'WEEKLY',
'timezone' => 'Europe/London',
'deliveryHour' => 9,
'notifications' => [
'email' => [
'enabled' => true,
'recipients' => [
]
],
'slack' => [
]
],
'includeTranscriptExcerpts' => true,
'generateNow' => true
]),
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.roark.ai/v1/live-report"
payload := strings.NewReader("{\n \"name\": \"Front desk weekly\",\n \"agentId\": \"0b1c2d3e-4f50-4a6b-8c7d-9e0f1a2b3c4d\",\n \"filters\": [\n {\n \"type\": \"CALL_PROPERTY\",\n \"property\": \"region\",\n \"operator\": \"EQUALS\",\n \"value\": \"EU\"\n }\n ],\n \"targets\": [\n {\n \"metric\": \"task_completion_check\",\n \"value\": 85\n },\n {\n \"metric\": \"customer_frustration\",\n \"aggregation\": \"AVG\",\n \"comparator\": \"AT_MOST\",\n \"value\": 2\n }\n ],\n \"cadence\": \"WEEKLY\",\n \"timezone\": \"Europe/London\",\n \"deliveryHour\": 9,\n \"notifications\": {\n \"email\": {\n \"enabled\": true,\n \"recipients\": []\n },\n \"slack\": []\n },\n \"includeTranscriptExcerpts\": true,\n \"generateNow\": true\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.roark.ai/v1/live-report")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Front desk weekly\",\n \"agentId\": \"0b1c2d3e-4f50-4a6b-8c7d-9e0f1a2b3c4d\",\n \"filters\": [\n {\n \"type\": \"CALL_PROPERTY\",\n \"property\": \"region\",\n \"operator\": \"EQUALS\",\n \"value\": \"EU\"\n }\n ],\n \"targets\": [\n {\n \"metric\": \"task_completion_check\",\n \"value\": 85\n },\n {\n \"metric\": \"customer_frustration\",\n \"aggregation\": \"AVG\",\n \"comparator\": \"AT_MOST\",\n \"value\": 2\n }\n ],\n \"cadence\": \"WEEKLY\",\n \"timezone\": \"Europe/London\",\n \"deliveryHour\": 9,\n \"notifications\": {\n \"email\": {\n \"enabled\": true,\n \"recipients\": []\n },\n \"slack\": []\n },\n \"includeTranscriptExcerpts\": true,\n \"generateNow\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.roark.ai/v1/live-report")
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\": \"Front desk weekly\",\n \"agentId\": \"0b1c2d3e-4f50-4a6b-8c7d-9e0f1a2b3c4d\",\n \"filters\": [\n {\n \"type\": \"CALL_PROPERTY\",\n \"property\": \"region\",\n \"operator\": \"EQUALS\",\n \"value\": \"EU\"\n }\n ],\n \"targets\": [\n {\n \"metric\": \"task_completion_check\",\n \"value\": 85\n },\n {\n \"metric\": \"customer_frustration\",\n \"aggregation\": \"AVG\",\n \"comparator\": \"AT_MOST\",\n \"value\": 2\n }\n ],\n \"cadence\": \"WEEKLY\",\n \"timezone\": \"Europe/London\",\n \"deliveryHour\": 9,\n \"notifications\": {\n \"email\": {\n \"enabled\": true,\n \"recipients\": []\n },\n \"slack\": []\n },\n \"includeTranscriptExcerpts\": true,\n \"generateNow\": true\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"description": "<string>",
"agentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"filters": [
{
"type": "METRIC_PROPERTY",
"property": "<string>",
"operator": "EQUALS",
"value": "<string>"
}
],
"targets": [
{
"metric": "<string>",
"value": 123,
"aggregation": "PASS_RATE",
"percentile": 50,
"passOperator": "EQUALS",
"passValue": "<string>",
"comparator": "AT_LEAST",
"label": "<string>"
}
],
"dashboardId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"cadence": "DAILY",
"timezone": "<string>",
"deliveryHour": 123,
"status": "ACTIVE",
"notifications": {
"email": {
"enabled": true,
"recipients": [
"jsmith@example.com"
]
},
"slack": [
{
"notificationConfigId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"channelId": "<string>",
"channelName": "<string>"
}
],
"fromConfig": true
},
"includeTranscriptExcerpts": true,
"configKey": "<string>",
"createdAt": "<string>",
"updatedAt": "<string>",
"configManaged": true,
"nextDeliveryAt": "<string>"
}
}{
"type": "validation",
"code": "invalid_parameter",
"message": "The request was invalid",
"param": "email"
}{
"type": "authentication",
"code": "unauthorized",
"message": "Authentication required"
}{
"type": "forbidden",
"code": "permission_denied",
"message": "You do not have permission to access this resource"
}{
"type": "not_found",
"code": "resource_not_found",
"message": "The requested resource could not be found"
}{
"type": "conflict",
"code": "resource_in_use",
"message": "The resource is in use and cannot be deleted"
}{
"type": "rate_limit",
"code": "too_many_requests",
"message": "Rate limit exceeded"
}{
"type": "internal",
"code": "internal_error",
"message": "Internal server error"
}Create a live report
Saves a report on the project’s live calls. Simulations are never included.
Targets are analytics measures held to a bar: a threshold metric is read as its pass rate (value is a
percentage, 0-100, held AT_LEAST by default); a numeric metric as its average (held AT_MOST by default).
Every target is read for the period and the period before it, so the report says whether each was met
and how it moved.
Scheduled reports are written deliveryHour hours into the day after each period ends in timezone
(a week runs Monday to Sunday), then emailed and posted per notifications. With generateNow (the
default) the report for the latest closed period is written right away and not sent.
import Roark from '@roarkanalytics/sdk';
const client = new Roark({
bearerToken: process.env['ROARK_API_BEARER_TOKEN'], // This is the default and can be omitted
});
const liveReport = await client.liveReport.create({ name: 'x' });
console.log(liveReport.data);import os
from roark_analytics import Roark
client = Roark(
bearer_token=os.environ.get("ROARK_API_BEARER_TOKEN"), # This is the default and can be omitted
)
live_report = client.live_report.create(
name="x",
)
print(live_report.data)curl --request POST \
--url https://api.roark.ai/v1/live-report \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Front desk weekly",
"agentId": "0b1c2d3e-4f50-4a6b-8c7d-9e0f1a2b3c4d",
"filters": [
{
"type": "CALL_PROPERTY",
"property": "region",
"operator": "EQUALS",
"value": "EU"
}
],
"targets": [
{
"metric": "task_completion_check",
"value": 85
},
{
"metric": "customer_frustration",
"aggregation": "AVG",
"comparator": "AT_MOST",
"value": 2
}
],
"cadence": "WEEKLY",
"timezone": "Europe/London",
"deliveryHour": 9,
"notifications": {
"email": {
"enabled": true,
"recipients": []
},
"slack": []
},
"includeTranscriptExcerpts": true,
"generateNow": true
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.roark.ai/v1/live-report",
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' => 'Front desk weekly',
'agentId' => '0b1c2d3e-4f50-4a6b-8c7d-9e0f1a2b3c4d',
'filters' => [
[
'type' => 'CALL_PROPERTY',
'property' => 'region',
'operator' => 'EQUALS',
'value' => 'EU'
]
],
'targets' => [
[
'metric' => 'task_completion_check',
'value' => 85
],
[
'metric' => 'customer_frustration',
'aggregation' => 'AVG',
'comparator' => 'AT_MOST',
'value' => 2
]
],
'cadence' => 'WEEKLY',
'timezone' => 'Europe/London',
'deliveryHour' => 9,
'notifications' => [
'email' => [
'enabled' => true,
'recipients' => [
]
],
'slack' => [
]
],
'includeTranscriptExcerpts' => true,
'generateNow' => true
]),
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.roark.ai/v1/live-report"
payload := strings.NewReader("{\n \"name\": \"Front desk weekly\",\n \"agentId\": \"0b1c2d3e-4f50-4a6b-8c7d-9e0f1a2b3c4d\",\n \"filters\": [\n {\n \"type\": \"CALL_PROPERTY\",\n \"property\": \"region\",\n \"operator\": \"EQUALS\",\n \"value\": \"EU\"\n }\n ],\n \"targets\": [\n {\n \"metric\": \"task_completion_check\",\n \"value\": 85\n },\n {\n \"metric\": \"customer_frustration\",\n \"aggregation\": \"AVG\",\n \"comparator\": \"AT_MOST\",\n \"value\": 2\n }\n ],\n \"cadence\": \"WEEKLY\",\n \"timezone\": \"Europe/London\",\n \"deliveryHour\": 9,\n \"notifications\": {\n \"email\": {\n \"enabled\": true,\n \"recipients\": []\n },\n \"slack\": []\n },\n \"includeTranscriptExcerpts\": true,\n \"generateNow\": true\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.roark.ai/v1/live-report")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Front desk weekly\",\n \"agentId\": \"0b1c2d3e-4f50-4a6b-8c7d-9e0f1a2b3c4d\",\n \"filters\": [\n {\n \"type\": \"CALL_PROPERTY\",\n \"property\": \"region\",\n \"operator\": \"EQUALS\",\n \"value\": \"EU\"\n }\n ],\n \"targets\": [\n {\n \"metric\": \"task_completion_check\",\n \"value\": 85\n },\n {\n \"metric\": \"customer_frustration\",\n \"aggregation\": \"AVG\",\n \"comparator\": \"AT_MOST\",\n \"value\": 2\n }\n ],\n \"cadence\": \"WEEKLY\",\n \"timezone\": \"Europe/London\",\n \"deliveryHour\": 9,\n \"notifications\": {\n \"email\": {\n \"enabled\": true,\n \"recipients\": []\n },\n \"slack\": []\n },\n \"includeTranscriptExcerpts\": true,\n \"generateNow\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.roark.ai/v1/live-report")
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\": \"Front desk weekly\",\n \"agentId\": \"0b1c2d3e-4f50-4a6b-8c7d-9e0f1a2b3c4d\",\n \"filters\": [\n {\n \"type\": \"CALL_PROPERTY\",\n \"property\": \"region\",\n \"operator\": \"EQUALS\",\n \"value\": \"EU\"\n }\n ],\n \"targets\": [\n {\n \"metric\": \"task_completion_check\",\n \"value\": 85\n },\n {\n \"metric\": \"customer_frustration\",\n \"aggregation\": \"AVG\",\n \"comparator\": \"AT_MOST\",\n \"value\": 2\n }\n ],\n \"cadence\": \"WEEKLY\",\n \"timezone\": \"Europe/London\",\n \"deliveryHour\": 9,\n \"notifications\": {\n \"email\": {\n \"enabled\": true,\n \"recipients\": []\n },\n \"slack\": []\n },\n \"includeTranscriptExcerpts\": true,\n \"generateNow\": true\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"description": "<string>",
"agentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"filters": [
{
"type": "METRIC_PROPERTY",
"property": "<string>",
"operator": "EQUALS",
"value": "<string>"
}
],
"targets": [
{
"metric": "<string>",
"value": 123,
"aggregation": "PASS_RATE",
"percentile": 50,
"passOperator": "EQUALS",
"passValue": "<string>",
"comparator": "AT_LEAST",
"label": "<string>"
}
],
"dashboardId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"cadence": "DAILY",
"timezone": "<string>",
"deliveryHour": 123,
"status": "ACTIVE",
"notifications": {
"email": {
"enabled": true,
"recipients": [
"jsmith@example.com"
]
},
"slack": [
{
"notificationConfigId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"channelId": "<string>",
"channelName": "<string>"
}
],
"fromConfig": true
},
"includeTranscriptExcerpts": true,
"configKey": "<string>",
"createdAt": "<string>",
"updatedAt": "<string>",
"configManaged": true,
"nextDeliveryAt": "<string>"
}
}{
"type": "validation",
"code": "invalid_parameter",
"message": "The request was invalid",
"param": "email"
}{
"type": "authentication",
"code": "unauthorized",
"message": "Authentication required"
}{
"type": "forbidden",
"code": "permission_denied",
"message": "You do not have permission to access this resource"
}{
"type": "not_found",
"code": "resource_not_found",
"message": "The requested resource could not be found"
}{
"type": "conflict",
"code": "resource_in_use",
"message": "The resource is in use and cannot be deleted"
}{
"type": "rate_limit",
"code": "too_many_requests",
"message": "Rate limit exceeded"
}{
"type": "internal",
"code": "internal_error",
"message": "Internal server error"
}Authorizations
Body
A report on the project's live calls: which calls (one agent or all, plus conversation filters in the analytics vocabulary), the targets the period is held to, how often it is written, and who receives it.