{
  "key": "inbound-email-leads-to-slack",
  "name": "Parse lead emails and post them to Slack",
  "description": "Give the workflow its own email address, forward lead notification emails to it, pull the name, email and phone out of each message, and post the lead to a Slack channel.",
  "data": {
    "nodes": [
      {
        "id": "lead-email",
        "type": "internal:email-inbound",
        "position": {
          "x": 0,
          "y": 0
        },
        "data": {
          "label": "Lead email",
          "operation_name": "onInboundEmail",
          "args": {
            "state": {
              "addressPrefix": "leads",
              "allowedSenders": "",
              "subjectFilter": "lead",
              "dropSpam": true,
              "requireAuthenticated": false,
              "includeHtml": true,
              "includeHeaders": false,
              "attachments": "metadata",
              "includeRawMessage": false,
              "maxRunsPerHour": 120,
              "parseRules": [
                {
                  "field": "name",
                  "method": "label",
                  "label": "Name",
                  "required": true
                },
                {
                  "field": "email",
                  "method": "label",
                  "label": "Email",
                  "required": true
                },
                {
                  "field": "phone",
                  "method": "label",
                  "label": "Phone"
                },
                {
                  "field": "message",
                  "method": "label",
                  "label": "Message"
                }
              ]
            }
          },
          "nodeData": {
            "nodeType": "internal:email-inbound",
            "kind": [
              "trigger"
            ]
          }
        }
      },
      {
        "id": "post-to-slack",
        "type": "store/slack",
        "position": {
          "x": 300,
          "y": 0
        },
        "data": {
          "label": "Post to Slack",
          "operation_name": "sendMessage",
          "version": "1.0.0",
          "args": {
            "state": {
              "channelId": "REPLACE_WITH_YOUR_CHANNEL_ID",
              "messageType": "text",
              "text": "New lead: {{ $json.parsed.name }} <{{ $json.parsed.email }}> {{ $json.parsed.phone }}\n{{ $json.parsed.message }}"
            }
          },
          "nodeData": {
            "nodeType": "store/slack",
            "version": "1.0.0"
          }
        }
      }
    ],
    "edges": [
      {
        "id": "lead-email-post-to-slack",
        "source": "lead-email",
        "target": "post-to-slack"
      }
    ]
  }
}
