The Ultimate Manual to GitHub-Slack Integration

Every day, hundreds of thousands of developers use GitHub to store and manage their code. The service has made version control and collaboration on software development projects a breeze. However, what’s missing from GitHub is easy real-time communication. This is where Slack comes in.

Slack is a powerful IRC-style chat software designed specifically for work. It allows teams to communicate in chat rooms organized by topic or departments that can be public or private. Slack is more than just a chat software though and offers powerful integrations that allow users to execute commands on integrated apps right from the chat interface.

In this article, we’re going to examine what it means to integrate GitHub with Slack, how this integration works, and can you get started with your own GitHub-Slack integration.

What is the GitHub-Slack Integration Anyway?

Integrating any two apps allows them to “talk” to each other. This is usually done using an API or in simpler words, a bridge of sorts that allows data to flow between the two apps.

When you integrate GitHub with Slack, it becomes possible for the apps to read each other’s data, send notifications of different events in the Slack channels of your choosing, and process inputs from each other in a variety of ways. This lets you use the two apps in conjunction to add real-time communication to your code management processes. 

How the GitHub-Slack Integration Works

The GitHub-Slack integration gives you and your teams a complete view of your GitHub projects directly from your Slack channels. Teams can generate ideas, discuss issues, and work with other teams to make progress on their projects quickly and reliably – all from within the Slack app.

Let’s take a closer look at how the integration works and what it can do for you.

Slash Commands for GitHub Actions

Teams using Slack often reach decisions in their chatrooms. Slash commands allow them to immediately take action on those decisions. Once you’ve successfully integrated GitHub with Slack, you can use Slack’s “slash commands” right from the chat window. Slash commands form the basis of how you can interact with GitHub from Slack. 

The default syntax for slash commands for common GitHub actions is:

/github [action] [resource]

Examples of things you can do with slash commands are:

  • Close an issue or pull request with /github close [issue link]
  • Reopen an issue or pull request with /github reopen [pull request link]
  • Open a new issue with /github open [owner/repo]

Follow Your Team’s Repositories

You can use the subscribe argument with the /github slash command followed by the location of your target repository to follow it. 

Use /github subscribe [owner/repo]

GitHub subscribe

Once you subscribe to a repository, you’ll receive updates on it. The types of updates you receive depend on what kind of notifications you have enabled. The following notifications are enabled by default:

  • Issues – Opened or closed issues
  • Pulls – New or merged pull requests, as well as draft pull requests marked “Ready for Review”
  • Commits – New commits on the default branch (usually main)
  • Deployments – Deployment review notifications and Deployment status updates.

On the other hand, the following types of updates are disabled by default and need to be enabled by the user:

  • Reviews – Pull request reviews.
  • Comments – New comments on issues and pull requests.
  • Branches – Created or deleted branches.
  • Commits:all – All commits pushed to any branch.
  • +label:”your label” – Filter issues, pull requests, and comments based on their labels.
  • Discussions – Discussions created or answered

To enable/disable certain kinds of notifications, use the following slash command format:

To subscribe: /github subscribe [owner/repo] [notification type]

To unsubscribe: /github unsubscribe [owner/repo] [notification type]

See Rich Previews When Sharing Links

When you post a link from GitHub to Slack, its contents show up as a preview in your Slack channel. Previews are enabled for the following types of links:

  • Issues
  • Pull requests 
  • Directly linked comments
  • Code blobs with line numbers
  • Organizations
  • Repositories
  • Users

GitHub example of rich preview when sharing links on Slack

Previews of links are not shown if:

  • Your workplace has disabled link previews for github.com.
  • The same link was already shared within the last 30 minutes in the same channel.
  • The same chat message contains three or more links.
  • The link is for a private repository and the user who shared the link has not signed in to their GitHub account.
  • When prompted, you choose not to show a preview.
  • The GitHub app was not invited to the channel, which you can remedy with /invite @github

Get Updates As You Go

Receive notifications and updates on Slack about the activities taking place on your repositories, such as:

  • New commits
  • New pull requests
  • New issues
  • Code reviews

Example of getting updates on Slack when activities take place on GitHub

Turn Conversations Into Next Steps

Take decisions and actions on issues in the same chat window with the GitHub-Slack integration. Using slash commands, you can:

  • Close an issue or pull request with /github close [issue link]
  • Reopen an issue or pull request with /github open [pull request link]
  • Open a new issue with /github open [owner/repo]

Example of chat window in GitHub-Slack integration

This added functionality helps development teams document everything without a hassle and move their projects forward at a faster pace.

Scheduled Reminders

Scheduled reminders are a priority-setting tool. You can set scheduled reminders to make sure your team members spend their time working on the highest priority review requests that require their attention.

Scheduled reminders for pull requests send a message to the target recipient in Slack, listing open pull requests needing their review at a time of your choosing. You can set these reminders for yourself as well.

For instance, you can configure scheduled reminders such that they message you in Slack at 9 AM every morning, listing pull requests that require a review from you or your team members.

Depending on your needs, you can set up scheduled reminders for yourself, your team, and your organization.

Personal Scheduled Reminders

You can configure personal scheduled reminders as part of your GitHub personal app in Slack. These reminders can be set for personal or team-level review requests for pull requests in organizations you’re a part of. Personal reminders also allow you to set up real-time alerts for your pull requests 

Channel level scheduled reminders

To keep your whole team on top of their priorities, you can configure scheduled reminders for pending pull requests for your Slack channels. For a specific Slack channel, you can set up scheduled reminders for your team or your organization.

Permissions

To complete the GitHub-Slack integration, you’d be required to grant certain permissions to both platforms. Here are the permissions required along with the reasons why they’re necessary:

Slack Permissions

