Create automation rule
curl --request POST \
--url https://app.msportal.ai/api/public/v1/automation \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"triggerConfig": {},
"conditions": [
null
],
"actions": [
null
],
"description": "<string>",
"isActive": false,
"priority": 0,
"scopeType": "tenant",
"companyIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"aggregationConfig": "<unknown>"
}
'import requests
url = "https://app.msportal.ai/api/public/v1/automation"
payload = {
"name": "<string>",
"triggerConfig": {},
"conditions": [None],
"actions": [None],
"description": "<string>",
"isActive": False,
"priority": 0,
"scopeType": "tenant",
"companyIds": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"aggregationConfig": "<unknown>"
}
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({
name: '<string>',
triggerConfig: {},
conditions: [null],
actions: [null],
description: '<string>',
isActive: false,
priority: 0,
scopeType: 'tenant',
companyIds: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
aggregationConfig: '<unknown>'
})
};
fetch('https://app.msportal.ai/api/public/v1/automation', 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://app.msportal.ai/api/public/v1/automation",
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' => '<string>',
'triggerConfig' => [
],
'conditions' => [
null
],
'actions' => [
null
],
'description' => '<string>',
'isActive' => false,
'priority' => 0,
'scopeType' => 'tenant',
'companyIds' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'aggregationConfig' => '<unknown>'
]),
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://app.msportal.ai/api/public/v1/automation"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"triggerConfig\": {},\n \"conditions\": [\n null\n ],\n \"actions\": [\n null\n ],\n \"description\": \"<string>\",\n \"isActive\": false,\n \"priority\": 0,\n \"scopeType\": \"tenant\",\n \"companyIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"aggregationConfig\": \"<unknown>\"\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://app.msportal.ai/api/public/v1/automation")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"triggerConfig\": {},\n \"conditions\": [\n null\n ],\n \"actions\": [\n null\n ],\n \"description\": \"<string>\",\n \"isActive\": false,\n \"priority\": 0,\n \"scopeType\": \"tenant\",\n \"companyIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"aggregationConfig\": \"<unknown>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.msportal.ai/api/public/v1/automation")
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\": \"<string>\",\n \"triggerConfig\": {},\n \"conditions\": [\n null\n ],\n \"actions\": [\n null\n ],\n \"description\": \"<string>\",\n \"isActive\": false,\n \"priority\": 0,\n \"scopeType\": \"tenant\",\n \"companyIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"aggregationConfig\": \"<unknown>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"description": "<string>",
"isActive": true,
"priority": 123,
"companyIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"triggerType": "<string>",
"entityType": "<string>",
"triggerConfig": {},
"conditions": [
{
"id": "<string>",
"conditions": [
{
"id": "<string>",
"field": "<string>",
"operator": "<string>",
"value": "<unknown>"
}
],
"groups": [
null
]
}
],
"actions": [
{
"id": "<string>",
"actionType": "<string>",
"config": {},
"order": 123,
"requiresApproval": true
}
],
"aggregationConfig": {
"enabled": true,
"groupBy": "<string>",
"groupField": "<string>",
"minBatchSize": 123,
"maxWaitHours": 123,
"combinedActionConfig": {
"titleTemplate": "<string>",
"descriptionTemplate": "<string>"
}
},
"createdBy": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>"
},
"updatedBy": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>"
},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"version": 123,
"companies": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>"
}
]
}
}{
"error": "<string>",
"requestId": "<string>",
"details": "<unknown>",
"code": "<string>"
}{
"error": "<string>",
"requestId": "<string>",
"details": "<unknown>",
"code": "<string>"
}{
"error": "<string>",
"requestId": "<string>",
"details": "<unknown>",
"code": "<string>"
}Automation Rules
Create automation rule
Create a new automation rule. The rule will be inactive by default unless isActive is set to true.
POST
/
api
/
public
/
v1
/
automation
Create automation rule
curl --request POST \
--url https://app.msportal.ai/api/public/v1/automation \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"triggerConfig": {},
"conditions": [
null
],
"actions": [
null
],
"description": "<string>",
"isActive": false,
"priority": 0,
"scopeType": "tenant",
"companyIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"aggregationConfig": "<unknown>"
}
'import requests
url = "https://app.msportal.ai/api/public/v1/automation"
payload = {
"name": "<string>",
"triggerConfig": {},
"conditions": [None],
"actions": [None],
"description": "<string>",
"isActive": False,
"priority": 0,
"scopeType": "tenant",
"companyIds": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"aggregationConfig": "<unknown>"
}
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({
name: '<string>',
triggerConfig: {},
conditions: [null],
actions: [null],
description: '<string>',
isActive: false,
priority: 0,
scopeType: 'tenant',
companyIds: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
aggregationConfig: '<unknown>'
})
};
fetch('https://app.msportal.ai/api/public/v1/automation', 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://app.msportal.ai/api/public/v1/automation",
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' => '<string>',
'triggerConfig' => [
],
'conditions' => [
null
],
'actions' => [
null
],
'description' => '<string>',
'isActive' => false,
'priority' => 0,
'scopeType' => 'tenant',
'companyIds' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'aggregationConfig' => '<unknown>'
]),
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://app.msportal.ai/api/public/v1/automation"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"triggerConfig\": {},\n \"conditions\": [\n null\n ],\n \"actions\": [\n null\n ],\n \"description\": \"<string>\",\n \"isActive\": false,\n \"priority\": 0,\n \"scopeType\": \"tenant\",\n \"companyIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"aggregationConfig\": \"<unknown>\"\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://app.msportal.ai/api/public/v1/automation")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"triggerConfig\": {},\n \"conditions\": [\n null\n ],\n \"actions\": [\n null\n ],\n \"description\": \"<string>\",\n \"isActive\": false,\n \"priority\": 0,\n \"scopeType\": \"tenant\",\n \"companyIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"aggregationConfig\": \"<unknown>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.msportal.ai/api/public/v1/automation")
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\": \"<string>\",\n \"triggerConfig\": {},\n \"conditions\": [\n null\n ],\n \"actions\": [\n null\n ],\n \"description\": \"<string>\",\n \"isActive\": false,\n \"priority\": 0,\n \"scopeType\": \"tenant\",\n \"companyIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"aggregationConfig\": \"<unknown>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"description": "<string>",
"isActive": true,
"priority": 123,
"companyIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"triggerType": "<string>",
"entityType": "<string>",
"triggerConfig": {},
"conditions": [
{
"id": "<string>",
"conditions": [
{
"id": "<string>",
"field": "<string>",
"operator": "<string>",
"value": "<unknown>"
}
],
"groups": [
null
]
}
],
"actions": [
{
"id": "<string>",
"actionType": "<string>",
"config": {},
"order": 123,
"requiresApproval": true
}
],
"aggregationConfig": {
"enabled": true,
"groupBy": "<string>",
"groupField": "<string>",
"minBatchSize": 123,
"maxWaitHours": 123,
"combinedActionConfig": {
"titleTemplate": "<string>",
"descriptionTemplate": "<string>"
}
},
"createdBy": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>"
},
"updatedBy": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>"
},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"version": 123,
"companies": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>"
}
]
}
}{
"error": "<string>",
"requestId": "<string>",
"details": "<unknown>",
"code": "<string>"
}{
"error": "<string>",
"requestId": "<string>",
"details": "<unknown>",
"code": "<string>"
}{
"error": "<string>",
"requestId": "<string>",
"details": "<unknown>",
"code": "<string>"
}Authorizations
Use your API key as a Bearer token. API keys can be generated in Settings → Integrations → API Access.
Body
application/json
Rule name (required)
Required string length:
1 - 200Trigger type (required)
Available options:
date_threshold, scheduled, field_change, absence Trigger-specific configuration (required)
Show child attributes
Show child attributes
Entity type (required)
Available options:
device, company, compliance, planner, user, goal, training, ticket, meeting Condition groups (required)
Actions to execute (required)
Rule description
Maximum string length:
1000Whether to activate the rule immediately
Rule priority (0-100)
Required range:
0 <= x <= 100Rule scope
Available options:
tenant, company Company IDs for company-scoped rules
Aggregation configuration
Response
Rule created successfully
Show child attributes
Show child attributes
Was this page helpful?
⌘I