Core concepts βοΈ
Understand the key concepts that power Mappa. This will help you build better integrations and avoid common pitfalls.
Think of it like a photo lab. Developing the film (transcription) takes time, but once it's done, you can print unlimited copies instantly. Same hereβprocess once, generate unlimited reports.
Two-Stage architectureβ
Mappa separates media processing from report generation:
Stage 1: media processing (once per file)β
Upload β Transcribe β Detect Speakers β Extract Voiceprints β COMPLETED
What happens:
- Audio transcribed with speaker diarization
- Behavioral voiceprints extracted for each speaker
- Entity records created for tracking
Duration: ~1 minute for 30-minute audio
Status: Track via processingStatus field
Cost: 1 credit per minute of media (see Pricing)
Stage 2: report generation (on demand)β
Select Speaker β Apply Template β Generate Insights β Render Output
What happens:
- Uses cached transcription and voiceprints
- AI analyzes based on selected template
- Returns formatted report
Duration: 10-30 seconds
Status: Track via job status
Cost: 10 credits per report (see Pricing)
Why this mattersβ
Once media is processed, you can:
- Generate unlimited reports instantly
- Analyze different speakers without reprocessing
- Try different templates on the same media
- Save credits by reusing processed files
Example:
// Upload once
const file = await mappa.files.upload({ file: "./interview.mp4" });
// Generate multiple reports from same media
const candidateReport = await mappa.reports.generate({
media: { mediaId: file.mediaId },
output: { template: "hiring_report" },
target: { strategy: "magic_hint", hint: "the candidate" },
});
const interviewerReport = await mappa.reports.generate({
media: { mediaId: file.mediaId },
output: { template: "general_report" },
target: { strategy: "magic_hint", hint: "the interviewer" },
});
Processing statusesβ
Track media processing with the processingStatus field:
| Status | What It Means | What to Do |
|---|---|---|
PENDING | Queued for processing | Waitβit'll start soon |
PROCESSING | Currently being processed | Poll every 5-10 seconds |
COMPLETED | Ready for reports | Create report jobs |
FAILED | Something went wrong | Check processingError |
Checking status:
const file = await mappa.files.get(mediaId);
if (file.processingStatus === "COMPLETED") {
// Ready to go!
const job = await mappa.reports.createJob({
media: { mediaId },
output: { template: "general_report" },
target: { strategy: "dominant" },
});
}
The SDK does not expose a dedicated waitForProcessing() helper. Poll mappa.files.get(mediaId) until processingStatus === "COMPLETED".
Jobsβ
A job represents a report generation task. Jobs run asynchronouslyβcreate them, then wait for completion.
Job lifecycleβ
Create β queued/running β succeeded
Job statusesβ
| Status | Description |
|---|---|
queued | Waiting to start |
running | Currently generating |
succeeded | Report ready |
failed | Something failed |
canceled | Job was canceled |
Monitoring a job:
const job = await mappa.reports.createJob({
media: { mediaId: "media_123" },
output: { template: "general_report" },
target: { strategy: "dominant" },
webhook: { url: "https://yourapp.com/webhooks/mappa" },
});
// Or poll manually
const handle = job.handle ?? mappa.reports.makeHandle(job.jobId);
const result = await handle.wait();
Use webhooks instead of polling! See Webhooks for real-time notifications.
Reportsβ
Reports are the final outputβbehavioral insights in your chosen format.
Output typesβ
| Type | Returns | Use Case |
|---|---|---|
markdown | Markdown string | Display in apps, save to database |
json | Structured data | Parse programmatically |
pdf | PDF download URL | Share with stakeholders |
url | Hosted report page | Quick sharing |
Templatesβ
Choose a template based on your use case:
| Template | Use For | Parameters |
|---|---|---|
general_report | Comprehensive profile | None |
sales_playbook | Sales strategies | None |
hiring_report | Role/culture fit | roleTitle, roleDescription, companyCulture |
profile_alignment | Match against ideal | idealProfile |
Speaker targetingβ
Multi-speaker recordings need speaker selection. Quick overview:
| Strategy | When to Use |
|---|---|
dominant | Single speaker or obvious primary |
magic_hint | Multi-speaker with known roles (π Recommended) |
entity_id | Tracking same person across recordings |
timerange | Specific conversation segments |
Example:
{
target: {
strategy: "magic_hint",
hint: "the job candidate being interviewed"
}
}
Learn targeting strategies β
Entitiesβ
Mappa creates an entity for each detected speakerβa persistent ID you can track across recordings.
What is an entity?
- Unique ID (e.g.,
ent_abc123) - Behavioral voiceprint stored by Mappa
- Reusable across multiple media files
Why use entity IDs?
- Track same person across interviews/sessions
- Skip speaker identification
- Build speaker libraries
Example:
// First interview
const report1 = await mappa.reports.generate({
target: { strategy: "magic_hint", hint: "the candidate" },
});
const entityId = report1.entity?.id; // "ent_abc123"
// Second interview - use entity ID
const report2 = await mappa.reports.generate({
target: { strategy: "entity_id", entityId: entityId },
});
Advanced entity management β
Creditsβ
Credits are Mappa's currency. Media processing costs 1 credit per minute; each report costs 10 credits. See Pricing for details.
How credits workβ
Create Job β Reserve β Process β Charge Actual β Release Excess
Your balance:
- Balance: Total credits
- Reserved: Locked for active jobs
- Available: What you can spend now
const { available } = await mappa.credits.getBalance();
console.info(`You can create jobs worth ${available} credits`);
Save creditsβ
- Submit feedback - Get 5 credits back per report (50% of report cost)
- Reuse processed media - Generate multiple reports from one file
- Track entities - Skip re-analysis for known speakers
Credit optimization strategies β
What's next? πβ
Ready to build?
- Node.js SDK - Install and configure the SDK
- Speaker Targeting - Master targeting strategies
- Webhooks - Get real-time notifications
Deep dives:
- Production Guide - Best practices for shipping
- Error Handling - Handle failures gracefully
- Examples - Copy-paste code for common tasks