Home/ Workflows/ Developers/ Team Communication
Workflow ยท Developers

Bug Ticket to Slack Notification Automation

Automate instant Slack notifications when new bug tickets are created or updated in your bug tracking system, keeping your development team informed and responsive.

Why This Automation Matters

Bug tickets require immediate attention to maintain code quality and user experience. This automation ensures your development team never misses critical bug reports by instantly pushing notifications to designated Slack channels. It eliminates the need for manual monitoring of bug tracking systems and creates a centralized communication hub for incident response.

Key benefits:

What You Need Before Starting

Prerequisites

Required Credentials

  1. Slack App Credentials

    • Bot User OAuth Token
    • Channel IDs where notifications will be sent
    • Proper bot permissions (chat:write, channels:read)
  2. Bug Tracking System Access

    • Webhook URL capability
    • API access (if using polling instead of webhooks)
    • Admin rights to configure integrations

Setup Steps

  1. Create a new Slack app at api.slack.com
  2. Install the app to your workspace
  3. Note the Bot User OAuth Token
  4. Invite the bot to your desired channels
  5. Configure webhook in your bug tracking system

Complete Node-by-Node Build Instructions

Node 1: Webhook Trigger

  1. Add a Webhook node as your starting point
  2. Set the HTTP Method to POST
  3. Set Authentication to None (or configure based on your security requirements)
  4. Set Path to something like /bug-ticket-webhook
  5. Copy the webhook URL - youโ€™ll need this for your bug tracking system

Node 2: Data Processing

  1. Add a Code node after the webhook
  2. Set the mode to Run Once for All Items
  3. Add this JavaScript code to process incoming bug data:
// Extract and normalize bug ticket data
const webhookData = $input.all()[0].json.body;

// Map common fields (adjust based on your bug tracker)
const bugData = {
  id: webhookData.id || webhookData.key,
  title: webhookData.title || webhookData.summary || webhookData.fields?.summary,
  description: webhookData.description || webhookData.body,
  priority: webhookData.priority?.name || webhookData.priority || 'Medium',
  status: webhookData.status?.name || webhookData.status || 'Open',
  assignee: webhookData.assignee?.displayName || webhookData.assignee || 'Unassigned',
  reporter: webhookData.reporter?.displayName || webhookData.creator || 'Unknown',
  url: webhookData.html_url || webhookData.self || '#',
  created: webhookData.created || webhookData.created_at || new Date().toISOString(),
  labels: webhookData.labels || [],
  action: webhookData.webhookEvent || 'created'
};

return [{ json: bugData }];

Node 3: Priority-Based Routing (Switch Node)

  1. Add a Switch node to route based on bug priority
  2. Set Mode to Rules
  3. Configure routing rules:
    • Route 1: {{ $json.priority }} equals Critical or High
    • Route 2: {{ $json.priority }} equals Medium
    • Route 3: {{ $json.priority }} equals Low

Node 4: High Priority Slack Notification

  1. Add a Slack node connected to Route 1
  2. Set Credential for your Slack app
  3. Set Resource to Message and Operation to Post
  4. Configure the message:
    • Channel: Your critical bugs channel ID
    • Text: Leave empty (weโ€™ll use blocks)
    • Blocks: Add this JSON structure:
[
  {
    "type": "header",
    "text": {
      "type": "plain_text",
      "text": "๐Ÿšจ CRITICAL BUG ALERT ๐Ÿšจ"
    }
  },
  {
    "type": "section",
    "text": {
      "type": "mrkdwn",
      "text": "*Bug ID:* {{ $json.id }}\n*Title:* {{ $json.title }}\n*Priority:* {{ $json.priority }}\n*Status:* {{ $json.status }}"
    },
    "accessory": {
      "type": "button",
      "text": {
        "type": "plain_text",
        "text": "View Bug"
      },
      "url": "{{ $json.url }}"
    }
  },
  {
    "type": "section",
    "text": {
      "type": "mrkdwn",
      "text": "*Reporter:* {{ $json.reporter }}\n*Assignee:* {{ $json.assignee }}\n*Created:* {{ $json.created }}"
    }
  },
  {
    "type": "section",
    "text": {
      "type": "mrkdwn",
      "text": "*Description:*\n{{ $json.description }}"
    }
  }
]

