How to: Create webhooks to send Aware notifications

Last modified: Thursday November 03, 2022.

When creating rules, you can define one or more webhooks to send notifications when the rule is triggered.

Webhooks enable you to configure Aware to send notifications to any compatible communications or messaging service. For example, you can configure a webhook to send notifications to a Slack or a WhatsApp account.

Prerequisites

  • Knowledge of webhooks, HTTP, JSON and the Application Programming Interface (API) for your chosen messaging service is needed to set up webhooks between Aware and your messaging service.
  • Configure your chosen communications or messaging service to receive Aware notifications. Consult the relevant documentation for information on how to configure your service.

The following tasks show how set up Slack, and how to create an Alta Aware webhook to send notifications to that Slack app.

Refer to the product documentation for your chosen product for the exact steps needed to set up your product to receive webhook notifications.

Task — Prepare your Communications/Messaging application to receive the incoming notifications

  1. Follow the steps to create a Slack App to receive the incoming notifications, as detailed at https://slack.com/intl/en-gb/help/articles/115005265063-incoming-webhooks-for-slack.

    Ensure you select Incoming Webhooks from the Add features and functionality area.

  2. From the Slack account you chose when you created the Slack App, create a channel to receive the Avigilon Alta notifications
  3. Link the app to the channel.

Task — Create the webhook

  1. Choose Tools Tools > Rules Rules > Rules.
  2. Click Add new webhook Add new.
  3. Type a name for the webhook. Press Enter.
  4. From Slack, open the channel you created to display the notifications, and click the link to the App you created.
  5. Click Settings from the About this app area.
  6. Copy the URL from the Slack App Directory, and paste it into the URL field in the Aware Webhooks dialog.

    The URL must be in the format: https://hook.slack.com/...

  7. From Sending Method, choose whether the webhook is sent From cloud or From Ava or Avigilon Alta devices. When you select From Ava or Avigilon Alta devices, the webhook is sent from either the Avigilon Ava cloud-native camera or from the Alta Cloud Connector within your local network.
  8. From Method select the required HTTP method. This example uses HTTP POST.
    To increase the number of far-end systems to which Aware can send notifications, the HTTP POST, HTTP PUT, HTTP PATCH, HTTP GET, HTTP HEAD, and SMTP SEND methods are available.
  9. To proceed when there are certificate errors, enable Ignore HTTPS Certificate Errors.
  10. Select the Authentication method required by your communications or messaging service. The options are:
    • None
    • Basic
    • Digest
    If using Basic or Digest, define the required credentials.
  11. From Payload type, select to either create a plain text message, or to use the JSON view to valid your message.
  12. In the Headers area, click Add new header Add new header. Specify the key/value pair expected by the messaging system you are sending to. This example uses Content-Type and application/json.

    Depending on your chosen messaging service, you might not need to specify headers if you are creating a plain text message payload.

  13. In Payload, enter either the plain text message, or the JSON information for the Webhook to display.

    Click + Show template parameters to view the system variables you can add to your message, that will be replaced with the relevant information when the rule triggers.

    {"text":"Attention,\n>Something has triggered an Alta Aware rule:\n>Rule name: $ruleName \n>Camera: $cameraName \n>Camera view: $cameraView \n>View alarm: $url"}

  14. When sending From cloud only:
    Click Test to send the sample message to your chosen messaging system. If all is configured correctly, you see a "Test message sent" response and the message appears in your chosen messaging system. When sent as a test, the above example appears as:
    Attention,
    Something has triggered an Aware video security system rule:
    Rule name: $ruleName
    Camera: $cameraName
    Camera view: $cameraView
    View alarm: $url

    If there is a misconfiguration, you see a "Failed to send webhook" message.
  15. Click Done.
  • Depending on your chosen messaging system, using the $jpg variable might lead to the base64-encoded data being sent, rather than the snapshot from the triggered rule. How each messaging system handles the image data is not usually configurable, and Avigilon Alta cannot confirm whether any specific messaging system will display the image snapshot now or for any future version.
  • If your chosen messaging system displays the raw data, you can use a base64 decoder to reconstruct the image from the received data.