agentleFS
lyticslytics/agent-skills/campaign-flow-builder/SKILL.md

campaign-flow-builder

Skill4 starsChanged 7 months agoMITView on GitHub

Guided flow/journey creation from business intent -- multi-step campaigns with delays, conditionals, A/B tests, and exports. Use when the user wants to create a campaign, build a journey, or design a multi-step marketing flow.

  • Sends data out

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 4 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If no suitable segment exists, suggest using audience-builder skill or audience-advisor skill to create one.

    line 49
  2. Distinctive:

    All probabilities from the same source node must sum to 1.0.

    line 190
  3. Distinctive:

    All other IDs are caller-assigned positive integers (must be unique within the flow)

    line 195
  4. Distinctive:

    Use the confirmation-gate pattern.

    line 200
  5. Distinctive:

    After the flow is created in draft state, configure the work/export for each export step:

    line 216
  6. Very specific:

    Important: Only one version of a flow can be running at a time.

    line 241

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Campaign Flow Builder

Purpose

Guides users from business intent ("I want a welcome email series") to a complete, validated flow with entry segments, delays, conditional branches, A/B tests, and export steps. Follows the advisor pattern: understand the goal, suggest structure, iterate, then create.

Flows are the most complex Lytics object -- this skill makes them approachable.

Environment

Requires authenticated API access. See ../references/auth.md for credential resolution.

Flow API Format

Flows use a node-edge graph representation (TranslatedFlow format):

  • Nodes: Steps in the journey (trigger, delay, export, conditional, A/B test, exit)
  • Edges: Connections between steps (with optional conditions or probabilities)

Building a Flow

Step 1: Understand the Campaign Goal

Classify the user's intent:

  • "Welcome email series" -> trigger on segment entry, delays between emails
  • "Re-engagement campaign" -> trigger on lapsed users, conditional check, export
  • "A/B test two offers" -> trigger, A/B split, two export paths
  • "Multi-channel nurture" -> trigger, delays, conditionals, multiple export channels

Ask:

  • What triggers entry? (entering a segment, being in a segment)
  • How many steps/touchpoints?
  • Any branching logic? (VIP vs standard, engaged vs not)
  • What timing between steps?
  • Can users re-enter?

Step 2: Verify Entry Segment

The flow needs a trigger segment. Check if it exists:

curl -s "${LYTICS_API_URL:-https://api.lytics.io}/v2/segment?table=user&sizes=true" \
  -H "Authorization: ${LYTICS_API_TOKEN}"

If no suitable segment exists, suggest using audience-builder skill or audience-advisor skill to create one.

Step 3: Design the Flow Structure

Present a visual text diagram of the proposed flow:

TRIGGER: On entry to "New Signups" segment
  |
  v
[Send Welcome Email] (export)
  |
  v
[Wait 3 days] (delay)
  |
  v
[Opened Welcome?] (conditional split)
  |           |
  YES         NO
  |           |
  v           v
[Send Offer] [Send Reminder]
  |           |
  v           v
[EXIT]       [EXIT]

Iterate with the user until they're happy with the structure.

Step 4: Build the Flow Payload

Node Types

Trigger (always sequence_id: 0):

{
  "sequence_id": 0,
  "type": "trigger",
  "entry_segment_id": "segment-uuid-here",
  "entry_condition": "on_segment_entry",
  "reentry_allowed": false,
  "reentry_delay": 86400
}

Entry conditions:

  • "on_segment_entry" -- fires when user enters the segment (event-based, most common)
  • "in_segment" -- fires for users currently in the segment (snapshot)

Reentry delay is in seconds. Minimum is 3600 (1 hour).

Export (send to external platform):

{
  "sequence_id": 1000,
  "type": "export",
  "label": "Send Welcome Email",
  "work_config": {}
}

The work_config is configured separately after flow creation via the work endpoint.

Delay (wait between steps):

{
  "sequence_id": 2000,
  "type": "delay",
  "label": "Wait 3 days",
  "delay": 259200000000000
}

Delay is in nanoseconds. Common values:

  • 1 hour: 3600000000000
  • 24 hours: 86400000000000
  • 3 days: 259200000000000
  • 7 days: 604800000000000

Optional: delay_condition (FilterQL) -- proceed only when condition is met. Optional: delay_until_enters (array of segment IDs) -- wait until user enters all listed segments.

Conditional Split (if/else branching):

{
  "sequence_id": 3000,
  "type": "conditional_split",
  "label": "Opened Welcome?"
}

