This section let you configure rules to control your SIM cards, send notifications (email, SMS, push API, etc.) or perform actions (e.g. change rate plan, change SIM Card status), when the rule triggers.
You can configure three types of rules:
Event Rules: handles specific events (e.g. New Device, New Call Detail Record, etc.), that happen during the life cycle of the selected SIM cards.
Usage Rules: handles the usage (e.g. data, SMS, etc.) of the selected SIM Cards, you can customize how the total usage is calculated.
The rules are applicable to all SIM cards, a list of selected SIM Cards or filtered by the selected tags, depending on your choice.
To access the Rules sections, select the options Rules in the sidebar MENU. In the rule section, the main view has three panels, one for each rule type (see picture below), with a table inside that shows the rules created.
Example panels with configured rules.
Each row contain the basic information (Label, Type, Date Created) for each rule. In the column Actions you can select if you want to View or Delete the rule.
In the upper right side of each panel there is a ‘+‘ sign, that let you create new Rules for that type.
At the end of this view, there is the History button that redirects you to the rules triggered page.
To create new rules, go to the main Rules page view and click the ‘+‘ sign on each panel to select which type of rule you want to create. You will be redirected to a wizard form that helps you create new rules, divided in five steps:
- Rules Triggers
- SIM Card(s)
In this step you give a name to the new rule.
First step in wizard form - Label.
In this step, you configure the triggers that rule needs to check to perform the actions or send the notifications. Each rule type has their own configuration, which are described in the next subsections.
First, chose the event you want to configure.
Second step in wizard form - Rules Triggers (Event Rules).
There are currently, six event types to configure:
- New Data Session
- New Platform Simple Short Message (SMS)
- New Device
- New Location
- New SIM Card State
Each options has their own settings to configure.
When you configure the New Data Session event, you need to chose when you want to receive the notification, at the start of the session or at the end.
Rule triggers when the new data session ends.
When you configure the New Platform Simple Short Message (SMS) event, the rule triggers when the selected SIM Cards receives a SMS from the platform or send a SMS to the platform.
In the scenario where the SMS was originated from the IoT Portal, the rule is only triggered when the SMS is delivered. Pending and cancelled status do not trigger these type of rules
Rule triggers when there are new short message.
When you configure the New Device event, the rule triggers when the selected SIM Cards have a new IMEI attached. Depending on the rule configuration you can lock SIM Cards to a specific IMEI, or create an IMEI range preventing the SIM Cards to attache to other devices. See below examples for possible configurations:
Rule triggers when the SIM Card doesn’t have a device attached and receives a new device with an IMEI prefix ‘12345678’.
The IMEI prefix must at least have 8 digits.
Rule triggers when the SIM Card doesn’t have a device attached and receives a new device with an IMEI prefix that doesn’t start with ‘12345678’.
This example is a good way for you to lock SIM Cards to a specific IMEI range. You can choose to suspend the SIM Card, when the rule triggers, preventing from using in other devices.
Rule triggers when the SIM Card changes from any device to another.
This example is a good way for you to lock SIM Cards to any IMEI already attach. You can choose to suspend the SIM Card, when the rule triggers, preventing from using in other devices.
When you configure the New Location event, the rule triggers when the selected SIM Cards enter a new country or network, depending on your choice.
Rule triggers when the SIM Card enters a new country.
These type of rules should not be used to influence the network steering of a SIM profile. For example, if there's a rule to suspend the SIM when it attaches to a given network, the SIM will still try to connect to that network, depending on network conditions and SIM profile preferences.
When you configure the New SIM Card State event, the rule triggers when the selected SIM Cards changes from one state to another, depending on your choice. See below examples for possible configurations:
Rule triggers when the SIM Card changes from provisioned state to active.
This example is a good way to send email, SMS or webhook notifications when a SIM Card is Activated.
Rule triggers when the SIM Card changes from any device to another.
First, chose the usage you want the rule to control. From the five possible options:
- Inbound Call(s)
- Outbound Call(s)
- Outbound SMS
- Data Usage
- Number of Data Connection
Usage type select list.
The second option let you choose how the rule counts the usage. There are two option:
- “Each SIM Card” - the rule tracks the usage for each SIM Card.
- “All selected SIM Card(s)” - the rule tracks the usage sum of all SIM Card(s).
Usage sum type select box.
The third option let you type the usage amount cap, in order to trigger the rule.
Usage amount box.
The units and the total amount change depending on usage type. See the table below for more information:
|Units||Usage Type||Max value|
The fourth option let you choose the period in which the rule gatherers information to calculate to total usage.
Rule period select box.
|Calendar Month||Uses the data of the current month|
|Billing Cycle||Uses the data of the current billing cycle of the triggered SIM Card|
|Calendar Week||Uses the data of the current week|
|Calendar Day||Uses the data of the current day|
|Past 24 Hours||Uses the data from the last 24 hours|
|Past 7 Days||Uses the data from the last 7 days|
|Past 14 Days||Uses the data from the last 14 days|
|Past 30 Days||Uses the data from the last 30 days|
|Custom Period||Uses the data from the custom select period, counted in minutes or hours|
|Last Session||Uses the data from the last session|
If you select Custom Period it will show the following box:
Custom Period field in usage rules.
In this step, you select the SIM Card(s) for the rule. There are three possible choices:
- SIM Card(s)
- All SIM Cards
Manually select the list of SIM Card(s) from your inventory. Use Ctrl key (or Cmd key in Mac) to select the SIM Card(s) you want to use or not.
SIM Card list selection box.
If your inventory has more than 1000 SIM Card(s), this feature is disable. Apply tags to your SIM Card() and create rules with them (see below).
If you use the Tags option, the rule will use the SIM Card(s) that have all of the Tags selected. You can create more tags using the Tags section.
Tags options selection view.
All SIM Card(s)
If you use this option, the rules uses all SIM Cards in your account.
After selecting the SIM Cards, choose which actions you want the rule to perform in the SIM card(s) if it triggers. You can leave the options blank and the rule will jump this step.
For all rule types you can choose to change the SIM Card status. For examples, if one SIM Card triggers a specific Rule triggers it will suspend the SIM Card(s) in question.
Actions step for Event and Usage Rules
After selecting or not the actions, choose which notifications you want the rule to send when it triggers. You can leave the options blank and the rule will jump this step.
There are currently four types of notification to send:
- Webhook (Push notification)
Notifications step for all the Rules
Sends an email with a default message to the selected email.
Sends a message to the selected number.
The selected number can be the Triggered Number or a Custom Number.
SMS’s can only be sent to Truphone numbers.
The message sent can be the default message (select Default Message) or customizable (select Custom Message).
The following figures shows possible configurations:
Send SMS with Custom Number and Custom Message.
Send SMS with Default Number and Default Message.
Sends a push notification to the selected server. The notification payload depend on the type of rule. Each HTTP notification also include the following HTTP headers:
Sample HTTP headers
The following sections describe webhook examples for each type of rule.
The parameter event = '2' means that it's a start session event
The parameter event = '1' means that it's an end session event
This refers to a SMS MT or SMS received by the SIM from the portal
This refers to a SMS MO or SMS sent by the SIM to the portal
You can click in the View button to view the details of a specific rule. The new page will show in a single page the triggers, SIM cards, the actions adn the notifications. You can click Edit to start editing the page.
Details of existing rule.
You can click in the History button to view all the list of all the triggered rules and the actions.
History of triggered rules.
To export the information you can click “Export” and choose the method to export the information, see Rules History Export for more information.