Mirra
Core ConceptsScripts

Event-Driven Scripts

Event-driven scripts automatically execute when specific events occur in your Mirra account. This documentation has been reorganized for easier navigation.


Documentation Structure

The events documentation is now organized by integration source:


Quick Start

Creating an Event Subscription

POST /api/sdk/v1/scripts/{scriptId}/subscriptions
{
  "eventType": "telegram.message",
  "conditions": [
    {
      "field": "content.text",
      "operator": "contains",
      "value": "urgent"
    }
  ]
}

Basic Event Handler

export async function handler(event, context) {
  // Standardized fields work for ANY event type
  const text = event.content.text;
  const sender = event.actor.name;
  const timestamp = event.timestamp;
  
  // Integration-specific fields
  if (event.type === 'telegram.message') {
    const chatId = event.telegram.chatId;
    const isGroup = event.telegram.isGroupChat;
  }
  
  return { success: true };
}

See Also

On this page