šŸ‘¾ Code

Luma Event Attendees Fetcher

Fetches attendee list from a Luma event using cookie-based authentication. Retrieves guest names, emails, approval status, and registration data from api2.luma.com endpoint.

Source Code


              const [eventInput] = process.argv.slice(2);

if (!eventInput) {
  console.error("Event ID or URL is required");
  throw new Error("Missing event identifier");
}

// Extract event ID from input (supports both raw ID and full URL)
let eventId = eventInput;
const eventIdMatch = eventInput.match(/evt-[a-zA-Z0-9]+/);
if (eventIdMatch) {
  eventId = eventIdMatch[0];
}

if (!eventId.startsWith("evt-")) {
  console.error(`Invalid event ID format: ${eventInput}`);
  throw new Error("Event ID must start with 'evt-'");
}

console.log(`Fetching attendees for Luma event: ${eventId}`);

// Hardcoded cookie from slice documentation
const LUMA_COOKIE =
  "__stripe_mid=588eff62-04c6-4d1f-8b3e-79c32473b15bc7d41c; luma.evt-JWQLBSkGWnuaADY.registered-with=usr-3LEWr3lyQSCOFkQ; luma.auth-session-key=usr-3LEWr3lyQSCOFkQ.08gl83p3j2a9yqcae4j8; luma.evt-sTJB1vG5ovVhnWm.registered-with=usr-3LEWr3lyQSCOFkQ; luma.evt-XVJmNwrFOIYxZX1.registered-with=usr-3LEWr3lyQSCOFkQ; luma.evt-ZxCl3Vtn5SNcoLH.registered-with=usr-3LEWr3lyQSCOFkQ; luma.evt-qswNTyuE7T5QwLb.registered-with=usr-3LEWr3lyQSCOFkQ; luma.evt-Bk2BNV9DvC99D8p.registered-with=usr-3LEWr3lyQSCOFkQ; luma.did=16vywvlkxqnl92c5vk5g1h9j9j67dj; luma.first-page=%2Fka2o8dzo; __stripe_sid=45525520-b2de-4476-b916-3dad3d6a1acedd8ea7; luma.native-referrer=https%3A%2F%2Fluma.com%2Fcalendar%2Fmanage%2Fcal-G9niBUMKeNUTm4O%2Fevents%3Fe%3Dcalev-wcMNhNFvllMsuxv; __cf_bm=b_x4xwOpG0IkaEphBO6177AsySg11A2FpSD14dHezRY-1764138490-1.0.1.1-VrYx4Ph6IwshFAlPiYEMiFEd_v4QP9l96nIra9OlhPvMmHaYOfVOPvp0xqj07y02elGPUiml0E8_AhuTDOASFLZvChySZFFj7ej1tmlFVhA";

try {
  // Build API URL with query parameters
  const url = `https://api2.luma.com/event/admin/get-guests?event_api_id=${eventId}&pagination_limit=100&query=&sort_column=registered_or_created_at&sort_direction=desc`;

  console.log(`Making request to: ${url}`);

  const response = await fetch(url, {
    method: "GET",
    headers: {
      accept: "*/*",
      cookie: LUMA_COOKIE,
      "x-luma-client-type": "luma-web",
      origin: "https://luma.com",
      referer: "https://luma.com/",
    },
  });

  if (!response.ok) {
    const errorBody = await response.text();
    console.error(`Request failed with status ${response.status}`);
    console.error(`Response: ${errorBody}`);

    if (response.status === 401 || response.status === 403) {
      throw new Error(
        "Authentication failed. Cookie may be expired or you don't have access to this event."
      );
    } else if (response.status === 404) {
      throw new Error(`Event not found: ${eventId}`);
    } else {
      throw new Error(`API request failed: ${response.status}`);
    }
  }

  const data = await response.json();

  // Parse and display attendees
  const entries = data.entries || [];
  console.log(`\nāœ“ Total Attendees: ${entries.length}\n`);

  if (entries.length === 0) {
    console.log("No attendees found for this event.");
  } else {
    console.log("Attendee List:");
    console.log("─".repeat(80));

    entries.forEach((guest, index) => {
      const name = guest.name || "N/A";
      const email = guest.email || "N/A";
      const twitter = guest.twitter_handle || "N/A";
      const status = guest.approval_status || "N/A";

      console.log(`${index + 1}. ${name} (${email}) (${twitter} on Twitter/X) - ${status}`);
    });

    console.log("─".repeat(80));
  }

  // Summary statistics
  const statusCounts = {};
  entries.forEach((guest) => {
    const status = guest.approval_status || "unknown";
    statusCounts[status] = (statusCounts[status] || 0) + 1;
  });

  if (Object.keys(statusCounts).length > 0) {
    console.log("\nStatus Summary:");
    Object.entries(statusCounts).forEach(([status, count]) => {
      console.log(`  ${status}: ${count}`);
    });
  }

  console.log("\nāœ“ Successfully fetched attendee data");
} catch (error) {
  console.error("\nāœ— Error fetching attendees:", error.message);
  throw error;
}