AgentSkillsCN

Lead Generation

潜在客户开发

SKILL.md

Skill: Lead Generation Funnel

References: _SHARED.md for all ontology definitions, mutation signatures, node types, and link types.


1. Purpose

This skill builds a complete lead generation funnel deployment for an agency's client. The deployment captures leads through a landing page with an embedded registration form, creates CRM contacts with pipeline tracking, sends confirmation emails, syncs contacts to ActiveCampaign for ongoing marketing, and enrolls each new lead into a Soap Opera email sequence that nurtures them over seven days. The outcome is a fully automated system where qualified leads flow into the CRM with pipeline stage progression, while unqualified leads receive nurture content until they are ready to engage. The three-layer relationship applies: the L4YERCAK3 platform provides the infrastructure, the agency configures and deploys the funnel for their client, and the client's end customers are the leads entering the funnel.


2. Ontologies Involved

Objects (objects table)

typesubtypecustomProperties used
crm_contactleadfirstName, lastName, email, phone, companyName, contactType, tags, pipelineStageId, pipelineDealValue, customFields
formregistrationfields (array of field objects), formSettings (redirect URL, notifications), submissionWorkflow
productdigitalproductCode, description, price (cents), currency, taxBehavior -- only for paid lead magnet variant
projectcampaignprojectCode, description, status, startDate, endDate
layer_workflowworkflowFull LayerWorkflowData: nodes, edges, metadata, triggers
automation_sequencenachherSteps array with channel, timing, content
builder_apptemplate_basedLanding page and thank-you page files

Object Links (objectLinks table)

linkTypesourceObjectIdtargetObjectId
workflow_formworkflow (lead capture)form (registration)
workflow_sequenceworkflow (lead capture)sequence (soap opera)
product_formproduct (lead magnet)form (registration) -- paid variant only
checkout_productcheckout transactionproduct -- paid variant only
project_contactprojectCRM contact (client stakeholder)

3. Builder Components

Landing Page

The Builder generates a single-page landing page (builder_app, subtype: template_based) with these sections:

  1. Hero Section -- Headline (StoryBrand: external problem statement), subheadline (the transformation promise), primary CTA button ("Get Your Free [Lead Magnet Name]").
  2. Form Embed Section -- Embedded registration form (see Form below). The form renders inline on the page.
  3. Social Proof Section -- Testimonial cards (2-3 quotes), trust badges, client logos or statistics ("500+ businesses trust us").
  4. Brief Benefits Section -- 3-4 bullet points explaining what the lead magnet contains.
  5. Footer -- Privacy policy link, agency branding.

File: /builder/landing-page/index.html (or framework equivalent via scaffold generator)

Thank-You Page

Displayed after form submission (configured via formSettings.redirectUrl):

  1. Confirmation Message -- "Check your inbox for [Lead Magnet Name]."
  2. Lead Magnet Delivery -- Direct download link or "We've emailed it to you" message.
  3. Next Step CTA -- Secondary offer or booking link ("Want faster results? Book a free consultation").
  4. Social Sharing -- Optional share buttons.

File: /builder/thank-you-page/index.html

Registration Form

Object: type: "form", subtype: "registration"

Fields array:

json
[
  { "type": "email",   "label": "Email Address",     "required": true,  "placeholder": "you@company.com" },
  { "type": "text",    "label": "First Name",        "required": true,  "placeholder": "Jane" },
  { "type": "text",    "label": "Last Name",         "required": false, "placeholder": "Smith" },
  { "type": "phone",   "label": "Phone Number",      "required": false, "placeholder": "+1 (555) 000-0000" },
  { "type": "text",    "label": "Company Name",      "required": false, "placeholder": "Acme Corp" },
  { "type": "select",  "label": "Biggest Challenge",  "required": true,  "options": ["Option A", "Option B", "Option C", "Other"] }
]

formSettings:

json
{
  "redirectUrl": "/thank-you",
  "notifications": { "adminEmail": true, "respondentEmail": true },
  "submissionBehavior": "redirect"
}

Customization note: The "Biggest Challenge" select field is the qualifying question. Its label and options MUST be adapted to the client's industry. See Section 8.


4. Layers Automations

Workflow 1: Lead Capture (Required)

Object: type: "layer_workflow", subtype: "workflow", name: "Lead Capture Workflow"

Trigger: trigger_form_submitted

Nodes:

