Mirra
BuildEvents

Google Drive Events

Google Drive events fire when files are updated in your connected Google Drive. These events capture file metadata including size, owners, and modification times.


Event Types

google-drive.file_updated

The google-drive.file_updated event fires when a file in Google Drive is updated.

Event Type:

type: 'google-drive.file_updated'
source: 'google-drive'

Fields:

content.text (string)

File name.

drive.fileId (string)

Google Drive file ID.

drive.fileName (string)

File name with extension.

drive.mimeType (string)

File MIME type (e.g., 'application/pdf', 'image/png').

drive.size (number)

File size in bytes.

drive.webViewLink (string | null)

URL to view the file in Google Drive.

drive.thumbnailLink (string | null)

URL to file thumbnail if available.

drive.lastModifiedTime (Date)

When the file was last modified.

drive.owners (Array)

Array of file owners with display name and email address.

Example - File Update Notification:

export async function handler(event, context) {
  const sizeKB = (event.drive.size / 1024).toFixed(2);
  
  await mirra.telegram.sendMessage({
    chatId: 'your-chat-id',
    text: `📁 File Updated\n\nName: ${event.drive.fileName}\nSize: ${sizeKB} KB\nType: ${event.drive.mimeType}\n\nView: ${event.drive.webViewLink}`
  });
  
  return { success: true };
}

Example - Large File Alert:

export async function handler(event, context) {
  const sizeMB = event.drive.size / (1024 * 1024);
  
  // Alert for files over 10MB
  if (sizeMB > 10) {
    await mirra.telegram.sendMessage({
      chatId: 'admin-channel',
      text: `⚠️ Large file detected: ${event.drive.fileName} (${sizeMB.toFixed(2)} MB)`
    });
  }
  
  return { success: true };
}

Subscription Examples:

// All file updates
{
  "eventType": "google-drive.file_updated"
}
 
// PDF files only
{
  "eventType": "google-drive.file_updated",
  "conditions": [
    {
      "field": "drive.mimeType",
      "operator": "equals",
      "value": "application/pdf"
    }
  ]
}
 
// Large files
{
  "eventType": "google-drive.file_updated",
  "conditions": [
    {
      "field": "drive.size",
      "operator": "greater_than",
      "value": 10485760
    }
  ]
}

See Also

On this page