Previous
Act on detections
You want to be notified when your camera detects something specific – a person in a restricted area, a missing hard hat, or an anomaly on a production line. This guide shows you how to connect your vision service to Viam’s trigger system so you receive an email or webhook whenever a detection occurs. No custom code is required.
The alert system chains three resources together:
Because the filtered camera only passes images that match your criteria, every synced image represents a detection event. The trigger fires on each sync, turning data events into alerts.
The filtered-camera module wraps an existing camera and applies a vision service as a filter. It functions as a normal camera for live viewing and API calls. The filtering only affects what gets captured by the data management service.
You configure the filter with:
Triggers support configurable notification frequency to prevent alert fatigue. For example, you can limit alerts to a maximum of one per hour even if detections occur continuously.
Add the filtered camera module to your machine:
Navigate to your machine’s CONFIGURE tab.
Click + and select Configuration block.
Search for filtered-camera and select it.
Click Add component, name it objectfilter-cam, and click Add component again to confirm.
Add configuration attributes:
Replace <camera_name> and <vision_service_name> with the names of your camera and vision service. Choose either objects (for bounding-box detections) or classifications (for image-level labels) and remove the other.
{
"camera": "<camera_name>",
"vision_services": [
{
"vision": "<vision_service_name>",
"classifications": { "<label>": 0.5 },
"objects": { "<label>": 0.5 }
}
]
}
This example uses a YOLOv8 model named yolo to detect workers without hard hats:
{
"camera": "my_webcam",
"vision_services": [
{
"vision": "yolo",
"objects": {
"NO-Hardhat": 0.6
}
}
]
}
Click Save.
For more details, see the filtered-camera module README.
To verify your confidence threshold, expand the TEST panel on your vision service card and observe the confidence levels for live detections.
Add the data management service to capture and sync filtered images:
data-manager, and click Add component again to confirm.Enable data capture on the filtered camera:
objectfilter-cam panel.0.2 images per second (one image every 5 seconds). Adjust as needed for your use case.Add a trigger to send alerts when filtered images sync:
Click + in the left sidebar and select Trigger.
Enter a name and click Create.
Set Type to Data has been synced to the cloud.
Set Data Types to Binary (image).

Add notification methods:
Email specific addresses: Toggle on, add email addresses, and set the alert frequency.
Email all machine owners: Toggle on and set the alert frequency.
Webhook: Click Add Webhook, enter the URL of your cloud function, and implement logic to process the webhook payload. Use this to integrate with external services like Twilio, PagerDuty, or Zapier.
Set the notification frequency (for example, maximum one alert per hour).
Click Save.
Was this page helpful?
Glad to hear it! If you have any other feedback please let us know:
We're sorry about that. To help us improve, please tell us what we can do better:
Thank you!