idtypelabelconfigstatus
trigger-1trigger_form_submitted"Form Submitted"{ "formId": "<FORM_ID>" }ready
crm-1lc_crm"Create Lead Contact"{ "action": "create-contact", "contactType": "lead", "tags": ["lead-magnet", "<CAMPAIGN_TAG>"], "mapFields": { "email": "{{trigger.email}}", "firstName": "{{trigger.firstName}}", "lastName": "{{trigger.lastName}}", "phone": "{{trigger.phone}}", "companyName": "{{trigger.companyName}}", "customFields": { "biggestChallenge": "{{trigger.biggestChallenge}}" } } }ready
email-1lc_email"Send Confirmation Email"{ "action": "send-confirmation-email", "to": "{{crm-1.output.email}}", "subject": "Here's your [Lead Magnet Name]", "body": "Hi {{crm-1.output.firstName}},\n\nThanks for requesting [Lead Magnet Name]. Download it here: [LINK]\n\nOver the next few days, I'll share some insights that will help you [desired outcome].\n\nTalk soon,\n[Sender Name]" }ready
ac-1activecampaign"Sync to ActiveCampaign"{ "action": "add_contact", "email": "{{crm-1.output.email}}", "firstName": "{{crm-1.output.firstName}}", "lastName": "{{crm-1.output.lastName}}" }ready
ac-2activecampaign"Tag in ActiveCampaign"{ "action": "add_tag", "contactEmail": "{{crm-1.output.email}}", "tag": "lead-magnet-<CAMPAIGN_TAG>" }ready
ac-3activecampaign"Add to AC List"{ "action": "add_to_list", "contactEmail": "{{crm-1.output.email}}", "listId": "<AC_LIST_ID>" }ready
crm-2lc_crm"Set Pipeline Stage"{ "action": "move-pipeline-stage", "contactId": "{{crm-1.output.contactId}}", "pipelineStageId": "new_lead" }ready

Edges:

idsourcetargetsourceHandletargetHandle
e-1trigger-1crm-1outputinput
e-2crm-1email-1outputinput
e-3crm-1ac-1outputinput
e-4ac-1ac-2outputinput
e-5ac-2ac-3outputinput
e-6crm-1crm-2outputinput

Node positions (canvas layout):

idxy
trigger-1100200
crm-1350200
email-1600100
ac-1600300
ac-2850300
ac-31100300
crm-2600500

Mutations to execute:

  1. createWorkflow({ sessionId, name: "Lead Capture Workflow", description: "Captures form submissions, creates CRM leads, sends confirmation, syncs to ActiveCampaign" })
  2. saveWorkflow({ sessionId, workflowId: <ID>, name: "Lead Capture Workflow", nodes: [...], edges: [...], triggers: [{ type: "trigger_form_submitted", config: { formId: "<FORM_ID>" } }] })
  3. updateWorkflowStatus({ sessionId, workflowId: <ID>, status: "active" })

Workflow 2: Paid Lead Magnet (Optional -- use when lead magnet has a price)

Object: type: "layer_workflow", subtype: "workflow", name: "Paid Lead Magnet Workflow"

Trigger: trigger_payment_received

Nodes:

idtypelabelconfigstatus
trigger-1trigger_payment_received"Payment Received"{ "paymentProvider": "stripe" }ready
checkout-1lc_checkout"Create Transaction"{ "action": "create-transaction", "productId": "<PRODUCT_ID>", "amount": "{{trigger.amount}}", "currency": "{{trigger.currency}}" }ready
crm-1lc_crm"Create Paid Lead"{ "action": "create-contact", "contactType": "lead", "tags": ["paid-lead-magnet", "<CAMPAIGN_TAG>"], "mapFields": { "email": "{{trigger.customerEmail}}", "firstName": "{{trigger.customerFirstName}}", "lastName": "{{trigger.customerLastName}}" } }ready
invoice-1lc_invoicing"Generate Invoice"{ "action": "generate-invoice", "transactionId": "{{checkout-1.output.transactionId}}", "contactId": "{{crm-1.output.contactId}}" }ready
email-1lc_email"Send Receipt + Delivery"{ "action": "send-confirmation-email", "to": "{{crm-1.output.email}}", "subject": "Your purchase: [Lead Magnet Name]", "body": "Hi {{crm-1.output.firstName}},\n\nThank you for your purchase. Download [Lead Magnet Name] here: [LINK]\n\nYour invoice is attached.\n\n[Sender Name]" }ready
ac-1activecampaign"Sync to ActiveCampaign"{ "action": "add_contact", "email": "{{crm-1.output.email}}", "firstName": "{{crm-1.output.firstName}}" }ready
ac-2activecampaign"Tag Paid Lead"{ "action": "add_tag", "contactEmail": "{{crm-1.output.email}}", "tag": "paid-lead-<CAMPAIGN_TAG>" }ready

Edges:

idsourcetargetsourceHandletargetHandle
e-1trigger-1checkout-1outputinput
e-2checkout-1crm-1outputinput
e-3crm-1invoice-1outputinput
e-4crm-1email-1outputinput
e-5crm-1ac-1outputinput
e-6ac-1ac-2outputinput

