Setting up alerts by using APIs

You can set up alerting in Environmental Intelligence Suite by using several APIs.

Before you begin

If you are new to GraphQL, complete the graphql.com tutorials until you feel comfortable with GraphQL API basics.
Note:

These APIs are intended for occasional use only and for when an update needs to happen immediately. In the large majority of cases, the use of these APIs should not be necessary and you should follow the process described in Creating an import rule. If you are unable to use the process outlined in the Creating an import rule topic, and require the use of these APIs on a more frequent basis, contact the support team.

Procedure

  1. Retrieve a JSON Web Token to add to HTTP request headers to authenticate your API calls.
    For more information, see API authentication.
  2. Optional: If you plan to send notifications by email, create contacts.
    Each contact is represented by their first name, last name, and email address. For more information, see Creating contacts.
  3. Optional: If you plan to provide more details about the asset location, such as the street address, create locations. You do not need to enter geographic coordinates in the location object, because that is part of an asset object. For more information, see Creating locations.
  4. Create assets.
    Each asset represents a location, for example, the head office of a company and includes latitude and longitude geographic coordinates. An asset does not have to be associated with a location or a contact, but can be associated with one location or multiple contacts. For more information, see Creating assets.
  5. Activate weather events for your organization by using sample criteria.
    Sample criteria are available in your account for you to use. For more information, see Activating weather alerts.
  6. Create custom criteria for groups of weather alerts by using sample criteria, for example, winter weather alerts.

    In step 9, you create rules by using criterias to activate alerting. You can also create rules by using sample criterias. If you use sample criterias, you do not need to define custom criteria as a part of this step.

    For more information, see Defining criteria
  7. If you plan to send notifications by email, create a message template. You might create a separate message for each alert rule. For example, you can create a winter weather template for the winter weather rule. For more information, see Creating message templates.
  8. To send alert notifications to an HTTP endpoint, create an endpoint definition. Currently, endpoints can only be created by using the API.
    For more information, see Defining HTTP endpoints using APIs.
  9. Create an alert rule that you associate with a criteria definition and configure whether to notify contacts by email, to send notifications to an HTTP endpoint, or to send notifications to the Action center.

    In Action center, alerts are displayed which are sent either to email or to an endpoint. To enable adding alerts in Action center, you must configure to send notifications to the Action center, and you must also configure notifications for either email or an HTTP endpoint. For more information, see Creating alert rules.

  10. If you create the rule by using sample criterias in the Criteria Builder as specified in step 6, all assets and contacts receive alerts for the rule. If assets and contacts subscribe to custom criterias, they only receive alerts for the rules with those custom criterias. If you do not want the assets and contacts to receive all alerts, subscribe the assets and contacts to custom criteria:
    Option Description
    Subscribe assets to the custom criteria. Create asset endpoint subscriptions. For more information, see Creating asset endpoint subscriptions
    Subscribe contacts to the custom criteria. Create contact alert subscriptions. For more information, see Creating contact alert subscriptions.
  11. Verify that notifications are sent when weather alerts are triggered.

Results

Weather alerts are displayed in the Action center. Alert notifications are sent for weather alerts that meet the criteria of the alert rule.