Action
Manage Automated Actions
Actions implement automated responses for specific device and cloud conditions. Actions are invoked by triggers to respond and implement a specific remedy or notification.
Find
Find actions by matching properties and query parameters.
Endpoint
HTTP
POST /action/findAuthorized User Role
userRequest Body
| Field | Type | Required | Notes |
|---|---|---|---|
| cloudId | string | yes | Filter by cloud ID. |
| type | string | Filter by action type. Valid types are: alert, builder-alert, builder-metric, database, delay, device, email, eventbridge, http, lambda, metric, mqtt, and sms. |
Query String Options
| Field | Type | Default | Role | Notes |
|---|---|---|---|---|
| index | string | owner | Database index name: primary or gs1. | |
| limit | number | Number of items to retrieve. | ||
| next | object | Pagination token for the next page. | ||
| prev | object | Pagination token for the previous page. |
Response
Paged response.
| Field | Type | Notes |
|---|---|---|
| data | array | An array of Action records. |
| next | string | Paged cursor to use for the next page of items. |
| prev | string | Pages cursor to use for the previous page of items. |
Action
| Field | Type | Notes |
|---|---|---|
| args | object | Action args. |
| buffer | object | Buffer optimizations for metrics. |
| cloudId | string | Owning device cloud ID. |
| context | object | Trigger expression context, merged with user params. |
| description | string | Action description. |
| destination | string | URL, email address, function name, topic, phone number. |
| due | number | When the action is next due. |
| enable | boolean | Enable or disable the action. |
| error | string | Error message from last invocation. |
| expression | string | Trigger expression. |
| format | string | Message format. |
| id | string | Unique action ID. |
| name | string | Action name. |
| poll | number | Delay between pollng the trigger. |
| rearm | number | Time period to suppress triggering. |
| severity | string | Alert severity. |
| trigger | string | Source of action trigger. |
| type | string | Action type. |
Get
Get a matching action for a cloud.
Endpoint
HTTP
POST /action/getAuthorized User Role
adminRequest Body
| Field | Type | Required | Notes |
|---|---|---|---|
| id | string | Action ID. | |
| cloudId | string | yes | Filter by cloud ID. |
| type | string | yes | Filter by action type. Valid types are: alert, builder-alert, builder-metric, database, delay, device, email, eventbridge, http, lambda, metric, mqtt, and sms. |
Response
Action record.
| Field | Type | Notes |
|---|---|---|
| args | object | Action args. |
| buffer | object | Buffer optimizations for metrics. |
| cloudId | string | Owning device cloud ID. |
| context | object | Trigger expression context, merged with user params. |
| description | string | Action description. |
| destination | string | URL, email address, function name, topic, phone number. |
| due | number | When the action is next due. |
| enable | boolean | Enable or disable the action. |
| error | string | Error message from last invocation. |
| expression | string | Trigger expression. |
| format | string | Message format. |
| id | string | Unique action ID. |
| name | string | Action name. |
| poll | number | Delay between pollng the trigger. |
| rearm | number | Time period to suppress triggering. |
| severity | string | Alert severity. |
| trigger | string | Source of action trigger. |
| type | string | Action type. |
Invoke
Invoke an automated action by ID or name.
Endpoint
HTTP
POST /action/invokeAuthorized User Role
userRequest Body
| Field | Type | Notes |
|---|---|---|
| id | string | Action ID. |
| name | string | Action name if ID not provided. |
| context | object | Context for the action. |
Response
Object Record.
| Field | Type | Notes |
|---|---|---|
| error | string | Error message if the action failed. |
| name | string | Action name. |
| context | object | Context for the action. |
Example
Invocation using curl to invoke an action by name.
curl
curl -X POST \
https://xrp7t2deqh.execute-api.ap-southeast-1.amazonaws.com/tok/action/invoke \
-H 'Authorization: 1234567990XXXXXXXXXXXXXXXX' \
-H 'Content-Type: application/json' \
-d '{"name":"myAction", "context":{"deviceId": "ZXXXXXXXXX"}}'