{
  "name": "Webhook to Slack",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "slack-notify",
        "responseMode": "responseNode",
        "options": {}
      },
      "id": "webhook-node",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "jsCode": "// Extract and validate data from webhook\nconst input = $input.first().json.body;\n\nif (!input.message && !input.event) {\n  throw new Error('Either message or event is required');\n}\n\n// Format for Slack\nconst message = input.message || `\ud83d\udd14 Event: ${input.event}`;\nconst emoji = input.emoji || '\ud83d\udd14';\nconst channel = input.channel || '#general';\n\nreturn {\n  channel: channel,\n  text: `${emoji} ${message}`,\n  blocks: [\n    {\n      type: 'section',\n      text: {\n        type: 'mrkdwn',\n        text: `${emoji} *Notification*\\n${message}`\n      }\n    },\n    {\n      type: 'context',\n      elements: [\n        {\n          type: 'mrkdwn',\n          text: `Received at ${new Date().toISOString()}`\n        }\n      ]\n    }\n  ],\n  originalData: input\n};"
      },
      "id": "format-node",
      "name": "Format Message",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        450,
        300
      ]
    },
    {
      "parameters": {
        "channel": "={{ $json.channel }}",
        "text": "={{ $json.text }}",
        "otherOptions": {}
      },
      "id": "slack-node",
      "name": "Slack",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 1,
      "position": [
        650,
        300
      ],
      "credentials": {
        "slackApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ { success: true, message: 'Sent to Slack' } }}",
        "options": {}
      },
      "id": "respond-node",
      "name": "Respond",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1,
      "position": [
        850,
        300
      ]
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Format Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Message": {
      "main": [
        [
          {
            "node": "Slack",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Slack": {
      "main": [
        [
          {
            "node": "Respond",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "staticData": null,
  "tags": [],
  "triggerCount": 0,
  "updatedAt": "2026-03-02T19:00:00.000Z",
  "versionId": "1"
}