{
  "schema_version": "1.0.0",
  "id": "salesforce-lead-from-webhook",
  "title": "Score a website form into a Salesforce lead",
  "category": "lead-gen-crm",
  "difficulty": "advanced",
  "featured": false,
  "description": "Catch a custom website form by webhook, score it, create a Salesforce lead with the rating, and alert the channel for hot leads.",
  "tags": [
    "leads",
    "salesforce",
    "webhooks",
    "lead-scoring",
    "slack"
  ],
  "apps": [
    "Webhooks by Zapier",
    "Code by Zapier",
    "Salesforce",
    "Filter by Zapier",
    "Slack"
  ],
  "plan": {
    "minimum": "Professional",
    "reasons": [
      "multi-step Zap: 5 steps after the trigger",
      "Filter by Zapier",
      "premium app: Webhooks by Zapier",
      "premium app: Salesforce"
    ]
  },
  "tasks": {
    "typical": 3,
    "max": 4
  },
  "trigger": {
    "app": "Webhooks by Zapier",
    "event": "Catch Hook",
    "kind": "instant",
    "title": "Website form posts to the webhook",
    "why": "Your form posts its fields as JSON to the Catch Hook URL Zapier gives you. Nothing in this repository contains a live webhook URL.",
    "config": {
      "Pick off a Child Key": "(leave blank)"
    },
    "outputs": [
      "full_name",
      "email",
      "company",
      "job_title",
      "company_size",
      "budget",
      "timeline",
      "message",
      "page_url",
      "utm_source"
    ],
    "sample": "sample-trigger.json"
  },
  "steps": [
    {
      "key": "name",
      "kind": "code",
      "app": "Code by Zapier",
      "event": "Run JavaScript",
      "title": "Split the full name",
      "why": "Salesforce requires Last Name on a lead; this step guarantees one, even for a single-word name.",
      "code": {
        "language": "javascript",
        "module": "split-name",
        "file": "code/split-name.js"
      },
      "input_data": {
        "full_name": "{{trigger.full_name}}"
      },
      "outputs": [
        "first_name",
        "last_name",
        "display_name"
      ]
    },
    {
      "key": "score",
      "kind": "code",
      "app": "Code by Zapier",
      "event": "Run JavaScript",
      "title": "Score the lead",
      "why": "Same rules as the HubSpot template, so the scoring is consistent across CRMs.",
      "code": {
        "language": "javascript",
        "module": "score-lead",
        "file": "code/score-lead.js"
      },
      "input_data": {
        "email": "{{trigger.email}}",
        "company": "{{trigger.company}}",
        "job_title": "{{trigger.job_title}}",
        "company_size": "{{trigger.company_size}}",
        "budget": "{{trigger.budget}}",
        "timeline": "{{trigger.timeline}}",
        "message": "{{trigger.message}}"
      },
      "outputs": [
        "score",
        "tier",
        "reasons",
        "is_work_email"
      ]
    },
    {
      "key": "lead",
      "kind": "action",
      "app": "Salesforce",
      "event": "Create Record",
      "title": "Create the Salesforce lead",
      "why": "The tier goes into the standard Rating field (Hot, Warm, Cold), so existing Salesforce list views and assignment rules work unchanged.",
      "fields": {
        "Salesforce Object": "Lead",
        "First Name": "{{name.first_name}}",
        "Last Name": "{{name.last_name}}",
        "Company": "{{trigger.company}}",
        "Email": "{{trigger.email}}",
        "Title": "{{trigger.job_title}}",
        "Lead Source": "Web",
        "Rating": "{{score.tier}}",
        "Description": "{{trigger.message}}\n\nScore {{score.score}}: {{score.reasons}}\nPage: {{trigger.page_url}} (utm_source {{trigger.utm_source}})"
      },
      "outputs": [
        "id"
      ]
    },
    {
      "key": "hot",
      "kind": "filter",
      "app": "Filter by Zapier",
      "event": "Only continue if...",
      "title": "Only hot leads",
      "why": "Most leads stop here; they are already in Salesforce with their rating.",
      "conditions": [
        [
          {
            "field": "{{score.tier}}",
            "operator": "(Text) Exactly matches",
            "value": "hot"
          }
        ]
      ],
      "usually": false
    },
    {
      "key": "alert",
      "kind": "action",
      "app": "Slack",
      "event": "Send Channel Message",
      "title": "Alert the sales channel",
      "why": "Links straight to the lead record.",
      "fields": {
        "Channel": "#sales-hot-leads",
        "Message Text": ":fire: {{name.display_name}} ({{trigger.job_title}}, {{trigger.company}}) scored {{score.score}}. {{score.reasons}}. https://YOUR_DOMAIN.lightning.force.com/lightning/r/Lead/{{lead.id}}/view",
        "Send as a bot?": "Yes",
        "Bot Name": "Zap alerts",
        "Include a link to this Zap?": "No"
      },
      "outputs": [
        "ts",
        "permalink"
      ]
    }
  ]
}
