ThingWorx Flow > Example: ThingWorx Alert Management Workflow
Example: ThingWorx Alert Management Workflow
This workflow illustrates a service use case where when a generator alert occurs, a service case is created and an SMS is sent to the service provider.
When a generator alert occurs, the workflow is triggered automatically.
The generator properties (fuel level, engine temperature, model number, serial number and location) are acquired from the generator Thing instances for which the alert occurred.
A refueling service case is created in Trello for a low fuel level alert event and an e-mail with the service case and location is sent to a service provider.
An emergency service case is created in Trello for high engine temperature alert branch and an SMS is sent to the operator to shut down the generator to prevent damage. The text includes the model, serial number, engine temp and map location link.
Creating a Thing Template and Alerts
1. In ThingWorx Composer, create your Thing Template based on the GenericThing Thing Template with the properties as shown in the following figure:
2. Create Alerts as shown in the following figure:
3. Create your Thing based on the Thing Template that you created in step 1.
4. In the Workflow Editor, create the ThingWorxAlertsManagement as shown in the following figure:
5. Click , and then click or double-click , and search for the ThingWorx trigger.
6. Configure the ThingWorx trigger to connect to your ThingWorx instance.
For more information, see ThingWorx Trigger.
7. In the Source Entity list, select the Thing that you created in Step 3.
8. In the Event list, select AnyAlert.
9. Click SAVE.
Adding the ThingWorx Action
1. Drag the Get Thing Properties action under ThingWorx to the canvas, place the pointer on the action, and then click or double-click the action.
2. Configure the action as per the following figure, and click Done.
Adding Trello Actions
1. Drag the Add Card action under Trello to the canvas, place the pointer on the action, and then click or double-click the action.
2. Configure the Add Card action to connect to your Trello account.
3. Map the SerialNumber output of the Get Thing Properties action to the Card Name field.
4. Select the appropriate Board ID and List ID from your Trello account.
5. Click Done.
6. Drag another Trello Add Card action to the canvas, configure the action as per the following figure, and click Done.
Adding Office 365 Actions
1. Drag the Send an Email action under Office 365 to the canvas, place the pointer on the action, and then click or double-click the action.
2. Configure the Send an Email action to connect to your Office 365 account.
3. Configure the action as per the following figure, and click Done.
Adding Twilio Actions
1. Drag the Send an SMS action under Twilio to the canvas, place the pointer on the action, and then click or double-click the action.
2. Configure the Send an SMS action to connect to your Twilio account.
3. Configure the action as per the following figure, and click Done.
Connecting the Actions and Setting Conditions
1. Connect all the actions as shown in the following figure, and click Save.
2. Click the following condition line and click .
3. Set the condition as shown in the following figure, and click Done.
4. Click the following condition line and click .
5. Set the condition as shown in the following figure, and click Done.
Verifying the Triggered Flow
1. In ThingWorx Composer, update the value of the EngineTemperature property to 300.
2. Verify that the flow is triggered as shown in the following figure that follows and an emergency service case is created in Trello for the high engine temperature alert branch and an SMS is sent to the operator.
A text message is received on the operators phone as shown below: