Mirra
Building with MirraScriptsEvents Reference

Recording Events

Handle audio recording uploads and transcriptions in your scripts

Recording events fire when audio recordings are uploaded to group chats and when transcription completes. These events enable you to build workflows around meeting recordings, including automatic summarization, note generation, and archival.


Event Types

recording.uploaded

The recording.uploaded event fires when a user uploads an audio recording to a group chat. This event provides file metadata and participant information.

Event Type:

type: 'recording.uploaded'
source: 'recording'

Fields:

content.text (string)

Recording filename or upload message.

content.contentType (ContentType)

Always 'transcript' for recording events.

recording.s3Key (string)

S3 storage key for the recording file.

recording.cdnUrl (string)

CDN URL for accessing the recording.

recording.mimeType (string)

Audio MIME type (e.g., 'audio/webm', 'audio/mp4').

recording.duration (number)

Recording duration in seconds.

recording.fileSize (number)

File size in bytes.

recording.filename (string)

Original filename.

recording.messageId (string)

Chat message ID associated with the upload.

recording.chatInstanceId (string)

Chat instance where the recording was uploaded.

recording.groupId (string)

Group ID where the recording was uploaded.

recording.participants (Array | undefined)

Optional list of participants in the recording.

FieldTypeDescription
namestringParticipant display name
userIdstring | undefinedMirra user ID if known

Example - Upload Notification:

export async function handler(event, context) {
  const durationMin = Math.round(event.recording.duration / 60);
  const sizeMB = (event.recording.fileSize / (1024 * 1024)).toFixed(2);
 
  await mirra.telegram.sendMessage({
    chatId: 'your-chat-id',
    text: `🎙️ Recording Uploaded\n\nFile: ${event.recording.filename}\nDuration: ${durationMin} min\nSize: ${sizeMB} MB\nGroup: ${event.recording.groupId}`
  });
 
  return { success: true };
}

Subscription Examples:

// All recording uploads
{
  "eventType": "recording.uploaded"
}
 
// Long recordings only (over 10 minutes)
{
  "eventType": "recording.uploaded",
  "conditions": [
    {
      "field": "recording.duration",
      "operator": "greater_than",
      "value": 600
    }
  ]
}

recording.transcribed

The recording.transcribed event fires after transcription and speaker diarization complete for a recording. This event provides the full transcript text and detected speakers. Use this to build summarization, note-taking, or archival workflows.

Event Type:

type: 'recording.transcribed'
source: 'recording'

Fields:

content.text (string)

Full transcript text.

recording.recordingId (string)

Unique recording identifier.

recording.s3Key (string)

S3 storage key for the original recording.

recording.duration (number)

Recording duration in seconds.

recording.participantCount (number)

Number of detected participants/speakers.

recording.segmentCount (number)

Number of transcript segments.

recording.chatInstanceId (string)

Chat instance associated with the recording.

recording.groupId (string)

Group where the recording was uploaded.

transcript.text (string)

Full plain-text transcript with speakers and timestamps.

transcript.speakers (string[])

Array of unique speaker names detected in the recording.

Example - Transcript Summary:

export async function handler(event, context) {
  const durationMin = Math.round(event.recording.duration / 60);
 
  // Send transcript summary to Telegram
  const preview = event.transcript.text.substring(0, 500);
 
  await mirra.telegram.sendMessage({
    chatId: 'your-chat-id',
    text: `📝 Recording Transcribed\n\nDuration: ${durationMin} min\nSpeakers: ${event.transcript.speakers.join(', ')}\nSegments: ${event.recording.segmentCount}\n\nPreview:\n${preview}...`
  });
 
  return { success: true };
}

Example - Meeting Notes to Spreadsheet:

export async function handler(event, context) {
  await mirra.google.sheets.appendRow({
    spreadsheetId: 'your-sheet-id',
    sheetName: 'Transcripts',
    values: [
      new Date().toISOString(),
      event.recording.groupId,
      event.transcript.speakers.join(', '),
      event.recording.participantCount,
      Math.round(event.recording.duration / 60),
      event.recording.segmentCount,
      event.transcript.text.substring(0, 1000)
    ]
  });
 
  return { success: true };
}

Subscription Examples:

// All transcriptions
{
  "eventType": "recording.transcribed"
}
 
// Multi-speaker recordings only
{
  "eventType": "recording.transcribed",
  "conditions": [
    {
      "field": "recording.participantCount",
      "operator": "greater_than",
      "value": 1
    }
  ]
}

See Also

On this page