Mutations to execute:

  1. createWorkflow({ sessionId, name: "Paid Lead Magnet Workflow" })
  2. saveWorkflow({ sessionId, workflowId: <ID>, nodes: [...], edges: [...], triggers: [{ type: "trigger_payment_received", config: { paymentProvider: "stripe" } }] })
  3. updateWorkflowStatus({ sessionId, workflowId: <ID>, status: "active" })

Workflow 3: Lead Qualification (Optional -- use for pipeline automation)

Object: type: "layer_workflow", subtype: "workflow", name: "Lead Qualification Workflow"

Trigger: trigger_contact_updated

Nodes:

idtypelabelconfigstatus
trigger-1trigger_contact_updated"Contact Updated"{}ready
if-1if_then"Has Qualifying Data?"{ "expression": "{{trigger.contact.customFields.biggestChallenge}} !== null && {{trigger.contact.email}} !== null && {{trigger.contact.phone}} !== null" }ready
crm-1lc_crm"Move to Qualified"{ "action": "move-pipeline-stage", "contactId": "{{trigger.contact._id}}", "pipelineStageId": "qualified" }ready
email-1lc_email"Notify Sales Team"{ "action": "send-admin-notification", "to": "<ADMIN_EMAIL>", "subject": "New Qualified Lead: {{trigger.contact.firstName}} {{trigger.contact.lastName}}", "body": "A new lead has been qualified.\n\nName: {{trigger.contact.firstName}} {{trigger.contact.lastName}}\nEmail: {{trigger.contact.email}}\nPhone: {{trigger.contact.phone}}\nCompany: {{trigger.contact.companyName}}\nChallenge: {{trigger.contact.customFields.biggestChallenge}}" }ready
ac-4activecampaign"Add to Sales Automation"{ "action": "add_to_automation", "contactEmail": "{{trigger.contact.email}}", "automationId": "<AC_SALES_AUTOMATION_ID>" }ready

Edges:

idsourcetargetsourceHandletargetHandle
e-1trigger-1if-1outputinput
e-2if-1crm-1trueinput
e-3crm-1email-1outputinput
e-4crm-1ac-4outputinput

Note: The false handle of if-1 has no connection -- unqualified contacts remain at their current pipeline stage and continue receiving the nurture sequence.

Mutations to execute:

  1. createWorkflow({ sessionId, name: "Lead Qualification Workflow" })
  2. saveWorkflow({ sessionId, workflowId: <ID>, nodes: [...], edges: [...], triggers: [{ type: "trigger_contact_updated", config: {} }] })
  3. updateWorkflowStatus({ sessionId, workflowId: <ID>, status: "active" })

5. CRM Pipeline Definition

Generic Pipeline

Pipeline Name: "Lead Generation Pipeline"

Stage IDStage NameDescriptionAutomation Trigger
new_leadNew LeadContact just submitted the form. Awaiting initial review.Auto-set by Workflow 1 (crm-2 node)
contactedContactedSales rep has made first outreach (email, call, or message).Manual move or sequence completion trigger
qualifiedQualifiedLead has qualifying data (phone + challenge + engagement).Auto-set by Workflow 3 (crm-1 node)
proposalProposal SentProposal or quote has been delivered to the lead.Manual move
closed_wonClosed WonLead converted to paying customer.Manual move, triggers update-contact to change subtype to customer
closed_lostClosed LostLead did not convert. Moves to long-term nurture.Manual move, triggers add_tag with "closed-lost" in ActiveCampaign

Example: Dental Practice Pipeline

Stage IDStage NameDescription
new_leadNew Patient LeadDownloaded dental implant guide
contactedInitial Consultation BookedFront desk called, consultation scheduled
qualifiedConsultation CompletedPatient attended, needs confirmed
proposalTreatment Plan PresentedImplant treatment plan and pricing shared
closed_wonTreatment AcceptedPatient accepted and scheduled procedure
closed_lostNot ProceedingPatient declined or went elsewhere

Example: SaaS B2B Pipeline

Stage IDStage NameDescription
new_leadNew MQLDownloaded whitepaper/checklist
contactedDiscovery Call ScheduledSDR reached out, call booked
qualifiedSQL - Demo CompletedDecision-maker attended demo
proposalProposal / TrialSent pricing or started free trial
closed_wonCustomerSigned contract
closed_lostLostDid not convert

6. File System Scaffold

Project: type: "project", subtype: "campaign"

After calling initializeProjectFolders({ organizationId, projectId }), the default folders are created. Then populate:

