Client: leads

Recording a lead against a project.

Browser or server Embed key in the browser, integration key on the server dev · https://api.dev.oprag.ai
TypeScript
const { leadId } = await oprag.leads.create({
  projectId: "proj_abc123",
  visitorId,
  name: "Ada Lovelace",
  email: "ada@example.com",
  conversationId,
  sourceQuestion: "Do you offer volume pricing?",
});
FieldRequiredDescription
projectIdYesProject the lead belongs to.
visitorIdYesThe same visitor id sent with the chat turn.
name / emailNoWhatever the form collected.
conversationIdNoTies the lead to its conversation in the dashboard.
sourceQuestionNoThe question that triggered the capture.

When a chat.ask returns the lead_capture_prompt branch, render promptMessage and fields, then submit what you collect here. Underneath: POST /v1/projects/{projectId}/leads.

Ready to ship?

Get started free