{
  "name": "Job post to draft",
  "definition": {
    "nodes": [
      {
        "id": "start",
        "type": "trigger.webhook",
        "position": {
          "x": 0,
          "y": 0
        },
        "config": {
          "objectTypeKey": "contact",
          "mapping": {
            "email": "{{trigger.payload.email}}",
            "first_name": "{{trigger.payload.first_name}}",
            "last_name": "{{trigger.payload.last_name}}",
            "company_name": "{{trigger.payload.company}}",
            "job_title": "{{trigger.payload.title}}"
          },
          "matchKey": "email"
        }
      },
      {
        "id": "mx",
        "type": "enrich.email_domain",
        "position": {
          "x": 320,
          "y": 0
        },
        "config": {}
      },
      {
        "id": "score",
        "type": "logic.score",
        "position": {
          "x": 640,
          "y": 0
        },
        "config": {
          "rules": [
            {
              "field": "record.email_status",
              "op": "eq",
              "value": "accepts_mail",
              "points": 40
            },
            {
              "field": "record.job_title",
              "op": "contains",
              "value": "head",
              "points": 40
            },
            {
              "field": "record.job_title",
              "op": "contains",
              "value": "manager",
              "points": 30
            }
          ],
          "scoreKey": "lead_score",
          "qualificationKey": "qualification",
          "hot": 70,
          "warm": 40
        }
      },
      {
        "id": "if",
        "type": "logic.condition",
        "position": {
          "x": 960,
          "y": 0
        },
        "config": {
          "mode": "all",
          "conditions": [
            {
              "field": "record.lead_score",
              "op": "gte",
              "value": "70"
            }
          ]
        }
      },
      {
        "id": "draft",
        "type": "outreach.draft",
        "position": {
          "x": 1280,
          "y": 0
        },
        "config": {
          "campaign": "Job post",
          "subject": "Your {{trigger.payload.role}} hire",
          "body": "Hi {{record.first_name}},\n\nI saw that {{record.company_name}} is hiring ({{trigger.payload.role}}). We help teams fill this kind of position.\n\nWould a 15-minute call be useful?\n"
        }
      },
      {
        "id": "task",
        "type": "output.task",
        "position": {
          "x": 1600,
          "y": 0
        },
        "config": {
          "body": "Review the draft and call {{record.title}}",
          "dueInDays": 2
        }
      }
    ],
    "edges": [
      {
        "source": "start",
        "sourcePort": "main",
        "target": "mx"
      },
      {
        "source": "mx",
        "sourcePort": "main",
        "target": "score"
      },
      {
        "source": "mx",
        "sourcePort": "error",
        "target": "score"
      },
      {
        "source": "score",
        "sourcePort": "main",
        "target": "if"
      },
      {
        "source": "if",
        "sourcePort": "true",
        "target": "draft"
      },
      {
        "source": "draft",
        "sourcePort": "main",
        "target": "task"
      }
    ]
  }
}