code
/
├── builder/
│   ├── landing-page/          (kind: builder_ref -> builder_app for landing page)
│   └── thank-you-page/        (kind: builder_ref -> builder_app for thank-you page)
├── layers/
│   ├── lead-capture-workflow   (kind: layer_ref -> layer_workflow "Lead Capture Workflow")
│   ├── paid-lead-workflow      (kind: layer_ref -> layer_workflow "Paid Lead Magnet Workflow" -- optional)
│   └── qualification-workflow  (kind: layer_ref -> layer_workflow "Lead Qualification Workflow" -- optional)
├── notes/
│   ├── campaign-brief          (kind: virtual, content: campaign objectives, ICP, KPIs)
│   └── sequence-copy           (kind: virtual, content: all 5 sequence email drafts)
├── assets/
│   ├── lead-magnet-file        (kind: media_ref -> uploaded PDF/guide/checklist)
│   └── brand-assets/           (kind: folder)
│       ├── logo                (kind: media_ref -> agency client logo)
│       └── hero-image          (kind: media_ref -> landing page hero image)

Mutations to execute:

  1. initializeProjectFolders({ organizationId: <ORG_ID>, projectId: <PROJECT_ID> })
  2. createVirtualFile({ sessionId, projectId: <PROJECT_ID>, name: "campaign-brief", parentPath: "/notes", content: "<campaign brief markdown>" })
  3. createVirtualFile({ sessionId, projectId: <PROJECT_ID>, name: "sequence-copy", parentPath: "/notes", content: "<all 5 email drafts>" })
  4. captureBuilderApp({ projectId: <PROJECT_ID>, builderAppId: <LANDING_PAGE_APP_ID> })
  5. captureBuilderApp({ projectId: <PROJECT_ID>, builderAppId: <THANK_YOU_APP_ID> })
  6. captureLayerWorkflow({ projectId: <PROJECT_ID>, layerWorkflowId: <LEAD_CAPTURE_WF_ID> })
  7. captureLayerWorkflow({ projectId: <PROJECT_ID>, layerWorkflowId: <QUALIFICATION_WF_ID> }) -- if using Workflow 3

7. Data Flow Diagram

code
                                    LEAD GENERATION FUNNEL - DATA FLOW
                                    ===================================

  END CUSTOMER                    PLATFORM (L4YERCAK3)                        EXTERNAL SYSTEMS
  ============                    ====================                        ================

  +------------------+
  | Visits Landing   |
  | Page (Builder)   |
  +--------+---------+
           |
           v
  +------------------+
  | Fills Out Form   |-----> submitPublicForm({ formId, responses, metadata })
  | (Registration)   |
  +--------+---------+
           |
           |         +----------------------------------------------------------+
           |         |  WORKFLOW 1: Lead Capture                                 |
           |         |                                                          |
           +-------->|  trigger_form_submitted                                  |
                     |         |                                                |
                     |         | (output -> input)                              |
                     |         v                                                |
                     |  lc_crm [create-contact]                                 |
                     |  -> creates objects { type: "crm_contact",               |
                     |     subtype: "lead", tags: ["lead-magnet"] }             |
                     |         |                                                |
                     |         +------------+-------------+                     |
                     |         |            |             |                     |
                     |    (output->input) (output->input) (output->input)       |
                     |         |            |             |                     |
                     |         v            v             v                     |
                     |    lc_email     activecampaign  lc_crm                   |
                     |    [send-       [add_contact]   [move-pipeline-stage     |
                     |    confirmation       |          -> "new_lead"]          |
                     |    -email]            |                                  |
                     |         |        (output->input)           +----------+  |
                     |         |             v                    |          |  |
                     |         |        activecampaign  -------->| Active   |  |
                     |         |        [add_tag]                | Campaign |  |
                     |         |             |                   |          |  |
                     |         |        (output->input)          +----------+  |
                     |         |             v                                  |
                     |         |        activecampaign                          |
                     |         |        [add_to_list]                           |
                     |         |                                                |
                     +----------------------------------------------------------+
                     |
                     |  SEQUENCE: Soap Opera (nachher)
                     |
                     |  Step 1: Immediate .... "Here's your [lead magnet]"
                     |  Step 2: +1 day ....... "The backstory"
                     |  Step 3: +3 days ...... "The moment everything changed"
                     |  Step 4: +5 days ...... "The hidden benefit"
                     |  Step 5: +7 days ...... "Here's what to do next" + CTA
                     |
                     +----------------------------------------------------------+
                     |
                     |  WORKFLOW 3: Lead Qualification (optional)
                     |
                     |  trigger_contact_updated
                     |         |
                     |    (output -> input)
                     |         v
                     |    if_then [has phone + challenge + email?]
                     |         |
                     |    (true -> input)
                     |         v
                     |    lc_crm [move-pipeline-stage -> "qualified"]
                     |         |
                     |    (output -> input)      (output -> input)
                     |         v                       v
                     |    lc_email               activecampaign
                     |    [send-admin-           [add_to_automation
                     |     notification]          -> sales sequence]
                     |
                     +----------------------------------------------------------+

  PIPELINE PROGRESSION:

  [new_lead] --> [contacted] --> [qualified] --> [proposal] --> [closed_won]
                                                           \--> [closed_lost]

