Handle voice calls, transcripts, and summaries in your scripts
Voice call events fire during and after voice calls in your Mirra account. These events provide call metadata, real-time transcriptions, and AI-generated summaries, with support for ticker detection and sentiment analysis in transcripts.
The call.action event fires when a user taps the Mirra button during an active call to request AI follow-up on recent conversation. This event includes recent transcript context for AI processing.
Event Type:
type: 'call.action'source: 'call'
Fields:
content.text (string)
Summary of recent conversation context.
call.agoraCallId (string)
Agora RTC call identifier.
call.mirraCallId (string)
Mirra internal call identifier.
call.chatInstanceId (string)
Associated chat instance ID.
call.participants (CallParticipant[])
Array of participants currently in the call.
call.recentTranscripts (Array)
Recent transcript segments for AI context.
Field
Type
Description
speakerUserId
string
User ID of the speaker
speakerName
string
Display name of the speaker
text
string
Transcribed text
timestamp
Date
When the segment was spoken
call.contextWindowSeconds (number)
How many seconds of recent conversation are included (e.g., 60 = last 60 seconds).
call.currentDurationSeconds (number)
Current call duration at time of action.
call.isRecording (boolean)
True if the call is being recorded.
triggeredBy (object)
Who triggered the action.
Field
Type
Description
userId
string
User ID of the person who tapped the button
username
string
Display name
Example - AI Follow-Up:
export async function handler(event, context) { // Build context from recent transcripts const recentContext = event.call.recentTranscripts .map(t => `${t.speakerName}: ${t.text}`) .join('\n'); // Send summary to the user who triggered the action await mirra.telegram.sendMessage({ chatId: 'your-chat-id', text: `📞 Call Action by ${event.triggeredBy.username}\n\nRecent conversation:\n${recentContext}` }); return { success: true };}
The transcript.chunk event fires when a voice transcript chunk is processed in real-time. This event supports automatic enrichment including ticker detection and sentiment analysis.
Event Type:
type: 'transcript.chunk'source: 'call'
Fields:
content.text (string)
Transcribed text for this chunk.
content.contentType (ContentType)
Always 'transcript' for transcript events.
call.agoraCallId (string)
Call identifier.
call.mirraCallId (string)
Mirra internal call identifier.
transcript.speakerUserId (string)
User ID of the speaker.
transcript.speakerName (string)
Display name of the speaker.
transcript.text (string)
Transcribed text (same as content.text).
transcript.startTimeMs (number)
Start time of this chunk in milliseconds from call start.
transcript.endTimeMs (number)
End time of this chunk in milliseconds from call start.
transcript.confidence (number)
Transcription confidence score from 0 to 1.
enrichment (EventEnrichment | null)
Enrichment data including detected tickers and sentiment. Null until processing completes.
Example - Ticker Tracker:
export async function handler(event, context) { // Wait for enrichment if (!event.enrichment?.tickers) { return { success: true, message: 'No tickers detected' }; } // Track ticker mentions in calls for (const ticker of event.enrichment.tickers) { await mirra.memory.create({ type: 'call_ticker_mention', content: `${ticker.symbol} mentioned by ${event.transcript.speakerName}: ${event.content.text}`, metadata: { ticker: ticker.symbol, confidence: ticker.confidence, speaker: event.transcript.speakerName, callId: event.call.mirraCallId, timestamp: event.transcript.startTimeMs } }); } return { success: true, tickersProcessed: event.enrichment.tickers.length };}