How to make a Slack bot: Python vs low-code
Learn how to make a custom Slack bot with two approaches: using Python and n8n, a low-code workflow automation tool!
Save yourself the work of writing custom integrations for Webhook and Slack and use n8n instead. Build adaptable and scalable Development, Core Nodes, Communication, and HITL workflows that work with your technology stack. All within a building experience you will love.
In n8n, click the "Add workflow" button in the Workflows tab to create a new workflow. Add the starting point – a trigger on when your workflow should run: an app event, a schedule, a webhook call, another workflow, an AI chat, or a manual trigger. Sometimes, the HTTP Request node might already serve as your starting point.
You can find Webhook and Slack in the nodes panel. Drag them onto your workflow canvas, selecting their actions. Click each node, choose a credential, and authenticate to grant n8n access. Configure Webhook and Slack nodes one by one: input data on the left, parameters in the middle, and output data on the right.
A connection establishes a link between Webhook and Slack (or vice versa) to route data through the workflow. Data flows from the output of one node to the input of another. You can have single or multiple connections for each node.
Use n8n's core nodes such as If, Split Out, Merge, and others to transform and manipulate data. Write custom JavaScript or Python in the Code node and run it as a step in your workflow. Connect Webhook and Slack with any of n8n’s 1000+ integrations, and incorporate advanced AI logic into your workflows.
Save and run the workflow to see if everything works as expected. Based on your configuration, data should flow from Webhook to Slack or vice versa. Easily debug your workflow: you can check past executions to isolate and fix the mistake. Once you've tested everything, make sure to save your workflow and activate it.
Video Demo:
Click here to see a video of this workflow in action.
Summary Description:
The "IT Department Q&A Workflow" is designed to streamline and automate the process of handling IT-related inquiries from employees through Slack. When an employee sends a direct message (DM) to the IT department's Slack channel, the workflow is triggered. The initial step involves the "Receive DMs" node, which listens for new messages. Upon receiving a message, the workflow verifies the webhook by responding to Slack's challenge request, ensuring that the communication channel is active and secure.
Once the webhook is verified, the workflow checks if the message sender is a bot using the "Check if Bot" node. If the sender is identified as a bot, the workflow terminates the process to avoid unnecessary actions. If the sender is a human, the workflow sends an acknowledgment message back to the user, confirming that their query is being processed. This is achieved through the "Send Initial Message" node, which posts a simple message like "On it!" to the user's Slack channel.
The core functionality of the workflow is powered by the "AI Agent" node, which utilizes the OpenAI GPT-4 model to interpret and respond to the user's query. This AI-driven node processes the text of the received message, generating an appropriate response based on the context and information available. To maintain conversation context, the "Window Buffer Memory" node stores the last five messages from each user, ensuring that the AI agent can provide coherent and contextually relevant answers.
Additionally, the workflow includes a custom Knowledge Base (KB) tool (see that tool template here) that integrates with the AI agent, allowing it to search the company's internal KB for relevant information. After generating the response, the workflow cleans up the initial acknowledgment message using the "Delete Initial Message" node to keep the conversation thread clean. Finally, the generated response is sent back to the user via the "Send Message" node, providing them with the information or assistance they requested. This workflow effectively automates the IT support process, reducing response times and improving efficiency.
To quickly deploy the Knowledge Ninja app in Slack, use the app manifest below and don't forget to replace the two sample urls:
{
"display_information": {
"name": "Knowledge Ninja",
"description": "IT Department Q&A Workflow",
"background_color": "#005e5e"
},
"features": {
"bot_user": {
"display_name": "IT Ops AI SlackBot Workflow",
"always_online": true
}
},
"oauth_config": {
"redirect_urls": [
"Replace everything inside the double quotes with your slack redirect oauth url, for example: https://n8n.domain.com/rest/oauth2-credential/callback"
],
"scopes": {
"user": [
"search:read"
],
"bot": [
"chat:write",
"chat:write.customize",
"groups:history",
"groups:read",
"groups:write",
"groups:write.invites",
"groups:write.topic",
"im:history",
"im:read",
"im:write",
"mpim:history",
"mpim:read",
"mpim:write",
"mpim:write.topic",
"usergroups:read",
"usergroups:write",
"users:write",
"channels:history"
]
}
},
"settings": {
"event_subscriptions": {
"request_url": "Replace everything inside the double quotes with your workflow webhook url, for example: https://n8n.domain.com/webhook/99db3e73-57d8-4107-ab02-5b7e713894ad",
"bot_events": [
"message.im"
]
},
"org_deploy_enabled": false,
"socket_mode_enabled": false,
"token_rotation_enabled": false
}
}
Nodes used in this workflow
Create custom Webhook and Slack workflows by choosing triggers and actions. Nodes come with global operations and settings, as well as app-specific parameters that can be configured. You can also use the HTTP Request node to query data from any app or service with a REST API.
Webhooks are automatic notifications that apps send when something occurs. They are sent to a certain URL, which is effectively the app's phone number or address, and contain a message or payload. Polling is nearly never quicker than webhooks, and it takes less effort from you.
Reduce time spent on customer integrations, engineer faster POCs, keep your customer-specific functionality separate from product all without having to code.
Learn more
Learn how to make a custom Slack bot with two approaches: using Python and n8n, a low-code workflow automation tool!

Use n8n to set up automated email reminders, weekly messages, tasks, or even document updates from Google Sheets.
Yes, Webhook can connect with Slack using n8n.io. With n8n, you can create workflows that automate tasks and transfer data between Webhook and Slack. Configure nodes for Webhook and Slack in the n8n interface, specifying actions and triggers to set up their connection.
Yes, with n8n, you can programmatically interact with Webhook’s API via pre-defined supported actions or raw HTTP requests. With the HTTP Request node, you create a REST API call. You need to understand basic API terminology and concepts.
Yes, with n8n, you can programmatically interact with Slack’s API via pre-defined supported actions or raw HTTP requests. With the HTTP Request node, you create a REST API call. You need to understand basic API terminology and concepts.
Yes, it is safe to use n8n to integrate Webhook and Slack. n8n offers various features to ensure the safe handling of your data. These include encrypted data transfers, secure credential storage, RBAC functionality, and compliance with industry-standard security practices (SOC2 compliant). For hosted plans, data is stored within the EU on servers located in Frankfurt, Germany. You can also host it on your own infrastructure for added control.
Learn more about n8n’s security practices here.
To start integrating Webhook and Slack in n8n, you have different options depending on how you intend to use it:
Unlike other platforms that charge per operation, step, or task, n8n charges only for full workflow executions. This approach guarantees predictable costs and scalability, no matter the complexity or volume of your workflows.





Looking to integrate Webhook and Slack in your company?
Build complex workflows, really fast
Handle branching, merging and iteration easily.
Pause your workflow to wait for external events.
Your data is displayed alongside your settings, making edge cases easy to track down.
Use 1000+ workflow templates available from our core team and our community.
Copy and paste, easily import and export workflows.
Report a vulnerability
© 2024 n8n | All rights reserved.

