Skip to content

Slack Integration

Send messages and notifications to Slack.

Configuration

json
{
  "credentials": {
    "slack": {
      "webhookUrl": "{{env.SLACK_WEBHOOK_URL}}",
      "botToken": "{{env.SLACK_BOT_TOKEN}}"
    }
  }
}

Endpoints

MethodEndpointDescription
POST/integrations/slack/messagesSend message

Actions (for workflows)

sendMessage

Simple text message:

json
{
  "integration": "slack",
  "action": "sendMessage",
  "params": {
    "channel": "#general",
    "text": "Hello from Backflow!"
  }
}

sendBlocks

Rich block message:

json
{
  "integration": "slack",
  "action": "sendBlocks",
  "params": {
    "channel": "#alerts",
    "blocks": [
      {
        "type": "section",
        "text": {
          "type": "mrkdwn",
          "text": "*New Order*\nOrder #{{input.orderId}}"
        }
      },
      {
        "type": "actions",
        "elements": [
          {
            "type": "button",
            "text": { "type": "plain_text", "text": "View" },
            "url": "https://app.example.com/orders/{{input.orderId}}"
          }
        ]
      }
    ]
  }
}

Examples

Send Message via Webhook

bash
curl -X POST http://localhost:3000/integrations/slack/messages \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "channel": "#general",
    "text": "Deployment complete!"
  }'

Send with Formatting

bash
curl -X POST http://localhost:3000/integrations/slack/messages \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "channel": "#alerts",
    "text": "*Alert:* Server CPU at 95%",
    "attachments": [{
      "color": "danger",
      "fields": [{
        "title": "Server",
        "value": "prod-1",
        "short": true
      }]
    }]
  }'

In Routes

json
{
  "path": "/deploy",
  "method": "post",
  "integrations": [{
    "type": "slack",
    "action": "sendMessage",
    "params": {
      "channel": "#deployments",
      "text": ":rocket: Deployed &#123;&#123;body.version&#125;&#125; to &#123;&#123;body.environment&#125;&#125;"
    }
  }]
}

Workflow Example

json
{
  "id": "notify-on-error",
  "steps": [
    {
      "id": "notify",
      "type": "integration",
      "integration": "slack",
      "action": "sendBlocks",
      "params": {
        "channel": "#alerts",
        "blocks": [
          {
            "type": "header",
            "text": { "type": "plain_text", "text": ":warning: Error Detected" }
          },
          {
            "type": "section",
            "text": {
              "type": "mrkdwn",
              "text": "&#123;&#123;input.errorMessage&#125;&#125;"
            }
          }
        ]
      }
    }
  ]
}

Released under the ISC License.