8. Customization Points

Must-Customize (deployment will fail or be meaningless without these)

ItemWhyWhere
Lead magnet nameAppears in landing page headline, confirmation email, sequence emailsBuilder landing page, lc_email node config subject and body, sequence step content
Lead magnet download linkDelivers the actual assetlc_email node config body, thank-you page
Form qualifying field(s)The select/radio question must match the client's industryForm fields array -- change label, options
Email sender identityFrom name 和 reply-to addresslc_email node config, sequence step content signature
CRM pipeline stage namesMust match the client's sales process terminologyPipeline definition, lc_crm move-pipeline-stage config pipelineStageId values
ActiveCampaign list IDThe AC list to add contacts toac-3 node config listId
ActiveCampaign tag(s)Tags must be meaningful for the client's segmentationac-2 node config tag
Admin notification emailSales team email for qualified lead alertsWorkflow 3 email-1 node config to

Should-Customize (significantly improves conversion and relevance)

ItemWhyDefault
Landing page copyStoryBrand framework: identify the hero's problem, position agency's client as the guideGeneric placeholder copy
Sequence email contentMust speak to ICP's specific pain points, use industry languageGeneric Soap Opera framework with placeholder content
ActiveCampaign automation IDsClient may have existing automations to integrateNo automation enrollment
Social proof contentReal testimonials and statistics convert betterPlaceholder testimonial blocks
Thank-you page next-step CTAShould point to the client's highest-value conversion actionGeneric "book a consultation"
Pipeline deal valuesSetting pipelineDealValue helps with revenue forecastingNo deal value set

Can-Use-Default (work out of the box for most deployments)

ItemDefault Value
Form field types and orderemail (req), firstName (req), lastName (opt), phone (opt), companyName (opt), qualifying select (req)
Workflow node execution ordertrigger -> crm -> email + activecampaign (parallel) -> pipeline stage
Sequence timingImmediate, +1 day, +3 days, +5 days, +7 days
Sequence channelemail for all steps
File system folder structure/builder, /layers, /notes, /assets
Contact subtypelead
Project subtypecampaign
Workflow status progressiondraft -> ready -> active

9. Common Pitfalls

What Breaks

PitfallSymptomFix
Form not linked to workflowForm submissions do not trigger the Lead Capture WorkflowCreate objectLink: { sourceObjectId: <WORKFLOW_ID>, targetObjectId: <FORM_ID>, linkType: "workflow_form" }. Also ensure trigger_form_submitted node config has the correct formId.
ActiveCampaign integration not connectedactivecampaign nodes fail silently or errorVerify the agency's ActiveCampaign API credentials are configured in the organization's integration settings before activating the workflow.
Sequence not enrolled after contact creationLeads receive confirmation email but no follow-up sequenceEnsure objectLink exists: { sourceObjectId: <WORKFLOW_ID>, targetObjectId: <SEQUENCE_ID>, linkType: "workflow_sequence" }. The sequence trigger event must be form_submitted or manual_enrollment.
Pipeline stage IDs mismatchmove-pipeline-stage action fails or moves to wrong stageThe pipelineStageId values in lc_crm node configs must exactly match the stage IDs defined in the CRM pipeline. Copy-paste, do not retype.
Missing email sender configurationEmails fail to send or land in spamConfirm the organization has a verified sender domain and the lc_email node to field uses valid template variables.
Form formId placeholder not replacedWorkflow trigger never firesAfter creating the form, update the trigger_form_submitted node config with the actual formId returned by createForm. Then call saveWorkflow again.
Workflow left in draft statusNo automations executeAfter saving all nodes/edges, call updateWorkflowStatus({ status: "active" }).
Paid variant missing product + checkout linkPayment trigger never firesFor paid lead magnets: create the product, then create objectLink with linkType: "checkout_product" and linkType: "product_form".

