Action policy
The relationship between a trigger and multiple actions is called an action policy. The action policy must be provisioned in Live Objects with the HTTP API or using the web portal. Once the action policy is provisioned and enabled (field enabled set to true), your messages will be routed using the chosen action mode (FIFO queue or HTTP push).
|
Prior to provisioning your rule with an http push action, please make sure your web server is up-and-running.
|
|
Only new routed messages/events are delivered once the action policy is provisioned. Existing data messages already stored in Live Objects are not re-routed. |
An action policy is composed of 2 main sections:
-
triggers: define what you want to route. Usually, one trigger is defined in one action policy, except for device provisioning events, where you can define a trigger for deviceCreated events, and a trigger for deviceDeleted events, in the same action policy.
-
actions: define how you want to route these messages/events.
The action policy API is detailed in Swagger.
Provisioning
To create a new action policy:
Endpoint:
POST /api/v1/event2action/actionPolicies
{
"name": "some_user_defined_policy_name",
"enabled": true,
"triggers": {
"dataMessage": {
"version": 1,
"filter": {
"connectors": [
"lora"
],
"groupPaths": [
{
"includeSubPath": false,
"path": "/europe/france"
}
],
"tags": [
["HIGH","ALERT"],
["PROD"]
]
}
}
},
"actions": {
"fifoPublish": [
{
"fifoName": "myFifo"
}
]
}
}
|
The policy id is automatically created by Live Objects and will be returned in the POST response body. |
| field name | is required | description | |
|---|---|---|---|
name |
optional |
Defines a user-friendly name for the action policy |
|
enabled |
required |
Enable or disable the action policy |
|
suspension |
optional |
In case of abnormal activity on this rule, it can be suspended (enabled will be set to false). Read-only: this field is handled by the platform. Once the problem is corrected, use the PUT API with enabled=true to resume the rule. |
|
required |
Defines the type of trigger that will start an action. Filtering section: criteria in a filter are combined with an AND boolean logic. The OR operator is applied between the items inside each filter list. The filters depend on the trigger type. Note: the triggers object should have exactly one trigger defined in most cases (except for deviceCreated & deviceDeleted). |
||
dataMessage |
optional |
Available filters for data message:
|
|
deviceStatus |
optional |
The device status can be one of the following: "ONLINE", "OFFLINE", "REGISTERED", "DELETED", "ACTIVATED"… See all the device status in this chapter. Available filters for the device status events:
|
|
deviceCreated |
optional |
Available filters for the device created events:
|
|
deviceDeleted |
optional |
Available filters for the device deleted events:
|
|
commandStatus |
optional |
Available filters for the command status events:
|
|
loraNetwork |
optional |
Available filter for the network info events from LoRa® devices:
|
|
loraGatewayStatus |
optional |
Sent event when a LoRa® gateway status changes. Status can be "ONLINE", "OFFLINE" or "UNKNOWN". |
|
connectivityManagementPlatformEvent |
optional |
Event sent by your cellular connectivity management platform (e.g. Orange CMP 'Portail M2M' / 'Conecta IoT' / 'Simply IoT' platform). |
|
alarmEvent |
optional |
Available filter for alarm events: alarmRule.type with supported values messageDeliverySuccessRatio (event sent when a message delivery success ratio alarm is triggered for account metrics monitoring) and actionSuspended (event sent when an action is suspended due to high error rate). Supported alarms full description is available in account alarming chapter. |
|
actions |
required |
Defines the type of action: |
|
emails |
optional |
A collection of Email actions (see Email notification section) |
|
sms |
optional |
A collection of SMS actions (see SMS notification section) |
|
fifoPublish |
optional |
A collection of FIFO names where the event message will be published (see FIFO notification section) |
|
httpPush |
optional |
A collection of HTTP push actions (see HTTP push action section) |
|
azureEventHubs |
optional |
A collection of Azure Event Hubs actions (see Azure Event Hubs notification section) |
|
To retrieve your action policy:
Endpoint:
GET /api/v1/event2action/actionPolicies/{policyId}
Examples
{
"id": "202ada2a-e267-4427-9d7f-2756c2a2b1dd",
"name": "push data fifo",
"enabled": true,
"triggers": {
"dataMessage": {
"version": 1,
"filter": {
"deviceIds": ["<your_device_id>"]
}
}
},
"actions": {
"emails": [],
"sms": [],
"httpPush": [],
"fifoPublish": [
{"fifoName": "<your fifo name>"}
]
}
}
{
"id": "202ada2a-e267-4427-9d7f-2756c2a2b1de",
"name": "Push data message with a webhook",
"enabled": true,
"triggers": {
"dataMessage": {
"version": 1,
"filter": {
"deviceIds": ["<your_device_id>"]
}
}
},
"actions": {
"emails": [],
"sms": [],
"httpPush": [
{
"webhookUrl": "https://webhook.site/....",
"headers": {
"authorization": [
"Bearer 00000000-0000-0000-0000-000000000000"
]
},
"content": "<text>+<mustache template>",
"retryOnFailure": true
}
],
"fifoPublish": []
}
}
|
Now that you know how to create an action policy, you can find the format of all public data messages and events in this chapter. |