Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 47

Automating Commit Summaries to Chat

Recommended resources

Introduction

In our previous lesson, we successfully parsed the raw payload from a GitHub push event and crafted a formatted, human-readable commit_summary. Your workflow now takes a complex webhook and transforms it into a clean JSON object containing this valuable summary string.

Today, we'll complete this CI/CD notification pipeline. You will learn how to extend the workflow to post the commit_summary you created directly into a chat channel. We will use Slack for this example, as it is widely used in development and operations teams. This bridges the gap between your automation logic in n8n and the real-world communication channels your team uses, which is a fundamental practice for providing visibility into CI/CD processes.


From Data to Notification

The core principle of this lesson is sending the data processed by your workflow to an external service. n8n abstracts the complexity of API calls for popular services like Slack, Discord, or Microsoft Teams into dedicated nodes.

An n8n workflow showing various nodes connecting to a Slack node to post a message. This is a common pattern for sending notifications.

Your task is to add a final node to your workflow that takes the commit_summary and sends it as a message.


Part 1: Create a Slack App and Credentials

Before you can send messages from n8n, you must first create a "bot" identity within Slack and grant it permission to post messages. This is done by creating a Slack App. The process involves configuring the app on Slack's API website and generating a token that n8n will use to authenticate.

This is a one-time setup per bot. The video below provides a clear, step-by-step walkthrough of this entire process.

How to Connect Slack to n8n (2025) (Step-by-Step)

The video "How to Connect Slack to n8n" by Nate Herk is an excellent guide for this setup. It will show you exactly where to click and what to configure.

Watch the segment from the beginning until the end of the credential setup. As you follow along, perform these key actions: Go to api.slack.com/apps and create a new app "From scratch." Navigate to OAuth & Permissions. Under Bot Token Scopes, add the chat:write permission. This is the crucial step that allows your bot to post messages. Click Install to Workspace at the top of the page and allow the installation. Copy the Bot User OAuth Token that is generated. This token is the credential you will use in n8n.

The Educative.io article you've seen before also provides a great text-based summary of this process. It can serve as a useful checklist.

How to build a GitHub PR agent with n8n in 15 minutes - Educative.io

This article details the same Slack App creation process.

Refer to the instructions in Step 7 to see a written breakdown of creating the app, adding the chat:write scope, and obtaining the token.


Part 2: Configure the Slack Node in n8n

With your Bot User OAuth Token copied, you are ready to configure the final node in your n8n workflow.

  1. In your n8n canvas, add a Slack node after the node that generates your commit_summary.
  2. Click on the Slack node to open its parameters. In the Credentials field, select "Create New".
  3. Give your credential a name (e.g., "GitHub Notifier Slack Bot").
  4. Paste the Bot User OAuth Token you copied from the Slack API page into the Access Token field.
  5. Click Save.

Now, configure the message itself:

  • Operation: Set this to Message.
  • Action: Set this to Post.
  • Channel: Choose Select from List. After a moment, a dropdown should populate with the channels in your Slack workspace. Select the channel where you want to post the notifications.
  • Text: This is where you connect the output from your previous work. Click the gears icon and select "Add Expression". Enter the following expression to reference the summary you created in the last lesson:
    {{ $json.commit_summary }}
    

Your Slack node is now fully configured to receive the formatted summary and post it to your designated channel.


Part 3: Test the End-to-End Workflow

There is one final, crucial step before your workflow will succeed. A Slack bot cannot post in a channel it hasn't been invited to.

  1. Go to the Slack channel you selected in the n8n node.
  2. Type @ followed by the name of the app you created (e.g., @PR Summary Bot).
  3. Slack will prompt you to invite the bot to the channel. Accept the invitation.

The video guide you watched earlier demonstrates this exact step and the "not_in_channel" error that occurs if you forget.

How to Connect Slack to n8n (2025) (Step-by-Step)

This short clip shows how to resolve the most common error when sending Slack messages.

Watch the segment from the test execution to see how to invite the bot into the channel.

Once the bot is in the channel, return to your n8n canvas and execute the workflow from the start by clicking Test workflow on the GitHub Trigger node. Within seconds, you should see your formatted commit summary appear as a message from your bot in your Slack channel.


Conclusion

Congratulations! You have now built a complete, automated notification system. Your workflow listens for a specific Git event, parses the incoming data, formats a relevant message, and delivers it to a chat channel. This is a powerful and practical pattern that forms the basis of many CI/CD feedback loops.

Key Takeaways:

  • n8n uses dedicated nodes to integrate with third-party services like Slack.
  • To connect to a service, you typically need to create an application or bot in that service's developer portal, grant it specific permissions (scopes), and generate an API token or key.
  • This token is stored securely in n8n's credential manager.
  • You use n8n expressions like {{ $json.fieldName }} to dynamically pass data from previous nodes into the fields of subsequent nodes.
  • Always remember to complete any service-specific setup, such as inviting a bot into a Slack channel.

In the next module, we will move beyond simply reporting on events and start actively orchestrating CI/CD tasks. You will learn how to use the HTTP Request node to interact with the APIs of tools like Jenkins or GitHub Actions to trigger builds, monitor their status, and create more advanced automations.