Pre-Launch Self-Check List

  1. Form exists and is published (publishForm was called).
  2. Form formId is set in trigger_form_submitted node config.
  3. objectLink with linkType: "workflow_form" connects workflow to form.
  4. objectLink with linkType: "workflow_sequence" connects workflow to sequence.
  5. All pipelineStageId values in lc_crm nodes match actual pipeline stage IDs.
  6. ActiveCampaign listId, tag, and automationId values are real (not placeholders).
  7. lc_email sender identity is configured and verified.
  8. Lead magnet download link is live and accessible.
  9. Landing page formSettings.redirectUrl points to the thank-you page.
  10. All workflows have status: "active".
  11. Sequence has 5 steps with correct timing offsets.
  12. Builder apps (landing page, thank-you page) are deployed.

10. Example Deployment Scenario

Scenario: Dental Practice Lead Generation Funnel

A marketing agency ("Smile Digital Agency") sets up a lead generation funnel for their client, "Downtown Dental Associates." The lead magnet is a free PDF: "The Complete Guide to Dental Implants: What Every Patient Should Know."


Step 1: Create the Project

code
createProject({
  sessionId: "<SESSION_ID>",
  organizationId: "<ORG_ID>",
  name: "Downtown Dental - Implant Guide Lead Gen",
  subtype: "campaign",
  description: "Lead generation funnel for dental implant guide PDF. Target: adults 35-65 considering implants.",
  startDate: 1706745600000,
  endDate: 1709424000000
})
// Returns: projectId = "proj_dental_implant_001"
code
initializeProjectFolders({
  organizationId: "<ORG_ID>",
  projectId: "proj_dental_implant_001"
})

Step 2: Create the Registration Form

code
createForm({
  sessionId: "<SESSION_ID>",
  organizationId: "<ORG_ID>",
  name: "Dental Implant Guide Request Form",
  description: "Captures leads requesting the free dental implant guide",
  fields: [
    { "type": "email",  "label": "Email Address",        "required": true,  "placeholder": "you@email.com" },
    { "type": "text",   "label": "First Name",           "required": true,  "placeholder": "Jane" },
    { "type": "text",   "label": "Last Name",            "required": false, "placeholder": "Smith" },
    { "type": "phone",  "label": "Phone Number",         "required": false, "placeholder": "+1 (555) 000-0000" },
    { "type": "select", "label": "What best describes your situation?", "required": true,
      "options": [
        "I'm missing one or more teeth",
        "I have dentures but want a permanent solution",
        "My dentist recommended implants",
        "I'm researching options for a family member",
        "Just curious about the procedure"
      ]
    },
    { "type": "select", "label": "When are you looking to start treatment?", "required": false,
      "options": ["Within 1 month", "1-3 months", "3-6 months", "Not sure yet"]
    }
  ],
  formSettings: {
    "redirectUrl": "/thank-you-implant-guide",
    "notifications": { "adminEmail": true, "respondentEmail": true },
    "submissionBehavior": "redirect"
  }
})
// Returns: formId = "form_dental_implant_001"
code
publishForm({ sessionId: "<SESSION_ID>", formId: "form_dental_implant_001" })

Step 3: Create the CRM Pipeline

The pipeline is configured within the organization's CRM settings with these stages:

Stage IDStage NameDescription
new_leadNew Patient LeadDownloaded the implant guide
contactedConsultation BookedFront desk called and booked free consultation
qualifiedConsultation CompletedPatient attended, implant candidacy confirmed
proposalTreatment Plan PresentedImplant treatment plan and pricing shared
closed_wonTreatment AcceptedPatient accepted, procedure scheduled
closed_lostNot ProceedingPatient declined or chose another provider

Step 4: Create the Lead Capture Workflow

