{
  "schema_version": "1.0.0",
  "id": "highlevel-form-lead-score",
  "title": "Score a form lead into HighLevel",
  "category": "lead-gen-crm",
  "difficulty": "intermediate",
  "featured": true,
  "description": "Clean the phone number on a Facebook lead, score it, create or update the HighLevel contact, and tag it hot, warm, or cold for workflows.",
  "tags": [
    "leads",
    "highlevel",
    "facebook-lead-ads",
    "lead-scoring",
    "sms"
  ],
  "apps": [
    "Facebook Lead Ads",
    "Code by Zapier",
    "LeadConnector"
  ],
  "plan": {
    "minimum": "Professional",
    "reasons": [
      "multi-step Zap: 4 steps after the trigger"
    ]
  },
  "tasks": {
    "typical": 4,
    "max": 4
  },
  "trigger": {
    "app": "Facebook Lead Ads",
    "event": "New Lead",
    "kind": "instant",
    "title": "New lead from the consultation form",
    "why": "Fires for each lead submitted on the instant form attached to your ad.",
    "config": {
      "Page": "YOUR_FACEBOOK_PAGE",
      "Form": "Free consultation form"
    },
    "outputs": [
      "lead_id",
      "created_time",
      "form_name",
      "ad_name",
      "full_name",
      "email",
      "phone_number",
      "service_interest",
      "budget",
      "timeline"
    ],
    "sample": "sample-trigger.json"
  },
  "steps": [
    {
      "key": "phone",
      "kind": "code",
      "app": "Code by Zapier",
      "event": "Run JavaScript",
      "title": "Format the phone number",
      "why": "Turns \"(415) 555-0123\" or \"415.555.0123\" into +14155550123. HighLevel and its SMS workflows expect E.164; a bad number is passed through empty instead of failing the workflow.",
      "code": {
        "language": "javascript",
        "module": "normalize-phone",
        "file": "code/normalize-phone.js"
      },
      "input_data": {
        "phone": "{{trigger.phone_number}}",
        "default_country": "1"
      },
      "outputs": [
        "e164",
        "valid",
        "extension"
      ]
    },
    {
      "key": "score",
      "kind": "code",
      "app": "Code by Zapier",
      "event": "Run JavaScript",
      "title": "Score the lead",
      "why": "Facebook forms rarely ask for a job title, so the score leans on budget, timeline, and whether a real email was given.",
      "code": {
        "language": "javascript",
        "module": "score-lead",
        "file": "code/score-lead.js"
      },
      "input_data": {
        "email": "{{trigger.email}}",
        "budget": "{{trigger.budget}}",
        "timeline": "{{trigger.timeline}}",
        "message": "{{trigger.service_interest}}"
      },
      "outputs": [
        "score",
        "tier",
        "reasons",
        "is_work_email"
      ]
    },
    {
      "key": "contact",
      "kind": "action",
      "app": "LeadConnector",
      "event": "Create/Update Contact",
      "title": "Create or update the HighLevel contact",
      "why": "Matches on email or phone, so a lead who submits twice is updated, not duplicated.",
      "fields": {
        "Location": "YOUR_HIGHLEVEL_LOCATION",
        "Full Name": "{{trigger.full_name}}",
        "Email": "{{trigger.email}}",
        "Phone": "{{phone.e164}}",
        "Source": "Facebook lead ad: {{trigger.ad_name}}",
        "Custom field: lead_score": "{{score.score}}",
        "Custom field: service_interest": "{{trigger.service_interest}}"
      },
      "outputs": [
        "id",
        "is_new"
      ]
    },
    {
      "key": "tag",
      "kind": "action",
      "app": "LeadConnector",
      "event": "Add Tag to Contact",
      "title": "Tag the contact with its tier",
      "why": "The tag (lead-hot, lead-warm, lead-cold) is what HighLevel workflows trigger on, so each tier gets its own follow-up.",
      "fields": {
        "Location": "YOUR_HIGHLEVEL_LOCATION",
        "Contact": "{{contact.id}}",
        "Tags": "lead-{{score.tier}}"
      },
      "outputs": [
        "id"
      ]
    }
  ]
}
