Create webhooks to send Alta Video notifications
Last modified: Tuesday July 02, 2024.
When creating rules, you can define one or more webhooks to send notifications when the rule is triggered.
Webhooks enable you to configure Alta Video 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 Alta Video and your messaging service.
- Configure your chosen communications or messaging service to receive Alta Video notifications. Consult the relevant documentation for information on how to configure your service.
The following tasks show how to set up Slack, and how to create an Alta Video 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
- 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 theAdd features and functionality area. - From the Slack account you chose when you created the Slack App, create a channel to receive the Avigilon Alta notifications
- Link the app to the channel.
Task — Create the webhook
- Choose
Tools > Rules > . - Click
Add new . - Type a name for the webhook. Press Enter.
- From Slack, open the channel you created to display the notifications, and click the link to the App you created.
- Click
Settings from theAbout this app area. - Copy the URL from the Slack App Directory, and paste it into the
URL field in the Alta Video Webhooks dialog.The URL must be in the format: https://hook.slack.com/...
- From
Sending Method , choose whether the webhook is sentFrom cloud orFrom Ava or Avigilon Alta devices . When you selectFrom 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. - From
Method select the required HTTP method. This example usesHTTP POST
.
To increase the number of far-end systems to which Alta Video can send notifications, theHTTP POST
,HTTP PUT
,HTTP PATCH
,HTTP GET
,HTTP HEAD
, andSMTP SEND
methods are available. - To proceed when there are certificate errors, enable
Ignore HTTPS Certificate Errors . - Select the
Authentication method required by your communications or messaging service. The options are:None Basic Digest
Basic orDigest , define the required credentials. - From
Payload type , select to either create a plain text message, or to use the JSON view to valid your message. - In the
Headers area, clickAdd 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.
- 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 Video rule:\n>Rule name: $ruleName \n>Camera: $cameraName \n>Camera view: $cameraView \n>View alarm: $url"}
- When sending
From cloud only:
Click 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. To allow users to manually trigger the webhook, enable
User-operable trigger . From the dropdown, select the required cameras. Video feeds for selected devices and devices associated with a rule using this webhook contain a right-click menu option to trigger it.- 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.