Journeys

Journey surfaces are the same API family used by the WYSIWYG Journey Builder.

SDK Flow

import { createVoyageClient } from "@voyage/sdk";
import { defaultJourneyConfig } from "@voyage/journey-runtime/core";

const voyage = createVoyageClient({
  baseUrl: "https://api.example.com",
  tenantSlug: "acme-events",
  apiKey: process.env.VOYAGE_API_KEY ?? "vyg_live_xxx",
});

const config = defaultJourneyConfig("event");

const draft = await voyage.journeys.create({
  type: "event",
  slug: "private-preview",
  eventId: "evt_123",
  config: {
    ...config,
    name: "Private preview",
    _eventId: "evt_123",
  },
});

const updated = await voyage.journeys.update(draft.journeyId, {
  slug: "private-preview",
  eventId: "evt_123",
  config: {
    ...draft.configJson,
    customText: {
      ...draft.configJson.customText,
      confirmationTitle: "You are registered",
    },
  },
});

const live = await voyage.journeys.publish(updated.journeyId, {
  version: updated.version,
  publishTargets: updated.configJson.publishTargets,
});

console.log(live.publicUrl);

Endpoint Summary

SDK method Route Notes
journeys.list() GET /v1/journeys Supports page, limit, type, status
journeys.create() POST /v1/journeys Creates version 1 draft
journeys.get() GET /v1/journeys/{journeyId} Optional version query
journeys.update() POST /v1/journeys/{journeyId} Creates a new draft version
journeys.publish() POST /v1/journeys/{journeyId}/publish Makes a version live
journeys.listBookingLinks() GET /v1/journeys/booking-links Staff personal booking links
journeys.updateBookingLink() PATCH /v1/journeys/booking-links/{staffId} Updates slug/enabled

Journey Config

Use @voyage/journey-runtime/core for JourneyConfig types and defaults. The worker validates:

  • Type: appointment, event, or queue.
  • Status: draft or live; saves normalize to draft, publishes normalize to live.
  • Slug: lowercase letters/numbers with hyphen separators.
  • Publish targets: max 20.
  • Staff roster: max 100.

For event registration journeys, set either:

  • top-level create/update eventId, or
  • config _eventId.

The public registration route returns JOURNEY_EVENT_REQUIRED if no event is bound.