Get Alerts
Use this action to get an alert summary and alert history.
Alerts are a special type of events and use the event publish and subscribe mechanism. Alerts allow you to define rules for firing events. All properties in a Thing Shape, ThingTemplate, or Thing can have one or more alert conditions defined. When new data for a property arrives, alert rules are evaluated. If an alert rule applies, an alert is created. A data packet is sent to the subscribers. Alerts are written to the alert history file and can be viewed through the Alert Summary and Alert History Mashups. The system tracks acknowledged and unacknowledged alerts. Alerts do not fire redundant events.
For example, if a numeric property has a rule defined that generates an alert when the value is greater than 50, and a value that equals 51, an alert is generated and an alert event will fire. If another value comes in at 53 before the original alert is acknowledged, another event will not be fired because the current state is still greater than 50.
Using the Get Alerts Action
To use this action in your workflow, you need to connect it to ThingWorx Flow. To connect to a flow, do the following:
1. Drag the Get Alerts action under the ThingWorx connector to the canvas, place the pointer on the action, and then click or double-click the action. The Get Alerts action window opens.
2. Edit the label name, if needed. By default, the label name is same as the action name.
3. To add a connection, refer to the section Adding a Connection in the ThingWorx connector topic. The default value is ThingWorx App Key.
* 
If you previously added a ThingWorx connection, select a connection from the list.
4. In the Find Alerts field, select the appropriate alert from the list.
Alert History—Comprehensive log that records all information recorded into the alert stream, where the data is stored until manually removed. For more information, refer to the Alert History section.
Alert Summary—Compiles data from the last reset of the server to the current state. The system tracks acknowledged and unacknowledged alerts. Alerts do not fire redundant events. For more information, refer to the Alert Summary section.
For more information on the Alert History and Alert Summary, refer to the Alerts topic.
Alert History
1. Select Alert History from the Find Alerts list.
2. Limit—Controls the number of alert occurrences to be fetched in the output. The default value is 500.
3. Order - Oldest First—Select true to view the old alerts first or select false.
4. Start Date and Time—Auto-populated. Click to set a start date of your choice.
5. End Date and Time—Auto-populated. Click to set an end date of your choice.
Start Date and Time and End Date and Time are used to filter alerts as per the date and time of their generation.
6. Click + to view the additional fields:
Query—A query to filter the results.
Thing—Select a Thing from the list.
7. Click Done.
Alert Summary
1. Select Alert Summary from the Find Alerts list.
2. Include Alerts—Select one of the following options:
Acknowledged
Unacknowledged
Both
3. Limit—Alert limit value. The default value is 500.
4. Query—The query to filter the results.
5. Thing—Select a Thing from the list.
6. Property—Alert property
7. Acknowledge Alerts—An acknowledgement (ack) is an indication that someone has seen the alert and is dealing with it (for example, low helium in an MRI machine and someone is filling it).
Acknowledge—Select true to acknowledge an alert, or select false.
Message—Message for acknowledging the alerts.
8. Click Done.
Output Schema
The Get Alerts action returns a dynamic output schema depending on the option you select.
The following image shows the output schema if you select Alert History:
The following image shows the output schema if you select Alert Summary: