Automation

Journey Orchestration for AI Agents

Multi-step email sequences triggered by product events. Define the steps, activate the journey, and Molted Email handles execution, branching, and per-contact tracking.

How it works

1

Create a journey

POST to /v1/journeys with a name and trigger event. The trigger event is a product event name like "user.signed_up" or "trial.ending".

2

Add steps

POST to /v1/journeys/:id/steps to add ordered steps. Four step types are available: send (email), delay (wait), branch (conditional routing), and end (complete the run).

3

Activate the journey

PATCH /v1/journeys/:id with status "active". Only active journeys respond to trigger events.

4

Ingest events

POST to /v1/events/ingest with an event name and contact email. When the event matches a journey trigger, a run is created and the first step executes automatically.

5

Steps execute in sequence

Send steps are policy-evaluated and deduplicated. Delay steps pause the run for a configurable duration. Branch steps route contacts based on field conditions.

6

Track runs per contact

GET /v1/journeys/:id/runs returns all active and completed runs. Duplicate runs for the same journey + contact are automatically prevented.

Build a journey

POST /v1/journeys + POST /v1/journeys/:id/steps

// 1. Create the journey
POST /v1/journeys
{
  "tenantId": "your-tenant-id",
  "name": "Onboarding Sequence",
  "triggerEvent": "user.signed_up"
}

// 2. Add a send step
POST /v1/journeys/:id/steps
{
  "tenantId": "your-tenant-id",
  "stepOrder": 1,
  "stepType": "send",
  "config": {
    "templateId": "onboarding-welcome",
    "dedupeKeyPrefix": "onboarding",
    "payload": { "trialDays": 14 }
  }
}

// 3. Add a delay step
POST /v1/journeys/:id/steps
{
  "tenantId": "your-tenant-id",
  "stepOrder": 2,
  "stepType": "delay",
  "config": { "delayMinutes": 1440 }
}

Step types

Send

Send a policy-evaluated email using a template. Supports deduplication keys and dynamic payload data.

Delay

Pause the run for a configurable number of minutes before proceeding to the next step.

Branch

Evaluate conditions on contact fields and route to different steps based on the result.

End

Mark the journey run as complete. Contacts who reach this step are recorded as finished.

Trigger with events

Ingest a product event and the matching journey starts automatically. Duplicate runs for the same journey + contact are prevented.

POST /v1/events/ingest
{
  "tenantId": "your-tenant-id",
  "eventName": "user.signed_up",
  "contactEmail": "alice@example.com",
  "payload": { "plan": "starter" }
}

Automate your email sequences

Build event-driven journeys with branching logic, delays, and per-contact tracking. Every send is policy-evaluated automatically.