Building a GitHub-Slack Bot
This guide will show you how to set up a workflow that sends notifications from GitHub to Slack when a new issue is created.
Features Included in Template
Feature | Workware GitHub Slack Bot Template |
---|---|
Real-time Slack notifications Receive instant updates when new issues are created | |
Slack message templates Select from a set of pre-defined message templates | |
Issue details in Slack Slack message with relevant issue details from GitHub | |
Issue status updates Original Slack message updated with issue status changes | |
Comment notifications New comments are added to the message thread in Slack | |
GitHub to Slack username mapping Map GitHub usernames to Slack usernames in the workflow | |
Customization Customize any aspect of this workflow to fit your needs in n8n |
Prerequisites
- An n8n instance (cloud or self-hosted)
- A GitHub repository
- A Slack workspace
- Basic understanding of GitHub, Slack, and n8n
Get Started with a free trial of n8n Cloud
Sign up for n8n Cloud to start building your automated workflows
Learn more
Step 1: Import Workflow in N8N
1.1 Download Workflow File
- Click the workflow below to visit the workflow details page
- Click the Download button to download the workflow JSON file
- Save the file to your local computer
GitHub Slack Bot Workflow
A workflow to notify Slack when a new issue is created in GitHub
Learn more
1.2 Import Workflow to N8N
- Open your n8n instance
- Create a new workflow
- Click the ... menu in the top right
- Select Import from File...
- Choose the downloaded workflow JSON file

Step 2: Configure Webhook in GitHub
2.1 Create Webhook
- Go to your GitHub repository
- Click Settings > Webhooks > Add webhook
- For the Payload URL, enter your n8n webhook URL
- Set Content type to
application/json
- Select Let me select individual events
- Check only Issues and Issue comments
- Click Add webhook
2.2 Test Webhook
- Create a new issue in your repository
- Check n8n to see if the webhook was triggered
- If successful, you'll see the webhook data in n8n
Step 3: Configure Slack Integration
3.1 Create Slack App
- Go to api.slack.com/apps
- Click Create New App
- Choose From scratch
- Name your app and select your workspace
- Click Create App
3.2 Add Bot Token Scopes
- Go to OAuth & Permissions
- Under Scopes, add these Bot Token Scopes:
chat:write
chat:write.public
chat:write.customize
- Click Install to Workspace
- Copy the Bot User OAuth Token
3.3 Configure n8n Slack Node
- In n8n, double click the Slack node
- Click Add Credentials
- Paste your Bot User OAuth Token
- Select the channel for notifications
- Save the workflow
Step 4: Activate and Test
4.1 Activate Workflow
- Click Active toggle in n8n
- Ensure all credentials are set
4.2 Test End-to-End
- Create a new issue in GitHub
- Check Slack for the notification
- Add a comment to the issue
- Verify the comment appears in the Slack thread
Customization Options
Message Templates
You can customize the Slack message format in the Function node:
// Customize message format
const message = {
text: `New Issue: ${issue.title}`,
blocks: [
{
type: "section",
text: {
type: "mrkdwn",
text: `*New Issue:* ${issue.title}\n${issue.body}`
}
}
]
};
Username Mapping
To map GitHub usernames to Slack usernames:
- Add a Function node before Slack
- Create a mapping object:
const userMap = {
'github-username': '@slack-username'
};
- Replace GitHub usernames in the message
Additional Events
To add more GitHub events:
- Edit webhook in GitHub
- Select additional events
- Add corresponding logic in n8n
Troubleshooting
Common Issues
-
Webhook not triggering
- Check webhook URL
- Verify events are selected
- Check repository permissions
-
Slack messages not sending
- Verify bot token
- Check channel permissions
- Ensure workflow is active
Getting Help
- Check n8n documentation
Best Practices
- Use a dedicated Slack channel for notifications
- Limit webhook events to reduce noise
- Regularly review and update workflow
Security Considerations
- Use HTTPS for webhook URLs
- Limit webhook access to trusted IP ranges
- Rotate Slack bot tokens periodically
Next Steps
- Add more detailed filtering
- Create multi-channel notifications
- Implement issue triage workflows
GuideGitHubSlackIntegration