Create a CSAT rule for a team
curl --request POST \
--url https://platform.thena.ai/v1/csat/rules/{teamUid} \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"name": "High Priority Ticket Survey",
"isActive": true,
"allFilters": {
"ticket": {
"standardFields": [
{
"field": "status",
"operator": "=",
"value": "open"
}
],
"customFields": [
{
"field": "custom_CFLLXQWWY4Z",
"customFieldId": "CFLLXQWWY4Z",
"operator": "=",
"value": "Value"
}
]
},
"account": {
"standardFields": [
{
"field": "status",
"operator": "=",
"value": "open"
}
],
"customFields": [
{
"field": "custom_CFLLXQWWY4Z",
"customFieldId": "CFLLXQWWY4Z",
"operator": "=",
"value": "Value"
}
]
},
"contact": {
"standardFields": [
{
"field": "status",
"operator": "=",
"value": "open"
}
],
"customFields": [
{
"field": "custom_CFLLXQWWY4Z",
"customFieldId": "CFLLXQWWY4Z",
"operator": "=",
"value": "Value"
}
]
}
},
"anyFilters": {
"ticket": {
"standardFields": [
{
"field": "status",
"operator": "=",
"value": "open"
}
],
"customFields": [
{
"field": "custom_CFLLXQWWY4Z",
"customFieldId": "CFLLXQWWY4Z",
"operator": "=",
"value": "Value"
}
]
},
"account": {
"standardFields": [
{
"field": "status",
"operator": "=",
"value": "open"
}
],
"customFields": [
{
"field": "custom_CFLLXQWWY4Z",
"customFieldId": "CFLLXQWWY4Z",
"operator": "=",
"value": "Value"
}
]
},
"contact": {
"standardFields": [
{
"field": "status",
"operator": "=",
"value": "open"
}
],
"customFields": [
{
"field": "custom_CFLLXQWWY4Z",
"customFieldId": "CFLLXQWWY4Z",
"operator": "=",
"value": "Value"
}
]
}
},
"triggerConfig": {
"triggerType": "always",
"randomPercentage": 10,
"triggerEvent": "ticket_resolved",
"delayMinutes": 30
},
"feedbackConfig": {
"enabled": true,
"feedbackType": "star",
"includeCommentField": true,
"customTitle": "How was your experience?",
"customMessage": "Please rate your satisfaction with our support.",
"customThankYouMessage": "Thank you for your feedback!",
"commentFieldLabel": "Additional Comments",
"commentFieldPlaceholder": "Please share any additional feedback here...",
"brandingColor": "#3366CC",
"deliveryChannel": "email"
},
"description": "Sends CSAT surveys to customers with high priority tickets",
"priority": 1
}
'import requests
url = "https://platform.thena.ai/v1/csat/rules/{teamUid}"
payload = {
"name": "High Priority Ticket Survey",
"isActive": True,
"allFilters": {
"ticket": {
"standardFields": [
{
"field": "status",
"operator": "=",
"value": "open"
}
],
"customFields": [
{
"field": "custom_CFLLXQWWY4Z",
"customFieldId": "CFLLXQWWY4Z",
"operator": "=",
"value": "Value"
}
]
},
"account": {
"standardFields": [
{
"field": "status",
"operator": "=",
"value": "open"
}
],
"customFields": [
{
"field": "custom_CFLLXQWWY4Z",
"customFieldId": "CFLLXQWWY4Z",
"operator": "=",
"value": "Value"
}
]
},
"contact": {
"standardFields": [
{
"field": "status",
"operator": "=",
"value": "open"
}
],
"customFields": [
{
"field": "custom_CFLLXQWWY4Z",
"customFieldId": "CFLLXQWWY4Z",
"operator": "=",
"value": "Value"
}
]
}
},
"anyFilters": {
"ticket": {
"standardFields": [
{
"field": "status",
"operator": "=",
"value": "open"
}
],
"customFields": [
{
"field": "custom_CFLLXQWWY4Z",
"customFieldId": "CFLLXQWWY4Z",
"operator": "=",
"value": "Value"
}
]
},
"account": {
"standardFields": [
{
"field": "status",
"operator": "=",
"value": "open"
}
],
"customFields": [
{
"field": "custom_CFLLXQWWY4Z",
"customFieldId": "CFLLXQWWY4Z",
"operator": "=",
"value": "Value"
}
]
},
"contact": {
"standardFields": [
{
"field": "status",
"operator": "=",
"value": "open"
}
],
"customFields": [
{
"field": "custom_CFLLXQWWY4Z",
"customFieldId": "CFLLXQWWY4Z",
"operator": "=",
"value": "Value"
}
]
}
},
"triggerConfig": {
"triggerType": "always",
"randomPercentage": 10,
"triggerEvent": "ticket_resolved",
"delayMinutes": 30
},
"feedbackConfig": {
"enabled": True,
"feedbackType": "star",
"includeCommentField": True,
"customTitle": "How was your experience?",
"customMessage": "Please rate your satisfaction with our support.",
"customThankYouMessage": "Thank you for your feedback!",
"commentFieldLabel": "Additional Comments",
"commentFieldPlaceholder": "Please share any additional feedback here...",
"brandingColor": "#3366CC",
"deliveryChannel": "email"
},
"description": "Sends CSAT surveys to customers with high priority tickets",
"priority": 1
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'High Priority Ticket Survey',
isActive: true,
allFilters: {
ticket: {
standardFields: [{field: 'status', operator: '=', value: 'open'}],
customFields: [
{
field: 'custom_CFLLXQWWY4Z',
customFieldId: 'CFLLXQWWY4Z',
operator: '=',
value: 'Value'
}
]
},
account: {
standardFields: [{field: 'status', operator: '=', value: 'open'}],
customFields: [
{
field: 'custom_CFLLXQWWY4Z',
customFieldId: 'CFLLXQWWY4Z',
operator: '=',
value: 'Value'
}
]
},
contact: {
standardFields: [{field: 'status', operator: '=', value: 'open'}],
customFields: [
{
field: 'custom_CFLLXQWWY4Z',
customFieldId: 'CFLLXQWWY4Z',
operator: '=',
value: 'Value'
}
]
}
},
anyFilters: {
ticket: {
standardFields: [{field: 'status', operator: '=', value: 'open'}],
customFields: [
{
field: 'custom_CFLLXQWWY4Z',
customFieldId: 'CFLLXQWWY4Z',
operator: '=',
value: 'Value'
}
]
},
account: {
standardFields: [{field: 'status', operator: '=', value: 'open'}],
customFields: [
{
field: 'custom_CFLLXQWWY4Z',
customFieldId: 'CFLLXQWWY4Z',
operator: '=',
value: 'Value'
}
]
},
contact: {
standardFields: [{field: 'status', operator: '=', value: 'open'}],
customFields: [
{
field: 'custom_CFLLXQWWY4Z',
customFieldId: 'CFLLXQWWY4Z',
operator: '=',
value: 'Value'
}
]
}
},
triggerConfig: {
triggerType: 'always',
randomPercentage: 10,
triggerEvent: 'ticket_resolved',
delayMinutes: 30
},
feedbackConfig: {
enabled: true,
feedbackType: 'star',
includeCommentField: true,
customTitle: 'How was your experience?',
customMessage: 'Please rate your satisfaction with our support.',
customThankYouMessage: 'Thank you for your feedback!',
commentFieldLabel: 'Additional Comments',
commentFieldPlaceholder: 'Please share any additional feedback here...',
brandingColor: '#3366CC',
deliveryChannel: 'email'
},
description: 'Sends CSAT surveys to customers with high priority tickets',
priority: 1
})
};
fetch('https://platform.thena.ai/v1/csat/rules/{teamUid}', 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://platform.thena.ai/v1/csat/rules/{teamUid}",
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' => 'High Priority Ticket Survey',
'isActive' => true,
'allFilters' => [
'ticket' => [
'standardFields' => [
[
'field' => 'status',
'operator' => '=',
'value' => 'open'
]
],
'customFields' => [
[
'field' => 'custom_CFLLXQWWY4Z',
'customFieldId' => 'CFLLXQWWY4Z',
'operator' => '=',
'value' => 'Value'
]
]
],
'account' => [
'standardFields' => [
[
'field' => 'status',
'operator' => '=',
'value' => 'open'
]
],
'customFields' => [
[
'field' => 'custom_CFLLXQWWY4Z',
'customFieldId' => 'CFLLXQWWY4Z',
'operator' => '=',
'value' => 'Value'
]
]
],
'contact' => [
'standardFields' => [
[
'field' => 'status',
'operator' => '=',
'value' => 'open'
]
],
'customFields' => [
[
'field' => 'custom_CFLLXQWWY4Z',
'customFieldId' => 'CFLLXQWWY4Z',
'operator' => '=',
'value' => 'Value'
]
]
]
],
'anyFilters' => [
'ticket' => [
'standardFields' => [
[
'field' => 'status',
'operator' => '=',
'value' => 'open'
]
],
'customFields' => [
[
'field' => 'custom_CFLLXQWWY4Z',
'customFieldId' => 'CFLLXQWWY4Z',
'operator' => '=',
'value' => 'Value'
]
]
],
'account' => [
'standardFields' => [
[
'field' => 'status',
'operator' => '=',
'value' => 'open'
]
],
'customFields' => [
[
'field' => 'custom_CFLLXQWWY4Z',
'customFieldId' => 'CFLLXQWWY4Z',
'operator' => '=',
'value' => 'Value'
]
]
],
'contact' => [
'standardFields' => [
[
'field' => 'status',
'operator' => '=',
'value' => 'open'
]
],
'customFields' => [
[
'field' => 'custom_CFLLXQWWY4Z',
'customFieldId' => 'CFLLXQWWY4Z',
'operator' => '=',
'value' => 'Value'
]
]
]
],
'triggerConfig' => [
'triggerType' => 'always',
'randomPercentage' => 10,
'triggerEvent' => 'ticket_resolved',
'delayMinutes' => 30
],
'feedbackConfig' => [
'enabled' => true,
'feedbackType' => 'star',
'includeCommentField' => true,
'customTitle' => 'How was your experience?',
'customMessage' => 'Please rate your satisfaction with our support.',
'customThankYouMessage' => 'Thank you for your feedback!',
'commentFieldLabel' => 'Additional Comments',
'commentFieldPlaceholder' => 'Please share any additional feedback here...',
'brandingColor' => '#3366CC',
'deliveryChannel' => 'email'
],
'description' => 'Sends CSAT surveys to customers with high priority tickets',
'priority' => 1
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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://platform.thena.ai/v1/csat/rules/{teamUid}"
payload := strings.NewReader("{\n \"name\": \"High Priority Ticket Survey\",\n \"isActive\": true,\n \"allFilters\": {\n \"ticket\": {\n \"standardFields\": [\n {\n \"field\": \"status\",\n \"operator\": \"=\",\n \"value\": \"open\"\n }\n ],\n \"customFields\": [\n {\n \"field\": \"custom_CFLLXQWWY4Z\",\n \"customFieldId\": \"CFLLXQWWY4Z\",\n \"operator\": \"=\",\n \"value\": \"Value\"\n }\n ]\n },\n \"account\": {\n \"standardFields\": [\n {\n \"field\": \"status\",\n \"operator\": \"=\",\n \"value\": \"open\"\n }\n ],\n \"customFields\": [\n {\n \"field\": \"custom_CFLLXQWWY4Z\",\n \"customFieldId\": \"CFLLXQWWY4Z\",\n \"operator\": \"=\",\n \"value\": \"Value\"\n }\n ]\n },\n \"contact\": {\n \"standardFields\": [\n {\n \"field\": \"status\",\n \"operator\": \"=\",\n \"value\": \"open\"\n }\n ],\n \"customFields\": [\n {\n \"field\": \"custom_CFLLXQWWY4Z\",\n \"customFieldId\": \"CFLLXQWWY4Z\",\n \"operator\": \"=\",\n \"value\": \"Value\"\n }\n ]\n }\n },\n \"anyFilters\": {\n \"ticket\": {\n \"standardFields\": [\n {\n \"field\": \"status\",\n \"operator\": \"=\",\n \"value\": \"open\"\n }\n ],\n \"customFields\": [\n {\n \"field\": \"custom_CFLLXQWWY4Z\",\n \"customFieldId\": \"CFLLXQWWY4Z\",\n \"operator\": \"=\",\n \"value\": \"Value\"\n }\n ]\n },\n \"account\": {\n \"standardFields\": [\n {\n \"field\": \"status\",\n \"operator\": \"=\",\n \"value\": \"open\"\n }\n ],\n \"customFields\": [\n {\n \"field\": \"custom_CFLLXQWWY4Z\",\n \"customFieldId\": \"CFLLXQWWY4Z\",\n \"operator\": \"=\",\n \"value\": \"Value\"\n }\n ]\n },\n \"contact\": {\n \"standardFields\": [\n {\n \"field\": \"status\",\n \"operator\": \"=\",\n \"value\": \"open\"\n }\n ],\n \"customFields\": [\n {\n \"field\": \"custom_CFLLXQWWY4Z\",\n \"customFieldId\": \"CFLLXQWWY4Z\",\n \"operator\": \"=\",\n \"value\": \"Value\"\n }\n ]\n }\n },\n \"triggerConfig\": {\n \"triggerType\": \"always\",\n \"randomPercentage\": 10,\n \"triggerEvent\": \"ticket_resolved\",\n \"delayMinutes\": 30\n },\n \"feedbackConfig\": {\n \"enabled\": true,\n \"feedbackType\": \"star\",\n \"includeCommentField\": true,\n \"customTitle\": \"How was your experience?\",\n \"customMessage\": \"Please rate your satisfaction with our support.\",\n \"customThankYouMessage\": \"Thank you for your feedback!\",\n \"commentFieldLabel\": \"Additional Comments\",\n \"commentFieldPlaceholder\": \"Please share any additional feedback here...\",\n \"brandingColor\": \"#3366CC\",\n \"deliveryChannel\": \"email\"\n },\n \"description\": \"Sends CSAT surveys to customers with high priority tickets\",\n \"priority\": 1\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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://platform.thena.ai/v1/csat/rules/{teamUid}")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"High Priority Ticket Survey\",\n \"isActive\": true,\n \"allFilters\": {\n \"ticket\": {\n \"standardFields\": [\n {\n \"field\": \"status\",\n \"operator\": \"=\",\n \"value\": \"open\"\n }\n ],\n \"customFields\": [\n {\n \"field\": \"custom_CFLLXQWWY4Z\",\n \"customFieldId\": \"CFLLXQWWY4Z\",\n \"operator\": \"=\",\n \"value\": \"Value\"\n }\n ]\n },\n \"account\": {\n \"standardFields\": [\n {\n \"field\": \"status\",\n \"operator\": \"=\",\n \"value\": \"open\"\n }\n ],\n \"customFields\": [\n {\n \"field\": \"custom_CFLLXQWWY4Z\",\n \"customFieldId\": \"CFLLXQWWY4Z\",\n \"operator\": \"=\",\n \"value\": \"Value\"\n }\n ]\n },\n \"contact\": {\n \"standardFields\": [\n {\n \"field\": \"status\",\n \"operator\": \"=\",\n \"value\": \"open\"\n }\n ],\n \"customFields\": [\n {\n \"field\": \"custom_CFLLXQWWY4Z\",\n \"customFieldId\": \"CFLLXQWWY4Z\",\n \"operator\": \"=\",\n \"value\": \"Value\"\n }\n ]\n }\n },\n \"anyFilters\": {\n \"ticket\": {\n \"standardFields\": [\n {\n \"field\": \"status\",\n \"operator\": \"=\",\n \"value\": \"open\"\n }\n ],\n \"customFields\": [\n {\n \"field\": \"custom_CFLLXQWWY4Z\",\n \"customFieldId\": \"CFLLXQWWY4Z\",\n \"operator\": \"=\",\n \"value\": \"Value\"\n }\n ]\n },\n \"account\": {\n \"standardFields\": [\n {\n \"field\": \"status\",\n \"operator\": \"=\",\n \"value\": \"open\"\n }\n ],\n \"customFields\": [\n {\n \"field\": \"custom_CFLLXQWWY4Z\",\n \"customFieldId\": \"CFLLXQWWY4Z\",\n \"operator\": \"=\",\n \"value\": \"Value\"\n }\n ]\n },\n \"contact\": {\n \"standardFields\": [\n {\n \"field\": \"status\",\n \"operator\": \"=\",\n \"value\": \"open\"\n }\n ],\n \"customFields\": [\n {\n \"field\": \"custom_CFLLXQWWY4Z\",\n \"customFieldId\": \"CFLLXQWWY4Z\",\n \"operator\": \"=\",\n \"value\": \"Value\"\n }\n ]\n }\n },\n \"triggerConfig\": {\n \"triggerType\": \"always\",\n \"randomPercentage\": 10,\n \"triggerEvent\": \"ticket_resolved\",\n \"delayMinutes\": 30\n },\n \"feedbackConfig\": {\n \"enabled\": true,\n \"feedbackType\": \"star\",\n \"includeCommentField\": true,\n \"customTitle\": \"How was your experience?\",\n \"customMessage\": \"Please rate your satisfaction with our support.\",\n \"customThankYouMessage\": \"Thank you for your feedback!\",\n \"commentFieldLabel\": \"Additional Comments\",\n \"commentFieldPlaceholder\": \"Please share any additional feedback here...\",\n \"brandingColor\": \"#3366CC\",\n \"deliveryChannel\": \"email\"\n },\n \"description\": \"Sends CSAT surveys to customers with high priority tickets\",\n \"priority\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://platform.thena.ai/v1/csat/rules/{teamUid}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"High Priority Ticket Survey\",\n \"isActive\": true,\n \"allFilters\": {\n \"ticket\": {\n \"standardFields\": [\n {\n \"field\": \"status\",\n \"operator\": \"=\",\n \"value\": \"open\"\n }\n ],\n \"customFields\": [\n {\n \"field\": \"custom_CFLLXQWWY4Z\",\n \"customFieldId\": \"CFLLXQWWY4Z\",\n \"operator\": \"=\",\n \"value\": \"Value\"\n }\n ]\n },\n \"account\": {\n \"standardFields\": [\n {\n \"field\": \"status\",\n \"operator\": \"=\",\n \"value\": \"open\"\n }\n ],\n \"customFields\": [\n {\n \"field\": \"custom_CFLLXQWWY4Z\",\n \"customFieldId\": \"CFLLXQWWY4Z\",\n \"operator\": \"=\",\n \"value\": \"Value\"\n }\n ]\n },\n \"contact\": {\n \"standardFields\": [\n {\n \"field\": \"status\",\n \"operator\": \"=\",\n \"value\": \"open\"\n }\n ],\n \"customFields\": [\n {\n \"field\": \"custom_CFLLXQWWY4Z\",\n \"customFieldId\": \"CFLLXQWWY4Z\",\n \"operator\": \"=\",\n \"value\": \"Value\"\n }\n ]\n }\n },\n \"anyFilters\": {\n \"ticket\": {\n \"standardFields\": [\n {\n \"field\": \"status\",\n \"operator\": \"=\",\n \"value\": \"open\"\n }\n ],\n \"customFields\": [\n {\n \"field\": \"custom_CFLLXQWWY4Z\",\n \"customFieldId\": \"CFLLXQWWY4Z\",\n \"operator\": \"=\",\n \"value\": \"Value\"\n }\n ]\n },\n \"account\": {\n \"standardFields\": [\n {\n \"field\": \"status\",\n \"operator\": \"=\",\n \"value\": \"open\"\n }\n ],\n \"customFields\": [\n {\n \"field\": \"custom_CFLLXQWWY4Z\",\n \"customFieldId\": \"CFLLXQWWY4Z\",\n \"operator\": \"=\",\n \"value\": \"Value\"\n }\n ]\n },\n \"contact\": {\n \"standardFields\": [\n {\n \"field\": \"status\",\n \"operator\": \"=\",\n \"value\": \"open\"\n }\n ],\n \"customFields\": [\n {\n \"field\": \"custom_CFLLXQWWY4Z\",\n \"customFieldId\": \"CFLLXQWWY4Z\",\n \"operator\": \"=\",\n \"value\": \"Value\"\n }\n ]\n }\n },\n \"triggerConfig\": {\n \"triggerType\": \"always\",\n \"randomPercentage\": 10,\n \"triggerEvent\": \"ticket_resolved\",\n \"delayMinutes\": 30\n },\n \"feedbackConfig\": {\n \"enabled\": true,\n \"feedbackType\": \"star\",\n \"includeCommentField\": true,\n \"customTitle\": \"How was your experience?\",\n \"customMessage\": \"Please rate your satisfaction with our support.\",\n \"customThankYouMessage\": \"Thank you for your feedback!\",\n \"commentFieldLabel\": \"Additional Comments\",\n \"commentFieldPlaceholder\": \"Please share any additional feedback here...\",\n \"brandingColor\": \"#3366CC\",\n \"deliveryChannel\": \"email\"\n },\n \"description\": \"Sends CSAT surveys to customers with high priority tickets\",\n \"priority\": 1\n}"
response = http.request(request)
puts response.read_body{
"data": {
"ok": true,
"data": {
"id": "123e4567-e89b-12d3-a456-426614174000",
"team": {
"id": "12345678910"
},
"organization": {
"id": "98765432110"
},
"isEnabled": true,
"cooldownPeriodDays": 14,
"userCooldownPeriodDays": 30,
"emailConfigId": "email-config-123",
"closedStatusIds": [
"1",
"2",
"3"
],
"rules": [
{
"id": "e4d2a5b1-9c3f-4c8d-b1a2-3e4f5a6b7c8d",
"name": "High Priority Ticket Survey",
"description": "Sends CSAT surveys to customers with high priority tickets",
"isActive": true,
"priority": 1,
"createdAt": "2023-08-01T12:00:00Z",
"updatedAt": "2023-08-02T14:30:00Z"
}
],
"createdAt": "2023-01-01T00:00:00.000Z",
"updatedAt": "2023-01-01T00:00:00.000Z"
}
},
"status": true,
"message": "CSAT rule created successfully",
"timestamp": "2025-07-15T11:38:09.817Z"
}{
"statusCode": 400,
"message": "Validation failed",
"error": "Bad Request"
}{
"statusCode": 401,
"message": "Unauthorized",
"error": "Unauthorized"
}{
"statusCode": 403,
"message": "Forbidden",
"error": "Forbidden"
}{
"statusCode": 404,
"message": "Team not found",
"error": "Not Found"
}{
"statusCode": 500,
"message": "Internal Server Error",
"error": "Internal Server Error"
}{
"statusCode": 503,
"message": "Service Unavailable",
"error": "Service Unavailable"
}CSAT
Create a CSAT rule for a team
Creates a new rule for a team. If CSAT settings do not exist for the team, they will be created automatically.
POST
/
v1
/
csat
/
rules
/
{teamUid}
Create a CSAT rule for a team
curl --request POST \
--url https://platform.thena.ai/v1/csat/rules/{teamUid} \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"name": "High Priority Ticket Survey",
"isActive": true,
"allFilters": {
"ticket": {
"standardFields": [
{
"field": "status",
"operator": "=",
"value": "open"
}
],
"customFields": [
{
"field": "custom_CFLLXQWWY4Z",
"customFieldId": "CFLLXQWWY4Z",
"operator": "=",
"value": "Value"
}
]
},
"account": {
"standardFields": [
{
"field": "status",
"operator": "=",
"value": "open"
}
],
"customFields": [
{
"field": "custom_CFLLXQWWY4Z",
"customFieldId": "CFLLXQWWY4Z",
"operator": "=",
"value": "Value"
}
]
},
"contact": {
"standardFields": [
{
"field": "status",
"operator": "=",
"value": "open"
}
],
"customFields": [
{
"field": "custom_CFLLXQWWY4Z",
"customFieldId": "CFLLXQWWY4Z",
"operator": "=",
"value": "Value"
}
]
}
},
"anyFilters": {
"ticket": {
"standardFields": [
{
"field": "status",
"operator": "=",
"value": "open"
}
],
"customFields": [
{
"field": "custom_CFLLXQWWY4Z",
"customFieldId": "CFLLXQWWY4Z",
"operator": "=",
"value": "Value"
}
]
},
"account": {
"standardFields": [
{
"field": "status",
"operator": "=",
"value": "open"
}
],
"customFields": [
{
"field": "custom_CFLLXQWWY4Z",
"customFieldId": "CFLLXQWWY4Z",
"operator": "=",
"value": "Value"
}
]
},
"contact": {
"standardFields": [
{
"field": "status",
"operator": "=",
"value": "open"
}
],
"customFields": [
{
"field": "custom_CFLLXQWWY4Z",
"customFieldId": "CFLLXQWWY4Z",
"operator": "=",
"value": "Value"
}
]
}
},
"triggerConfig": {
"triggerType": "always",
"randomPercentage": 10,
"triggerEvent": "ticket_resolved",
"delayMinutes": 30
},
"feedbackConfig": {
"enabled": true,
"feedbackType": "star",
"includeCommentField": true,
"customTitle": "How was your experience?",
"customMessage": "Please rate your satisfaction with our support.",
"customThankYouMessage": "Thank you for your feedback!",
"commentFieldLabel": "Additional Comments",
"commentFieldPlaceholder": "Please share any additional feedback here...",
"brandingColor": "#3366CC",
"deliveryChannel": "email"
},
"description": "Sends CSAT surveys to customers with high priority tickets",
"priority": 1
}
'import requests
url = "https://platform.thena.ai/v1/csat/rules/{teamUid}"
payload = {
"name": "High Priority Ticket Survey",
"isActive": True,
"allFilters": {
"ticket": {
"standardFields": [
{
"field": "status",
"operator": "=",
"value": "open"
}
],
"customFields": [
{
"field": "custom_CFLLXQWWY4Z",
"customFieldId": "CFLLXQWWY4Z",
"operator": "=",
"value": "Value"
}
]
},
"account": {
"standardFields": [
{
"field": "status",
"operator": "=",
"value": "open"
}
],
"customFields": [
{
"field": "custom_CFLLXQWWY4Z",
"customFieldId": "CFLLXQWWY4Z",
"operator": "=",
"value": "Value"
}
]
},
"contact": {
"standardFields": [
{
"field": "status",
"operator": "=",
"value": "open"
}
],
"customFields": [
{
"field": "custom_CFLLXQWWY4Z",
"customFieldId": "CFLLXQWWY4Z",
"operator": "=",
"value": "Value"
}
]
}
},
"anyFilters": {
"ticket": {
"standardFields": [
{
"field": "status",
"operator": "=",
"value": "open"
}
],
"customFields": [
{
"field": "custom_CFLLXQWWY4Z",
"customFieldId": "CFLLXQWWY4Z",
"operator": "=",
"value": "Value"
}
]
},
"account": {
"standardFields": [
{
"field": "status",
"operator": "=",
"value": "open"
}
],
"customFields": [
{
"field": "custom_CFLLXQWWY4Z",
"customFieldId": "CFLLXQWWY4Z",
"operator": "=",
"value": "Value"
}
]
},
"contact": {
"standardFields": [
{
"field": "status",
"operator": "=",
"value": "open"
}
],
"customFields": [
{
"field": "custom_CFLLXQWWY4Z",
"customFieldId": "CFLLXQWWY4Z",
"operator": "=",
"value": "Value"
}
]
}
},
"triggerConfig": {
"triggerType": "always",
"randomPercentage": 10,
"triggerEvent": "ticket_resolved",
"delayMinutes": 30
},
"feedbackConfig": {
"enabled": True,
"feedbackType": "star",
"includeCommentField": True,
"customTitle": "How was your experience?",
"customMessage": "Please rate your satisfaction with our support.",
"customThankYouMessage": "Thank you for your feedback!",
"commentFieldLabel": "Additional Comments",
"commentFieldPlaceholder": "Please share any additional feedback here...",
"brandingColor": "#3366CC",
"deliveryChannel": "email"
},
"description": "Sends CSAT surveys to customers with high priority tickets",
"priority": 1
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'High Priority Ticket Survey',
isActive: true,
allFilters: {
ticket: {
standardFields: [{field: 'status', operator: '=', value: 'open'}],
customFields: [
{
field: 'custom_CFLLXQWWY4Z',
customFieldId: 'CFLLXQWWY4Z',
operator: '=',
value: 'Value'
}
]
},
account: {
standardFields: [{field: 'status', operator: '=', value: 'open'}],
customFields: [
{
field: 'custom_CFLLXQWWY4Z',
customFieldId: 'CFLLXQWWY4Z',
operator: '=',
value: 'Value'
}
]
},
contact: {
standardFields: [{field: 'status', operator: '=', value: 'open'}],
customFields: [
{
field: 'custom_CFLLXQWWY4Z',
customFieldId: 'CFLLXQWWY4Z',
operator: '=',
value: 'Value'
}
]
}
},
anyFilters: {
ticket: {
standardFields: [{field: 'status', operator: '=', value: 'open'}],
customFields: [
{
field: 'custom_CFLLXQWWY4Z',
customFieldId: 'CFLLXQWWY4Z',
operator: '=',
value: 'Value'
}
]
},
account: {
standardFields: [{field: 'status', operator: '=', value: 'open'}],
customFields: [
{
field: 'custom_CFLLXQWWY4Z',
customFieldId: 'CFLLXQWWY4Z',
operator: '=',
value: 'Value'
}
]
},
contact: {
standardFields: [{field: 'status', operator: '=', value: 'open'}],
customFields: [
{
field: 'custom_CFLLXQWWY4Z',
customFieldId: 'CFLLXQWWY4Z',
operator: '=',
value: 'Value'
}
]
}
},
triggerConfig: {
triggerType: 'always',
randomPercentage: 10,
triggerEvent: 'ticket_resolved',
delayMinutes: 30
},
feedbackConfig: {
enabled: true,
feedbackType: 'star',
includeCommentField: true,
customTitle: 'How was your experience?',
customMessage: 'Please rate your satisfaction with our support.',
customThankYouMessage: 'Thank you for your feedback!',
commentFieldLabel: 'Additional Comments',
commentFieldPlaceholder: 'Please share any additional feedback here...',
brandingColor: '#3366CC',
deliveryChannel: 'email'
},
description: 'Sends CSAT surveys to customers with high priority tickets',
priority: 1
})
};
fetch('https://platform.thena.ai/v1/csat/rules/{teamUid}', 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://platform.thena.ai/v1/csat/rules/{teamUid}",
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' => 'High Priority Ticket Survey',
'isActive' => true,
'allFilters' => [
'ticket' => [
'standardFields' => [
[
'field' => 'status',
'operator' => '=',
'value' => 'open'
]
],
'customFields' => [
[
'field' => 'custom_CFLLXQWWY4Z',
'customFieldId' => 'CFLLXQWWY4Z',
'operator' => '=',
'value' => 'Value'
]
]
],
'account' => [
'standardFields' => [
[
'field' => 'status',
'operator' => '=',
'value' => 'open'
]
],
'customFields' => [
[
'field' => 'custom_CFLLXQWWY4Z',
'customFieldId' => 'CFLLXQWWY4Z',
'operator' => '=',
'value' => 'Value'
]
]
],
'contact' => [
'standardFields' => [
[
'field' => 'status',
'operator' => '=',
'value' => 'open'
]
],
'customFields' => [
[
'field' => 'custom_CFLLXQWWY4Z',
'customFieldId' => 'CFLLXQWWY4Z',
'operator' => '=',
'value' => 'Value'
]
]
]
],
'anyFilters' => [
'ticket' => [
'standardFields' => [
[
'field' => 'status',
'operator' => '=',
'value' => 'open'
]
],
'customFields' => [
[
'field' => 'custom_CFLLXQWWY4Z',
'customFieldId' => 'CFLLXQWWY4Z',
'operator' => '=',
'value' => 'Value'
]
]
],
'account' => [
'standardFields' => [
[
'field' => 'status',
'operator' => '=',
'value' => 'open'
]
],
'customFields' => [
[
'field' => 'custom_CFLLXQWWY4Z',
'customFieldId' => 'CFLLXQWWY4Z',
'operator' => '=',
'value' => 'Value'
]
]
],
'contact' => [
'standardFields' => [
[
'field' => 'status',
'operator' => '=',
'value' => 'open'
]
],
'customFields' => [
[
'field' => 'custom_CFLLXQWWY4Z',
'customFieldId' => 'CFLLXQWWY4Z',
'operator' => '=',
'value' => 'Value'
]
]
]
],
'triggerConfig' => [
'triggerType' => 'always',
'randomPercentage' => 10,
'triggerEvent' => 'ticket_resolved',
'delayMinutes' => 30
],
'feedbackConfig' => [
'enabled' => true,
'feedbackType' => 'star',
'includeCommentField' => true,
'customTitle' => 'How was your experience?',
'customMessage' => 'Please rate your satisfaction with our support.',
'customThankYouMessage' => 'Thank you for your feedback!',
'commentFieldLabel' => 'Additional Comments',
'commentFieldPlaceholder' => 'Please share any additional feedback here...',
'brandingColor' => '#3366CC',
'deliveryChannel' => 'email'
],
'description' => 'Sends CSAT surveys to customers with high priority tickets',
'priority' => 1
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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://platform.thena.ai/v1/csat/rules/{teamUid}"
payload := strings.NewReader("{\n \"name\": \"High Priority Ticket Survey\",\n \"isActive\": true,\n \"allFilters\": {\n \"ticket\": {\n \"standardFields\": [\n {\n \"field\": \"status\",\n \"operator\": \"=\",\n \"value\": \"open\"\n }\n ],\n \"customFields\": [\n {\n \"field\": \"custom_CFLLXQWWY4Z\",\n \"customFieldId\": \"CFLLXQWWY4Z\",\n \"operator\": \"=\",\n \"value\": \"Value\"\n }\n ]\n },\n \"account\": {\n \"standardFields\": [\n {\n \"field\": \"status\",\n \"operator\": \"=\",\n \"value\": \"open\"\n }\n ],\n \"customFields\": [\n {\n \"field\": \"custom_CFLLXQWWY4Z\",\n \"customFieldId\": \"CFLLXQWWY4Z\",\n \"operator\": \"=\",\n \"value\": \"Value\"\n }\n ]\n },\n \"contact\": {\n \"standardFields\": [\n {\n \"field\": \"status\",\n \"operator\": \"=\",\n \"value\": \"open\"\n }\n ],\n \"customFields\": [\n {\n \"field\": \"custom_CFLLXQWWY4Z\",\n \"customFieldId\": \"CFLLXQWWY4Z\",\n \"operator\": \"=\",\n \"value\": \"Value\"\n }\n ]\n }\n },\n \"anyFilters\": {\n \"ticket\": {\n \"standardFields\": [\n {\n \"field\": \"status\",\n \"operator\": \"=\",\n \"value\": \"open\"\n }\n ],\n \"customFields\": [\n {\n \"field\": \"custom_CFLLXQWWY4Z\",\n \"customFieldId\": \"CFLLXQWWY4Z\",\n \"operator\": \"=\",\n \"value\": \"Value\"\n }\n ]\n },\n \"account\": {\n \"standardFields\": [\n {\n \"field\": \"status\",\n \"operator\": \"=\",\n \"value\": \"open\"\n }\n ],\n \"customFields\": [\n {\n \"field\": \"custom_CFLLXQWWY4Z\",\n \"customFieldId\": \"CFLLXQWWY4Z\",\n \"operator\": \"=\",\n \"value\": \"Value\"\n }\n ]\n },\n \"contact\": {\n \"standardFields\": [\n {\n \"field\": \"status\",\n \"operator\": \"=\",\n \"value\": \"open\"\n }\n ],\n \"customFields\": [\n {\n \"field\": \"custom_CFLLXQWWY4Z\",\n \"customFieldId\": \"CFLLXQWWY4Z\",\n \"operator\": \"=\",\n \"value\": \"Value\"\n }\n ]\n }\n },\n \"triggerConfig\": {\n \"triggerType\": \"always\",\n \"randomPercentage\": 10,\n \"triggerEvent\": \"ticket_resolved\",\n \"delayMinutes\": 30\n },\n \"feedbackConfig\": {\n \"enabled\": true,\n \"feedbackType\": \"star\",\n \"includeCommentField\": true,\n \"customTitle\": \"How was your experience?\",\n \"customMessage\": \"Please rate your satisfaction with our support.\",\n \"customThankYouMessage\": \"Thank you for your feedback!\",\n \"commentFieldLabel\": \"Additional Comments\",\n \"commentFieldPlaceholder\": \"Please share any additional feedback here...\",\n \"brandingColor\": \"#3366CC\",\n \"deliveryChannel\": \"email\"\n },\n \"description\": \"Sends CSAT surveys to customers with high priority tickets\",\n \"priority\": 1\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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://platform.thena.ai/v1/csat/rules/{teamUid}")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"High Priority Ticket Survey\",\n \"isActive\": true,\n \"allFilters\": {\n \"ticket\": {\n \"standardFields\": [\n {\n \"field\": \"status\",\n \"operator\": \"=\",\n \"value\": \"open\"\n }\n ],\n \"customFields\": [\n {\n \"field\": \"custom_CFLLXQWWY4Z\",\n \"customFieldId\": \"CFLLXQWWY4Z\",\n \"operator\": \"=\",\n \"value\": \"Value\"\n }\n ]\n },\n \"account\": {\n \"standardFields\": [\n {\n \"field\": \"status\",\n \"operator\": \"=\",\n \"value\": \"open\"\n }\n ],\n \"customFields\": [\n {\n \"field\": \"custom_CFLLXQWWY4Z\",\n \"customFieldId\": \"CFLLXQWWY4Z\",\n \"operator\": \"=\",\n \"value\": \"Value\"\n }\n ]\n },\n \"contact\": {\n \"standardFields\": [\n {\n \"field\": \"status\",\n \"operator\": \"=\",\n \"value\": \"open\"\n }\n ],\n \"customFields\": [\n {\n \"field\": \"custom_CFLLXQWWY4Z\",\n \"customFieldId\": \"CFLLXQWWY4Z\",\n \"operator\": \"=\",\n \"value\": \"Value\"\n }\n ]\n }\n },\n \"anyFilters\": {\n \"ticket\": {\n \"standardFields\": [\n {\n \"field\": \"status\",\n \"operator\": \"=\",\n \"value\": \"open\"\n }\n ],\n \"customFields\": [\n {\n \"field\": \"custom_CFLLXQWWY4Z\",\n \"customFieldId\": \"CFLLXQWWY4Z\",\n \"operator\": \"=\",\n \"value\": \"Value\"\n }\n ]\n },\n \"account\": {\n \"standardFields\": [\n {\n \"field\": \"status\",\n \"operator\": \"=\",\n \"value\": \"open\"\n }\n ],\n \"customFields\": [\n {\n \"field\": \"custom_CFLLXQWWY4Z\",\n \"customFieldId\": \"CFLLXQWWY4Z\",\n \"operator\": \"=\",\n \"value\": \"Value\"\n }\n ]\n },\n \"contact\": {\n \"standardFields\": [\n {\n \"field\": \"status\",\n \"operator\": \"=\",\n \"value\": \"open\"\n }\n ],\n \"customFields\": [\n {\n \"field\": \"custom_CFLLXQWWY4Z\",\n \"customFieldId\": \"CFLLXQWWY4Z\",\n \"operator\": \"=\",\n \"value\": \"Value\"\n }\n ]\n }\n },\n \"triggerConfig\": {\n \"triggerType\": \"always\",\n \"randomPercentage\": 10,\n \"triggerEvent\": \"ticket_resolved\",\n \"delayMinutes\": 30\n },\n \"feedbackConfig\": {\n \"enabled\": true,\n \"feedbackType\": \"star\",\n \"includeCommentField\": true,\n \"customTitle\": \"How was your experience?\",\n \"customMessage\": \"Please rate your satisfaction with our support.\",\n \"customThankYouMessage\": \"Thank you for your feedback!\",\n \"commentFieldLabel\": \"Additional Comments\",\n \"commentFieldPlaceholder\": \"Please share any additional feedback here...\",\n \"brandingColor\": \"#3366CC\",\n \"deliveryChannel\": \"email\"\n },\n \"description\": \"Sends CSAT surveys to customers with high priority tickets\",\n \"priority\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://platform.thena.ai/v1/csat/rules/{teamUid}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"High Priority Ticket Survey\",\n \"isActive\": true,\n \"allFilters\": {\n \"ticket\": {\n \"standardFields\": [\n {\n \"field\": \"status\",\n \"operator\": \"=\",\n \"value\": \"open\"\n }\n ],\n \"customFields\": [\n {\n \"field\": \"custom_CFLLXQWWY4Z\",\n \"customFieldId\": \"CFLLXQWWY4Z\",\n \"operator\": \"=\",\n \"value\": \"Value\"\n }\n ]\n },\n \"account\": {\n \"standardFields\": [\n {\n \"field\": \"status\",\n \"operator\": \"=\",\n \"value\": \"open\"\n }\n ],\n \"customFields\": [\n {\n \"field\": \"custom_CFLLXQWWY4Z\",\n \"customFieldId\": \"CFLLXQWWY4Z\",\n \"operator\": \"=\",\n \"value\": \"Value\"\n }\n ]\n },\n \"contact\": {\n \"standardFields\": [\n {\n \"field\": \"status\",\n \"operator\": \"=\",\n \"value\": \"open\"\n }\n ],\n \"customFields\": [\n {\n \"field\": \"custom_CFLLXQWWY4Z\",\n \"customFieldId\": \"CFLLXQWWY4Z\",\n \"operator\": \"=\",\n \"value\": \"Value\"\n }\n ]\n }\n },\n \"anyFilters\": {\n \"ticket\": {\n \"standardFields\": [\n {\n \"field\": \"status\",\n \"operator\": \"=\",\n \"value\": \"open\"\n }\n ],\n \"customFields\": [\n {\n \"field\": \"custom_CFLLXQWWY4Z\",\n \"customFieldId\": \"CFLLXQWWY4Z\",\n \"operator\": \"=\",\n \"value\": \"Value\"\n }\n ]\n },\n \"account\": {\n \"standardFields\": [\n {\n \"field\": \"status\",\n \"operator\": \"=\",\n \"value\": \"open\"\n }\n ],\n \"customFields\": [\n {\n \"field\": \"custom_CFLLXQWWY4Z\",\n \"customFieldId\": \"CFLLXQWWY4Z\",\n \"operator\": \"=\",\n \"value\": \"Value\"\n }\n ]\n },\n \"contact\": {\n \"standardFields\": [\n {\n \"field\": \"status\",\n \"operator\": \"=\",\n \"value\": \"open\"\n }\n ],\n \"customFields\": [\n {\n \"field\": \"custom_CFLLXQWWY4Z\",\n \"customFieldId\": \"CFLLXQWWY4Z\",\n \"operator\": \"=\",\n \"value\": \"Value\"\n }\n ]\n }\n },\n \"triggerConfig\": {\n \"triggerType\": \"always\",\n \"randomPercentage\": 10,\n \"triggerEvent\": \"ticket_resolved\",\n \"delayMinutes\": 30\n },\n \"feedbackConfig\": {\n \"enabled\": true,\n \"feedbackType\": \"star\",\n \"includeCommentField\": true,\n \"customTitle\": \"How was your experience?\",\n \"customMessage\": \"Please rate your satisfaction with our support.\",\n \"customThankYouMessage\": \"Thank you for your feedback!\",\n \"commentFieldLabel\": \"Additional Comments\",\n \"commentFieldPlaceholder\": \"Please share any additional feedback here...\",\n \"brandingColor\": \"#3366CC\",\n \"deliveryChannel\": \"email\"\n },\n \"description\": \"Sends CSAT surveys to customers with high priority tickets\",\n \"priority\": 1\n}"
response = http.request(request)
puts response.read_body{
"data": {
"ok": true,
"data": {
"id": "123e4567-e89b-12d3-a456-426614174000",
"team": {
"id": "12345678910"
},
"organization": {
"id": "98765432110"
},
"isEnabled": true,
"cooldownPeriodDays": 14,
"userCooldownPeriodDays": 30,
"emailConfigId": "email-config-123",
"closedStatusIds": [
"1",
"2",
"3"
],
"rules": [
{
"id": "e4d2a5b1-9c3f-4c8d-b1a2-3e4f5a6b7c8d",
"name": "High Priority Ticket Survey",
"description": "Sends CSAT surveys to customers with high priority tickets",
"isActive": true,
"priority": 1,
"createdAt": "2023-08-01T12:00:00Z",
"updatedAt": "2023-08-02T14:30:00Z"
}
],
"createdAt": "2023-01-01T00:00:00.000Z",
"updatedAt": "2023-01-01T00:00:00.000Z"
}
},
"status": true,
"message": "CSAT rule created successfully",
"timestamp": "2025-07-15T11:38:09.817Z"
}{
"statusCode": 400,
"message": "Validation failed",
"error": "Bad Request"
}{
"statusCode": 401,
"message": "Unauthorized",
"error": "Unauthorized"
}{
"statusCode": 403,
"message": "Forbidden",
"error": "Forbidden"
}{
"statusCode": 404,
"message": "Team not found",
"error": "Not Found"
}{
"statusCode": 500,
"message": "Internal Server Error",
"error": "Internal Server Error"
}{
"statusCode": 503,
"message": "Service Unavailable",
"error": "Service Unavailable"
}Body
application/json
Response
Success - CSAT rule created successfully