Overview
Triggers allow you to automatically run agents when new videos are uploaded to external platforms. Currently, Mosaic supports YouTube channel monitoring, with more platforms coming soon. When a trigger detects new content, it automatically starts an agent run with the new video, making it perfect for content creators who want to automate their video editing workflows.Each agent supports one YouTube trigger that can monitor multiple channels.
YouTube Triggers
Monitor YouTube channels and automatically process new videos as they’re uploaded.GET /agent/[agent_id]/triggers
Retrieve the YouTube trigger configured for an agent.Response
null if no trigger is configured.
Managing YouTube Channels
POST /agent/[agent_id]/triggers/add_youtube_channels
Add YouTube channels to monitor for new videos. This endpoint:- Creates a new trigger if none exist
- Adds channels to the existing trigger if one already exists
- Supports both channel IDs and channel URLs
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| youtube_channels | string[] | ✅ | YouTube channel IDs or URLs to monitor |
| trigger_callback_url | string | null | ✅ | Webhook URL for trigger notifications (set to null to remove) |
Important:
- If a callback URL already exists, providing a new one will replace it
- Set
trigger_callback_urltonullto remove the webhook URL from the trigger
POST /agent/[agent_id]/triggers/remove_youtube_channels
Stop monitoring specific YouTube channels.Trigger Webhooks
When a trigger detects new content and starts an agent run, webhooks are sent to your configuredcallback_url (if provided when running the agent). These webhooks follow the exact same format as manual agent runs, with the addition of a triggered_by field.
Webhook Payload
The webhook payload format is identical for both manual and triggered runs. The only difference is that triggered runs include the
triggered_by field, while manual API runs do not.Complete Example
Here’s how to set up automatic video processing for a YouTube channel:Use Cases
- Content Repurposing: Automatically create shorts from new long-form videos
- Multi-Language Content: Generate translated versions when new videos are uploaded
- Accessibility: Add captions to all new videos automatically
- Brand Consistency: Apply your brand’s visual style to all new content
Best Practices
- Webhook Reliability: Implement proper webhook handling and error logging
- Channel Selection: Only monitor channels you have permission to process
- Error Handling: Set up alerting for failed agent runs triggered automatically
Limitations
- YouTube triggers check for new videos every 15 minutes
- Only public videos are detected
- Videos must be fully processed by YouTube before triggering
Coming Soon
- Twitter/X video monitoring
- TikTok integration
- Custom RSS feed triggers
- Dropbox/Google Drive folder monitoring