Skip to main content
This guide walks you through creating a deck, adding slides, configuring branding, and generating a personalized presentation for a homeowner.

Prerequisites

  • A Sales CoPilot account with API access
  • Your login credentials (email and password)

Authenticate

Start by logging in to get a session cookie:
const response = await fetch("https://app.demandiq.com/api/auth/login", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    email: "sales@acmeroofing.com",
    password: "your-password",
  }),
});
// The session cookie is set automatically

Create a deck

Create a new presentation deck with a name and optional context for AI narration:
const deck = await fetch("https://app.demandiq.com/api/decks", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    name: "Solar Roof Pitch",
    description: "Standard residential solar sales deck",
    type: "structured",
    deckContext: "Acme Solar installs residential solar panels in the Denver metro area.",
  }),
}).then((r) => r.json());

Add slides

Add slides to your deck with narration scripts. Use {{first_name}} and other tokens for personalization:
await fetch(`https://app.demandiq.com/api/decks/${deck.deck.id}/slides`, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    slideId: "welcome",
    title: "Welcome to Your Solar Journey",
    narrationScript:
      "Hi {{first_name}}, thanks for taking the time to learn about going solar with Acme Solar.",
    bullets: [
      "Personalized proposal based on your home",
      "Transparent pricing with no hidden fees",
      "25-year performance warranty",
    ],
  }),
});

Configure branding

Set your company colors, logo, and call-to-action:
await fetch(`https://app.demandiq.com/api/decks/${deck.deck.id}/branding`, {
  method: "PUT",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    name: "Acme Solar",
    palette: {
      primary: "#1a73e8",
      primaryLight: "#4a90d9",
      accent: "#ff6b35",
      neutral: "#f5f5f5",
      text: "#333333",
    },
    cta: {
      headline: "Ready to go solar?",
      body: "Schedule your free consultation today.",
      buttonText: "Get started",
    },
  }),
});

Generate a presentation

Create a personalized presentation for a homeowner:
const presentation = await fetch(
  `https://app.demandiq.com/api/decks/${deck.deck.id}/presentations`,
  {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({
      homeowner: {
        first_name: "Sarah",
        last_name: "Johnson",
        address: "123 Main St",
        city: "Denver",
        state: "CO",
        zip: "80202",
        country: "US",
        email: "sarah@example.com",
      },
    }),
  }
).then((r) => r.json());

// Share this URL with the homeowner
console.log(presentation.url);

Poll for status

Audio generation runs asynchronously. Poll the status endpoint until the presentation is ready:
let status = "pending";
while (status !== "ready" && status !== "failed") {
  const result = await fetch(
    `https://app.demandiq.com/api/presentations/${presentation.deck_presentation_id}/status`
  ).then((r) => r.json());
  status = result.status;
  if (status !== "ready") await new Promise((r) => setTimeout(r, 2000));
}

Next steps

  • Add FAQs to your deck so the AI can answer common homeowner questions
  • Configure notification subscriptions to get webhooks when homeowners view slides or sign contracts
  • Upload your company’s knowledge base documents to improve Q&A answer quality