Skip to main content

File upload

Use direct file sources when you want one report from a local file, or upload once to mediaId when you want to reuse the same asset across jobs.

Create a report directly from a local path

import { Conduit } from "@mappa-ai/conduit"

const conduit = new Conduit({ apiKey: process.env.CONDUIT_API_KEY! })

const receipt = await conduit.reports.create({
source: { path: "./recordings/candidate-call.mp3", label: "candidate-call" },
output: { template: "general_report" },
target: { strategy: "dominant" },
webhook: { url: process.env.CONDUIT_WEBHOOK_URL! },
idempotencyKey: "report:candidate-call:v1",
})

console.info(receipt.jobId)

This is the fastest local-file path when you only need one report and already have a verified webhook consumer.

Upload once, reuse later

const media = await conduit.primitives.media.upload({
path: "./recordings/candidate-call.mp3",
label: "candidate-call",
})

const salesReportReceipt = await conduit.reports.create({
source: { mediaId: media.mediaId },
output: { template: "sales_playbook" },
target: { strategy: "dominant" },
webhook: { url: process.env.CONDUIT_WEBHOOK_URL! },
})

console.info(media.mediaId, salesReportReceipt.jobId)

Prefer the mediaId path when you need to:

  • run more than one workflow from the same uploaded asset
  • reuse the asset across reports and matching
  • separate upload time from job creation time

Next steps