Conditions are defined on the edges, not the node. See Edges section.

A/B Test (random split):

{
  "sequence_id": 4000,
  "type": "ab_test",
  "label": "50/50 Test"
}

Probabilities are defined on the edges. Must sum to 1.0.

Exit (end of flow):

{
  "sequence_id": 9999,
  "type": "exit"
}

Edge Types

Simple connection:

{"id": "0-1000", "source": 0, "target": 1000, "type": "connected"}

Conditional split edge (with FilterQL):

{
  "id": "3000-4000",
  "source": 3000,
  "target": 4000,
  "type": "connected",
  "condition": {
    "definition": "FILTER AND (email_opened = true) FROM user",
    "label": "Yes",
    "priority": 2
  }
}

Higher priority numbers are checked first. The default/fallback edge should have "definition": "" and "priority": 1.

A/B test edge (with probability):

{
  "id": "4000-5000",
  "source": 4000,
  "target": 5000,
  "type": "connected",
  "probability": 0.5
}

All probabilities from the same source node must sum to 1.0.

Step ID Assignment

  • Trigger is always sequence_id: 0
  • All other IDs are caller-assigned positive integers (must be unique within the flow)
  • Convention: use multiples of 1000 (1000, 2000, 3000) for readability

Step 5: Confirm and Create

Use the confirmation-gate pattern. Show:

  • Flow diagram (text visual)
  • Entry segment name and size
  • Step count and types
  • Timing summary
  • Raw API payload
curl -s -X POST "${LYTICS_API_URL:-https://api.lytics.io}/v2/flow/ui" \
  -H "Authorization: ${LYTICS_API_TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{ ... flow payload ... }'

Step 6: Configure Export Steps

After the flow is created in draft state, configure the work/export for each export step:

curl -s -X POST "${LYTICS_API_URL:-https://api.lytics.io}/v2/flow/ui/${FLOW_ID}/step/${STEP_ID}/work" \
  -H "Authorization: ${LYTICS_API_TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{ ... work configuration ... }'

Then publish the work:

curl -s -X POST "${LYTICS_API_URL:-https://api.lytics.io}/v2/flow/ui/${FLOW_ID}/step/${STEP_ID}/work/publish" \
  -H "Authorization: ${LYTICS_API_TOKEN}"

Step 7: Activate the Flow

Once all export steps have published work, activate the flow:

curl -s -X POST "${LYTICS_API_URL:-https://api.lytics.io}/v2/flow/ui/${FLOW_ID}" \
  -H "Authorization: ${LYTICS_API_TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{"state": "running"}'

Important: Only one version of a flow can be running at a time. Publishing a new version automatically sets the old one to draining.

Common Campaign Patterns

Welcome Series

TRIGGER (on_segment_entry: "New Signups")
  -> [Send Welcome] -> [Wait 3d] -> [Send Tips] -> [Wait 7d] -> [Send Offer] -> EXIT

Re-engagement

TRIGGER (in_segment: "Lapsed 30d")
  -> [Send Win-Back] -> [Wait 7d]
  -> CONDITIONAL (opened email?)
     YES -> [Send Discount] -> EXIT
     NO  -> [Send Final Notice] -> EXIT

A/B Test

TRIGGER (on_segment_entry: "Trial Users")
  -> [Wait 1d]
  -> A/B TEST (50/50)
     A -> [Send Offer A] -> EXIT
     B -> [Send Offer B] -> EXIT

Multi-Channel Nurture

TRIGGER (on_segment_entry: "High Intent")
  -> [Send Email] -> [Wait 2d]
  -> CONDITIONAL (converted?)
     YES -> EXIT
     NO  -> [Push Notification] -> [Wait 3d]
           -> [Retarget on Facebook] -> EXIT

Flow States

StateDescriptionCan Edit?
draftNot active, fully editableYes -- add/remove/modify steps
runningActive, processing usersLimited -- can update work_config, labels, conditions; cannot add/remove steps
drainingWinding down, no new entriesSame as running
deletedPermanently deletedNo

Error Handling

  • Invalid FilterQL in conditions: Validate conditions before creating the flow
  • Probabilities don't sum to 1.0: Adjust and retry
  • Entry segment not found: Help create one with audience-builder
  • Duplicate step IDs: Regenerate with unique values
  • Missing work config: Guide through export step configuration

Dependencies

  • Composes: segment-manager skill, audience-builder skill, job-manager skill
  • References: ../references/filterql-grammar.md, ../references/confirmation-gate.md, ../references/auth.md, ../references/api-client.md

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.