Webhook to Slack

automation · by zorilla · came with Zorilla

Posts to Slack whenever something calls your webhook address. Needs a Slack key named slack_key and a public address.

WebhookWhen something posts to /hook…Set fieldsSets textPost to Slack#alerts

3 steps, drawn from the file

What this can do

Read out of the file, not written by the author.

contacts slack.com

Uses your saved keys named slack_key. It binds to your own keys of those names. No key travels in the file.

3 steps, started by Webhook.

Contents
{
  "name": "Webhook to Slack",
  "nodes": [
    {
      "id": "hook",
      "type": "core.webhook",
      "params": {
        "path": "alert",
        "method": "POST"
      },
      "position": {
        "x": 40,
        "y": 170
      }
    },
    {
      "id": "shape",
      "type": "transform.set",
      "params": {
        "fields": [
          {
            "name": "text",
            "value": "{{ $json.body.message ?? 'a test run, with nothing sent in' }}"
          }
        ],
        "keepOnly": true
      },
      "position": {
        "x": 300,
        "y": 170
      }
    },
    {
      "id": "slack",
      "type": "slack.post",
      "params": {
        "credential": "slack_key",
        "channel": "#alerts",
        "text": "{{ $json.text }}"
      },
      "position": {
        "x": 560,
        "y": 170
      }
    }
  ],
  "edges": [
    {
      "from": "hook",
      "fromPort": "main",
      "to": "shape",
      "toPort": "main"
    },
    {
      "from": "shape",
      "fromPort": "main",
      "to": "slack",
      "toPort": "main"
    }
  ]
}
Back

Download it, then in Zorilla press add one from a file. You get a screen listing what it contacts and which keys it asks for before anything is saved.