Skip to main content

Alert policies

Alert policies represent a subscription to a filtered view of the event log. When a matching event is recorded, the policies' subscribers will receive an email and/or push notification. During policy configuration, admins choose which type of events (type of resource + action) they are interested in and when (e.g. weekends only) they are interested in notifying recipients, as well as the subscribers who should be informed when a matching event is found.

This function is especially important when it comes to situations in which the door has been left or forced open.

Alert policy subscriptions#

Alert policy subscriptions represent the people subscribed to the alert policy. For the alert policy to serve its function, you need to have at least one alert policy subscription. The alert policy subscription will be an object containing the alert policy id, the subscriber email, and information on whether the subscriber should receive email notifications, push notifications, or both.

API reference: Alert Policy Subscriptions

Create an alert policy#

To create an alert policy through the API you must send an alert_policy object to the alert_policies endpoint. A minimal curl call example would be:

curl 'https://api.kisi.io/alert_policies' \
-H 'Accept: application/json' \
-H 'Authorization: KISI-LOGIN {authentication_token}' \
-H 'Content-Type: application/json' \
--data-raw '{"alert_policy":{"name":"Entrance Lower Unlocked","event_object_type":"Lock","event_object_id":16721,"event_reference_type”:null,”event_reference_id”:null,”event_action":"unlock","time_zone":"Etc/UTC","starts_at_time":"00:00:00","ends_at_time":"24:00:00","monday":true}}'

You will need the event_object_id which is the identifier of the object you want to create the policy on.

Notice that it is not necessary to specify organization_id or place_id, because we are sending the type of object (in this case a Lock) and the unique identifier event_object_id of it.

Add subscribers to an alert policy#

To add subscribers to the alert policy just created, you must send an alert_policy_subscription object to the subscriptions endpoint. A curl call example would be:

curl 'https://api.kisi.io/alert_policies/{alert_policy_id}/subscriptions' \
-H 'Accept: application/json' \
-H 'Authorization: KISI-LOGIN {authentication_token}' \
-H 'Content-Type: application/json' \
--data-raw '{"alert_policy_subscription":{"email":"user@kisi.io","send_email":true,"send_push_notification":true}}'

You will need to make this call for each user you want to add as a subscriber.

You can check the list of actions you can execute on alert policies in the Alert Policies section of our API Reference.