Mirra
BuildEvents

Google Docs Events

Google Docs events fire when documents are updated in your connected Google Drive. These events capture document metadata and content snippets, with support for automatic enrichment.


Event Types

google-docs.document_updated

The google-docs.document_updated event fires when a Google Docs document is updated.

Event Type:

type: 'google-docs.document_updated'
source: 'google-docs'

Fields:

content.text (string)

Document content snippet (first 500 characters).

content.contentType (ContentType)

Always 'document' for Google Docs.

docs.documentId (string)

Google Docs document ID.

docs.title (string)

Document title.

docs.contentSnippet (string)

First 500 characters of document content.

docs.mimeType (string)

MIME type (typically 'application/vnd.google-apps.document').

docs.webViewLink (string | null)

URL to view the document in Google Docs.

docs.lastModifiedTime (Date)

When the document was last modified.

enrichment (EventEnrichment | null)

Content enrichment including detected tickers, companies, and topics. Null until processing completes.

Example - Document Change Notification:

export async function handler(event, context) {
  await mirra.telegram.sendMessage({
    chatId: 'your-chat-id',
    text: `📄 Document Updated\n\nTitle: ${event.docs.title}\nLast modified: ${event.docs.lastModifiedTime.toLocaleString()}\n\nView: ${event.docs.webViewLink}`
  });
  
  return { success: true };
}

Example - Content Tracker:

export async function handler(event, context) {
  // Track document changes
  await mirra.memory.create({
    type: 'document_update',
    content: event.docs.contentSnippet,
    metadata: {
      documentId: event.docs.documentId,
      title: event.docs.title,
      modifiedAt: event.docs.lastModifiedTime,
      url: event.docs.webViewLink
    }
  });
  
  return { success: true };
}

Subscription Examples:

// All document updates
{
  "eventType": "google-docs.document_updated"
}
 
// Specific document title
{
  "eventType": "google-docs.document_updated",
  "conditions": [
    {
      "field": "docs.title",
      "operator": "contains",
      "value": "Meeting Notes"
    }
  ]
}

See Also

On this page