code
createWorkflow({
  sessionId: "<SESSION_ID>",
  name: "Dental Implant Lead Capture",
  description: "Captures implant guide requests, creates CRM lead, sends PDF, syncs to ActiveCampaign"
})
// Returns: workflowId = "wf_dental_lead_001"
code
saveWorkflow({
  sessionId: "<SESSION_ID>",
  workflowId: "wf_dental_lead_001",
  name: "Dental Implant Lead Capture",
  nodes: [
    {
      "id": "trigger-1",
      "type": "trigger_form_submitted",
      "position": { "x": 100, "y": 200 },
      "config": { "formId": "form_dental_implant_001" },
      "status": "ready",
      "label": "Implant Guide Form Submitted"
    },
    {
      "id": "crm-1",
      "type": "lc_crm",
      "position": { "x": 350, "y": 200 },
      "config": {
        "action": "create-contact",
        "contactType": "lead",
        "tags": ["implant-guide", "dental-lead", "downtown-dental"],
        "mapFields": {
          "email": "{{trigger.email}}",
          "firstName": "{{trigger.firstName}}",
          "lastName": "{{trigger.lastName}}",
          "phone": "{{trigger.phone}}",
          "customFields": {
            "situation": "{{trigger.whatBestDescribesYourSituation}}",
            "timeline": "{{trigger.whenAreYouLookingToStartTreatment}}"
          }
        }
      },
      "status": "ready",
      "label": "Create Patient Lead"
    },
    {
      "id": "email-1",
      "type": "lc_email",
      "position": { "x": 600, "y": 100 },
      "config": {
        "action": "send-confirmation-email",
        "to": "{{crm-1.output.email}}",
        "subject": "Your Free Dental Implant Guide is Here",
        "body": "Hi {{crm-1.output.firstName}},\n\nThank you for requesting The Complete Guide to Dental Implants.\n\nDownload your guide here: https://assets.downtowndental.com/implant-guide.pdf\n\nThis guide covers:\n- The different types of dental implants\n- What to expect during the procedure\n- Recovery timeline and care instructions\n- Cost ranges and financing options\n\nOver the next few days, I'll share some insights from Dr. Martinez about common questions patients have.\n\nTo your smile,\nThe Downtown Dental Team\n\nP.S. If you'd like to skip ahead and chat with us directly, book a free consultation: https://downtowndental.com/book"
      },
      "status": "ready",
      "label": "Send Implant Guide Email"
    },
    {
      "id": "ac-1",
      "type": "activecampaign",
      "position": { "x": 600, "y": 300 },
      "config": {
        "action": "add_contact",
        "email": "{{crm-1.output.email}}",
        "firstName": "{{crm-1.output.firstName}}",
        "lastName": "{{crm-1.output.lastName}}"
      },
      "status": "ready",
      "label": "Add to ActiveCampaign"
    },
    {
      "id": "ac-2",
      "type": "activecampaign",
      "position": { "x": 850, "y": 300 },
      "config": {
        "action": "add_tag",
        "contactEmail": "{{crm-1.output.email}}",
        "tag": "implant-guide-download"
      },
      "status": "ready",
      "label": "Tag: Implant Guide"
    },
    {
      "id": "ac-3",
      "type": "activecampaign",
      "position": { "x": 1100, "y": 300 },
      "config": {
        "action": "add_to_list",
        "contactEmail": "{{crm-1.output.email}}",
        "listId": "ac_list_dental_leads_2024"
      },
      "status": "ready",
      "label": "Add to Dental Leads List"
    },
    {
      "id": "crm-2",
      "type": "lc_crm",
      "position": { "x": 600, "y": 500 },
      "config": {
        "action": "move-pipeline-stage",
        "contactId": "{{crm-1.output.contactId}}",
        "pipelineStageId": "new_lead"
      },
      "status": "ready",
      "label": "Set Pipeline: New Patient Lead"
    }
  ],
  edges: [
    { "id": "e-1", "source": "trigger-1", "target": "crm-1",  "sourceHandle": "output", "targetHandle": "input" },
    { "id": "e-2", "source": "crm-1",     "target": "email-1", "sourceHandle": "output", "targetHandle": "input" },
    { "id": "e-3", "source": "crm-1",     "target": "ac-1",    "sourceHandle": "output", "targetHandle": "input" },
    { "id": "e-4", "source": "ac-1",      "target": "ac-2",    "sourceHandle": "output", "targetHandle": "input" },
    { "id": "e-5", "source": "ac-2",      "target": "ac-3",    "sourceHandle": "output", "targetHandle": "input" },
    { "id": "e-6", "source": "crm-1",     "target": "crm-2",   "sourceHandle": "output", "targetHandle": "input" }
  ],
  triggers: [{ "type": "trigger_form_submitted", "config": { "formId": "form_dental_implant_001" } }]
})
code
updateWorkflowStatus({
  sessionId: "<SESSION_ID>",
  workflowId: "wf_dental_lead_001",
  status: "active"
})

Step 5: Create the Soap Opera Sequence

Object: type: "automation_sequence", subtype: "nachher", name: "Dental Implant Nurture Sequence"

Trigger event: form_submitted

Steps:

StepChannelTimingSubjectBody Summary
1email{ offset: 0, unit: "minutes", referencePoint: "trigger_event" }"Your Free Dental Implant Guide is Here"Deliver the PDF link. Introduce Dr. Martinez as the guide. Mention the practice's 15+ years of implant experience. End with: "Over the next few days, I'll share some insights that most dental offices won't tell you."
2email{ offset: 1, unit: "days", referencePoint: "trigger_event" }"Why Dr. Martinez Became an Implant Specialist"Origin story: Dr. Martinez saw patients struggling with ill-fitting dentures. She trained at [institute] specifically to offer better solutions. Build rapport and trust. End with a question: "Have you been dealing with [common pain point]?"
3email{ offset: 3, unit: "days", referencePoint: "trigger_event" }"The Moment That Changed Everything for Sarah"Patient success story (epiphany bridge). Sarah was terrified of the procedure, almost didn't come in, but after a 30-minute consultation she realized modern implants are nothing like she imagined. Before/after transformation.
4email{ offset: 5, unit: "days", referencePoint: "trigger_event" }"The Benefit Nobody Talks About"Beyond aesthetics: implants prevent bone loss, improve nutrition (can eat properly), boost confidence in professional settings. Achievement story of a patient who got a promotion after regaining their smile.
5email{ offset: 7, unit: "days", referencePoint: "trigger_event" }"Your Next Step (Free Consultation This Week)"Urgency: "We have 3 consultation slots open this week." CTA: Book a free 30-minute implant consultation. Include direct booking link. Mention financing options available. Close with "Even if you're not ready, a consultation gives you the information you need to make the right decision."