Permission Scope Why is it Required
Access private conversations between you and the App To message you with instructions.
View links to GitHub.com in messages To render rich links from github.com
Add link previews to GitHub.com to messages To render rich links to github.com
Add slash commands To add the /github slash command to your Slack workspace
View the workspace or organization’s name, email domain, and icon To store subscriptions you set up
Post messages as the app To notify you of activity that happens on GitHub in Slack

GitHub Permissions

Permission Scope Why is it Required
Read access to code To render code snippets in Slack
Read access to commit statuses, checks, discussions, issues, metadata, pull requests, and repository projects To render previews of links shared in Slack
Write access to issues, deployments, and pull requests To take action from Slack with the /github command and directly from messages

Example #1: Notification Customization

With the GitHub-Slack integration, you can choose which notifications to subscribe and unsubscribe from based on their relevance and priority for you and your team. For this example, let’s unsubscribe and then resubscribe from the “issues” notifications for the repository “test” by the user “atharalikhan”.

It’s important to note here that we’re running the unsubscribe argument first because we’re already subscribed to the “issues” notifications by default.

The slash command for this would be:

/github unsubscribe atharalikhan/test issues

To resubscribe, enter the following:

/github subscribe atharalikhan/test issues

Here’s what it looks like when you execute these commands in Slack:

Example of executing subscribe and unsubscribe notifications for GitHub in Slack

Notice how the GitHub bot removes and then adds the “Issues” tag after each of the commands, confirming correct execution.

Example #2: Open a New Issue

Using the GitHub-Slack integration, you can directly open and close issues from your Slack chatroom. For this example, let’s open a new issue on a repository called “test” by the user “atharalikhan”. The slash command for this would be:

/github open atharalikhan/test

Upon execution of the command, a new box opens up in Slack, asking for more details about the issue to be created. Enter the required information and click “Open” to complete the task.

Example of opening a new issue in GitHub-Slack integration

Here’s the acknowledgment from the GitHub bot after you create the issue.

Acknowledgment from GitHub bot in Slack after creating an issue

Further confirmation that the issue was created in your GitHub repository:

Confirmation in GitHub repository of issue created

How to Get Started With GitHub-Slack Integration

Step 1: Locate the Integration Page

You can integrate GitHub with Slack in two easy ways:

  1. Slack App Directory
  2. GitHub-Slack Integration Page

In either case, you need to be signed in to your Slack and GitHub accounts for the integration exercise to be successful.

Let’s look at each of the methods in more detail.

Slack App Directory

Slack app directory home page

  • Here, you can use the search option to find the GitHub integration page.

GitHub integration page in Slack app directory

GitHub-Slack Integration Page

Slack.github.com home page

Step 2: Initiate Integration

Slack App Directory

  • From the GitHub App Page in the Slack App Directory, click the “Add to Slack” button to initiate the integration process.
  • The next screen is going to ask you to review and accept app permissions.

Screen asking you to review and accept app permissions for GitHub-Slack integration

  • Click “Allow” to accept the permissions request and move forward with the integration process.

GitHub-Slack Integration Page

  • On the GitHub-Slack Integration page, click the “Add to Slack” button to initiate the integration process.
  • You will receive the same permissions access request as on the Slack App Directory.

Screen asking you to review and accept app permissions for GitHub-Slack integration

  • Click “Allow” to complete the move the integration process forward.

Step 3: Complete the Integration

  • As soon as you click the “Allow” button, your Slack app would be activated where you’d see welcome messages from GitHub.

GitHub welcome message in Slack

  • At this stage, you’re required to connect and authenticate your GitHub as instructed by the GitHub bot. Click the “Connect GitHub account” button to continue.

Screen to finish connecting GitHub account to your Slack account

  • GitHub will present you with another app integration screen. Click “Connect GitHub account” to proceed.
  • On the next screen, you may be asked to sign in to your GitHub account.
  • Once you’re signed in, you’ll be presented with yet another authorization request screen.
  • Click on “Authorize Slack” to move to the next step.

Authorization screen to give permission to Slack to access GitHub account

  • On the next screen, you’re finally going to receive the authorization code you need to complete the integration. Click the “Enter code” button in Slack to get a prompt where you can paste the code.

Screen to complete authentication by typing in verification code for GitHub-Slack integration

  • Upon receiving the correct code, the GitHub bot immediately messages you to confirm the completion of the integration at its end and offers you guidance on what you can do next.

GitHub-Slack login was successful screen with guidance on what to do next

  • After getting confirmation from the GitHub bot in Slack, you can enter your first slash command. For example, let’s use /github unsubscribe [user]/[repository] issues. This sample command will unsubscribe you from notifications about issues created in the repository mentioned.
  • At this point, the GitHub bot is going to ask you to install Slack on your GitHub account. Click “Install GitHub App” to proceed.

Screen to install Slack on GitHub account

  • When installing the Slack app on your GitHub account, you can choose to install it for all repositories or only for a few. Once you’ve made your selection, click “Install”.

Congratulations! You have completed the GitHub-Slack integration!

Step 4: Customize your notifications

Now that you’ve completed the integration, it’s time to decide on what notifications you’d like to receive. 

GitHub makes it simple to customize what gets posted on Slack. Just subscribe to the activities that are relevant for the whole channel to see and unsubscribe from other types that don’t directly concern you or your team. As mentioned before, you can use the following command to manage notification subscriptions:

To subscribe: /github subscribe [owner/repo] [notification type]

To unsubscribe: /github unsubscribe [owner/repo] [notification type]

Incredible companies use Nira

Every company that uses Google Workspace should be using Nira.
Bryan Wise
Bryan Wise,
Former VP of IT at GitLab

Incredible companies use Nira