State Trigger

State trigger executes an action when entity’s state changes to the one of the states defined in the states field.

State trigger model

Field Type Description

duration

Integer

The amount of time (in milliseconds), during which an object stays in the specified condition to execute the set action.

payload

Object

The action’s settings. Specific to the type of action. See the Action Types section for more information.

periodicity

Object

The periodicity with which to repeat the set action.

periodicity.value

String

The amount of time before between repeats.

periodicity.unit

String

Unit of time. Possible values: minutes, hours, and days.

states

Array<String>

An array of IDs of states that would trigger a specified action.

type

String

The type of an action that would be performed when the object’s state changes. See the Action Types section for more information.

Action types

Execute an operation

Execute a specified operation on state change.

Type name: operation

Payload: Contains the ID of the operation that would be performed on the state change.

"payload": {
    "operation": "62de8f0cda304c7f95cc5252"
}

Send an e-mail

Send an e-mail to specified recipients. The message is constructed from a specific Notification Template.

Type name: e-mail

Payload: Contains the recipients of the e-mail.

"payload": {
    "to": "recipient@example.com",
    "cc": "cc@example.com"
}

Send an SMS

Send SMS to a specified recipient. The message is constructed from a specific Notification Template.

Type name: sms

Payload: Contains the recipient of the SMS.

"payload":{
    "phone": "1234567"
}

Make Voice Call

Perform a voice call to a specified recipient.

Type name: voiceCall

Payload: Contains the phone number to be dialed.

"payload":{
    "phone": "1234567"
}

Execute a script

Execute a script. You can only execute scripts in the filesystem.

Type name: script

Payload: Contains the information about the script — its path and a list of arguments.

"payload": {
    "execPath": "script.sh",
    "execArgs": [
        "arg1",
        "arg2"
    ]
}

Send a Telegram message

Send a Telegram message via a specified bot in a specified chat. The message is constructed from a specific Notification Template.

Type name: telegram

Payload: Contains the ID of the bot that would send the message and the ID of the chat to send the message to.

"payload": {
    "botId": "telegram_bot_id",
    "chatId": "@chat_id"
}

Show a popup message

Show a notification and play a sound in the web interface to select users.

Type name: client-notification

Payload: Contains the name of the sound that will play and a list of users who receive the notification.

"payload": {
    "soundName": "mute",
    "targetUserIds": [
        "62c2f3ce80c8654892764d56"
    ]
}