Node 5: Medium Priority Slack Notification

  1. Add another Slack node connected to Route 2
  2. Use same credential and basic settings
  3. Configure a less urgent message format:
    • Channel: Your general bugs channel ID
    • Blocks:
[
  {
    "type": "header",
    "text": {
      "type": "plain_text",
      "text": "๐Ÿ› Bug Report"
    }
  },
  {
    "type": "section",
    "text": {
      "type": "mrkdwn",
      "text": "*{{ $json.title }}*\nID: {{ $json.id }} | Priority: {{ $json.priority }} | Assignee: {{ $json.assignee }}"
    },
    "accessory": {
      "type": "button",
      "text": {
        "type": "plain_text",
        "text": "View Details"
      },
      "url": "{{ $json.url }}"
    }
  }
]

Node 6: Low Priority Slack Notification

  1. Add a third Slack node for Route 3
  2. Create a minimal notification for low priority bugs:
    • Channel: Your low priority or general channel
    • Text: New low priority bug: {{ $json.title }} (ID: {{ $json.id }}) - {{ $json.url }}

Node 7: Team Mention for Critical Bugs

  1. Add another Slack node after the high priority notification
  2. Set it to post in your team channel
  3. Text: <!channel> Critical bug needs immediate attention: {{ $json.title }}
  4. This ensures the entire team is alerted for critical issues

Full Workflow JSON