Step 6: Link All Objects

code
// Link workflow to form
objectLinks.create({
  sourceObjectId: "wf_dental_lead_001",
  targetObjectId: "form_dental_implant_001",
  linkType: "workflow_form"
})

// Link workflow to sequence
objectLinks.create({
  sourceObjectId: "wf_dental_lead_001",
  targetObjectId: "<SEQUENCE_ID>",
  linkType: "workflow_sequence"
})

Step 7: Populate the File System

code
createVirtualFile({
  sessionId: "<SESSION_ID>",
  projectId: "proj_dental_implant_001",
  name: "campaign-brief",
  parentPath: "/notes",
  content: "# Downtown Dental - Implant Guide Campaign\n\n## Objective\nGenerate qualified leads for dental implant consultations.\n\n## Target ICP\nAdults 35-65, missing teeth or wearing dentures, researching permanent solutions, located within 30 miles of practice.\n\n## Lead Magnet\nThe Complete Guide to Dental Implants (PDF, 12 pages)\n\n## KPIs\n- 100 leads/month\n- 20% consultation booking rate\n- 10% treatment acceptance rate\n\n## Budget\nAd spend: $2,000/month (Facebook + Google)\nPlatform: L4YERCAK3 subscription"
})

createVirtualFile({
  sessionId: "<SESSION_ID>",
  projectId: "proj_dental_implant_001",
  name: "sequence-copy",
  parentPath: "/notes",
  content: "# Soap Opera Sequence - Dental Implant Nurture\n\n## Email 1: Immediate - Guide Delivery\nSubject: Your Free Dental Implant Guide is Here\n[Full email body as specified in Step 5, Step 1]\n\n## Email 2: +1 Day - Backstory\nSubject: Why Dr. Martinez Became an Implant Specialist\n[Full email body]\n\n## Email 3: +3 Days - Epiphany Bridge\nSubject: The Moment That Changed Everything for Sarah\n[Full email body]\n\n## Email 4: +5 Days - Hidden Benefit\nSubject: The Benefit Nobody Talks About\n[Full email body]\n\n## Email 5: +7 Days - CTA\nSubject: Your Next Step (Free Consultation This Week)\n[Full email body]"
})

captureBuilderApp({
  projectId: "proj_dental_implant_001",
  builderAppId: "<LANDING_PAGE_APP_ID>"
})

captureBuilderApp({
  projectId: "proj_dental_implant_001",
  builderAppId: "<THANK_YOU_PAGE_APP_ID>"
})

captureLayerWorkflow({
  projectId: "proj_dental_implant_001",
  layerWorkflowId: "wf_dental_lead_001"
})

Complete Object Inventory

#Object TypeSubtypeNameKey Detail
1projectcampaign"Downtown Dental - Implant Guide Lead Gen"Container for all assets
2formregistration"Dental Implant Guide Request Form"6 fields, published
3layer_workflowworkflow"Dental Implant Lead Capture"7 nodes, 6 edges, active
4automation_sequencenachher"Dental Implant Nurture Sequence"5 emails over 7 days
5builder_apptemplate_based"Implant Guide Landing Page"Hero + form + social proof
6builder_apptemplate_based"Implant Guide Thank You Page"Confirmation + download + CTA
#Link TypeSourceTarget
1workflow_formWorkflow (3)Form (2)
2workflow_sequenceWorkflow (3)Sequence (4)

Credit Cost Estimate

ActionCountCredits EachTotal
Behavior: create-contact1 per lead11
Behavior: move-pipeline-stage1 per lead11
Behavior: send-confirmation-email1 per lead11
Behavior: activecampaign-sync (add_contact)1 per lead11
Behavior: activecampaign-sync (add_tag)1 per lead11
Behavior: activecampaign-sync (add_to_list)1 per lead11
Sequence: 5 emails5 per lead15
Total per lead11 credits

For 100 leads/month: approximately 1,100 credits/month.