# Alarm and third-party system alerts

> How to bring alerts from alarm panels, trackers and other systems into Vigil with a webhook, so they land in the same chat as the guards who respond.

Source: https://vigilsecure.net/docs/examples/alarm-integrations/

**The scenario.** Your sites have other systems that raise alerts: an alarm panel, an
electric fence monitor, a vehicle tracker, a fridge sensor. Each has its own app or sends
an email nobody reads at night. You want those alerts to arrive where the control room and
the guards already are.

## How Vigil represents it

| The real world               | In Vigil                                                                                           |
| ---------------------------- | -------------------------------------------------------------------------------------------------- |
| The place alerts should land | A group chat, such as `Rosebank alarms`, with the control room, the site's supervisor and an agent |
| The other system             | A **webhook** on that chat: a secret web address the system sends its alerts to                    |
| An alert                     | A message in the chat, shown under the webhook's name                                              |
| Deciding what to do about it | The people in the chat, or an [agent](https://vigilsecure.net/docs/concepts/agents.md)                                      |
| Sending somebody to check    | A message or patrol request to the guard on site                                                   |

## Set it up

1. In **Communication**, create a group for the alerts and add the people who respond.
2. Open the group's **Channel details** and, under **Webhooks**, choose **New**. Name it
   after the system, such as `Alarm panel`, and copy the **Webhook URL**. It is shown once.
3. Give the address to whoever looks after the other system: your alarm installer, the
   supplier or your IT person. They enter it where the system sends its alerts.
   [Post into a chat with a webhook](https://vigilsecure.net/docs/developers/webhooks.md) tells them exactly what to
   send.
4. Ask them to send a test alert. It appears in the chat straight away.

Most alarm receivers, monitoring platforms and automation tools can send a webhook. For a
system that can only send email or SMS, an automation service can turn the email into a
webhook.

## What happens when an alert arrives

1. **02:14.** The panel posts to the webhook. The message appears in `Rosebank alarms` as
   **Alarm panel**: "ALARM Zone 4 (loading bay) at Rosebank Mall, 02:14".
2. The operator on duty sees it in the console, with a notification.
3. They mention the agent in the same chat: "@Operations ask the guard at Rosebank to check
   the loading bay."
4. The agent finds who is signed in at Rosebank and sends them a one-beacon patrol for the
   loading bay. Finding who is at a site needs the **See device locations** permission,
   which the agent is told to check on the person asking, so give your control room a role
   that includes it. The guard walks there and scans the beacon, and adds a voice note: "All
   clear, a pallet fell over."
5. The alert, the request, the scan and the voice note are on one timeline.

## Let an agent triage

A message from a webhook does not wake an agent by itself. That is deliberate: it stops an
outside system from driving an agent directly. There are two ways to involve one:

- **A person mentions the agent**, as above. A person stays in the loop for every response.
- **The agent checks on a schedule.** Include the agent when you create the chat and ask
  it: "Every five
  minutes between 18:00 and 06:00, read the new alerts in Rosebank alarms. For any alarm at
  a site, ask the guard signed in there to check the zone and tell the control room chat."

## Keep it safe

- The webhook address is the only key. Anyone who has it can post into that chat, so treat
  it like a password and send it only to the person who needs it.
- Use one webhook for each system. If an address leaks, **Revoke** that webhook and create
  a new one without disturbing the others.
- A webhook can only post text into its own chat. It cannot read anything.
- A webhook accepts up to 30 alerts a minute.

## Going the other way

To send what happens in Vigil to another system, for example to open a ticket when a patrol
is missed, a developer can read it through the [Vigil API](https://vigilsecure.net/docs/developers/api.md).

## Related

- [Communication: webhooks](https://vigilsecure.net/docs/concepts/communication.md#webhooks-let-another-system-post-into-a-chat)
- [Post into a chat with a webhook](https://vigilsecure.net/docs/developers/webhooks.md)