{
  "name": "Bug Ticket to Slack Notification",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "bug-ticket-webhook",
        "options": {}
      },
      "id": "webhook-trigger",
      "name": "Bug Ticket Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [240, 300],
      "webhookId": "bug-ticket-webhook"
    },
    {
      "parameters": {
        "mode": "runOnceForAllItems",
        "jsCode": "const webhookData = $input.all()[0].json.body;\n\nconst bugData = {\n  id: webhookData.id || webhookData.key,\n  title: webhookData.title || webhookData.summary || webhookData.fields?.summary,\n  description: webhookData.description || webhookData.body,\n  priority: webhookData.priority?.name || webhookData.priority || 'Medium',\n  status: webhookData.status?.name || webhookData.status || 'Open',\n  assignee: webhookData.assignee?.displayName || webhookData.assignee || 'Unassigned',\n  reporter: webhookData.reporter?.displayName || webhookData.creator || 'Unknown',\n  url: webhookData.html_url || webhookData.self || '#',\n  created: webhookData.created || webhookData.created_at || new Date().toISOString(),\n  labels: webhookData.labels || [],\n  action: webhookData.webhookEvent || 'created'\n};\n\nreturn [{ json: bugData }];"
      },
      "id": "process-data",
      "name": "Process Bug Data",
      "type": "n8n-nodes-base.code",
      "position": [460, 300]
    },
    {
      "parameters": {
        "mode": "rules",
        "rules": {
          "rules": [
            {
              "conditions": {
                "any": [
                  {
                    "value1": "={{ $json.priority }}",
                    "operation": "equal",
                    "value2": "Critical"
                  },
                  {
                    "value1": "={{ $json.priority }}",
                    "operation": "equal",
                    "value2": "High"
                  }
                ]
              },
              "renameOutput": "High Priority"
            },
            {
              "conditions": {
                "any": [
                  {
                    "value1": "={{ $json.priority }}",
                    "operation": "equal",
                    "value2": "Medium"
                  }
                ]
              },
              "renameOutput": "Medium Priority"
            },
            {
              "conditions": {
                "any": [
                  {
                    "value1": "={{ $json.priority }}",
                    "operation": "equal",
                    "value2": "Low"
                  }
                ]
              },
              "renameOutput": "Low Priority"
            }
          ]
        }
      },
      "id": "priority-router",
      "name": "Route by Priority",
      "type": "n8n-nodes-base.switch",
      "position": [680, 300]
    },
    {
      "parameters": {
        "resource": "message",
        "channel": "C1234567890",
        "blocksUi": {
          "blocksValues": [
            {
              "type": "header",
              "headerBlock": {
                "text": "๐Ÿšจ CRITICAL BUG ALERT ๐Ÿšจ"
              }
            },
            {
              "type": "section",
              "sectionBlock": {
                "message": "*Bug ID:* {{ $json.id }}\n*Title:* {{ $json.title }}\n*Priority:* {{ $json.priority }}\n*Status:* {{ $json.status }}",
                "accessory": "button",
                "buttonText": "View Bug",
                "buttonUrl": "={{ $json.url }}"
              }
            },
            {
              "type": "section",
              "sectionBlock": {
                "message": "*Reporter:* {{ $json.reporter }}\n*Assignee:* {{ $json.assignee }}\n*Created:* {{ $json.created }}"
              }
            },
            {
              "type": "section",
              "sectionBlock": {
                "message": "*Description:*\n{{ $json.description }}"
              }
            }
          ]
        }
      },
      "id": "high-priority-slack",
      "name": "Critical Bug Alert",
      "type": "n8n-nodes-base.slack",
      "position": [900, 180],
      "credentials": {
        "slackApi": {
          "id": "slack-credentials",
          "name": "Slack API"
        }
      }
    },
    {
      "parameters": {
        "resource": "message",
        "channel": "C0987654321",
        "blocksUi": {
          "blocksValues": [
            {
              "type": "header",
              "headerBlock": {
                "text": "๐Ÿ› Bug Report"
              }
            },
            {
              "type": "section",
              "sectionBlock": {
                "message": "*{{ $json.title }}*\nID: {{ $json.id }} | Priority: {{ $json.priority }} | Assignee: {{ $json.assignee }}",
                "accessory": "button",
                "buttonText": "View Details",
                "buttonUrl": "={{ $json.url }}"
              }
            }
          ]
        }
      },
      "id": "medium-priority-slack",
      "name": "Medium Priority Bug",
      "type": "n8n-nodes-base.slack",
      "position": [900, 300],
      "credentials": {
        "slackApi": {
          "id": "slack-credentials",
          "name": "Slack API"
        }
      }
    },
    {
      "parameters": {
        "resource": "message",
        "channel": "C5555555555",
        "text": "New low priority bug: {{ $json.title }} (ID: {{ $json.id }}) - {{ $json.url }}"
      },
      "id": "low-priority-slack",
      "name": "Low Priority Bug",
      "type": "n8n-nodes-base.slack",
      "position": [900, 420],
      "credentials": {
        "slackApi": {
          "id": "slack-credentials",
          "name": "Slack API"
        }
      }
    },
    {
      "parameters": {
        "resource": "message",
        "channel": "C1111111111",
        "text": "<!channel> Critical bug needs immediate attention: {{ $json.title }}"
      },
      "id": "team-mention",
      "name": "Alert Team",
      "type": "n8n-nodes-base.slack",
      "position": [1120, 180],
      "credentials": {
        "slackApi": {
          "id": "slack-credentials",
          "name": "Slack API"
        }
      }
    }
  ],
  "connections": {
    "Bug Ticket Webhook": {
      "main": [
        [
          {
            "node": "Process Bug Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Process Bug Data": {
      "main": [
        [
          {
            "node": "Route by Priority",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route by Priority": {
      "main": [
        [
          {
            "node": "Critical Bug Alert",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Medium Priority Bug",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Low Priority Bug",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Critical Bug Alert": {
      "main": [
        [
          {
            "node":