Async processing
Use asynchronous report jobs for production workloads. Create a receipt, store jobId, and process completion via webhook.
Start a job
import { Conduit } from "@mappa-ai/conduit"
const conduitClient = new Conduit({ apiKey: process.env.CONDUIT_API_KEY! })
async function startAnalysis(url: string, webhookUrl: string) {
const receipt = await conduitClient.reports.create({
source: { url },
output: { template: "general_report" },
target: { strategy: "dominant" },
webhook: { url: webhookUrl },
})
return receipt.jobId
}
Local-dev fallback
const receipt = await conduitClient.reports.create({
source: { url: "https://example.com/recording.mp3" },
output: { template: "general_report" },
target: { strategy: "dominant" },
})
const report = await receipt.handle?.wait({ timeoutMs: 300_000 })
console.info(report?.id)
Stream progress
for await (const event of receipt.handle?.stream() ?? []) {
if (event.type === "stage") console.info(event.stage, event.progress)
if (event.type === "terminal") break
}