# n8n at SCALE: Mission Control in Slack Pt 2: Deploying Slack Apps for Seamless n8n Integration

## Метаданные

- **Канал:** n8n
- **YouTube:** https://www.youtube.com/watch?v=z4JuK4qPJ1E
- **Дата:** 31.12.2024
- **Длительность:** 37:17
- **Просмотры:** 4,253

## Описание

Deploying Slack Apps for Seamless n8n Integration | n8n at Scale Episode 2

Welcome to the second episode of the n8n at Scale series! In this episode, Angel Menendez, Staff Developer Advocate at n8n, continues the exploration of n8n and Slack integration. He provides an in-depth overview of deploying Slack apps, setting permissions, and using different functionalities like incoming webhooks, interactivity and shortcuts, slash commands, and event subscriptions. Watch as Angel walks you through creating and managing Slack apps for streamlined automation and enhanced collaboration within your workspace.

Want to connect? Find me on social media and reach out to me directly: 
- LinkedIn: https://www.linkedin.com/in/angelgmenendez/
- X: https://x.com/djangelic

00:00 Introduction to N8N at Scale
00:59 Understanding Slack Apps and Their Importance
02:22 Creating and Installing a Slack App
04:21 Exploring Slack App Functionalities
10:23 Setting Permissions and Scopes
16:20 Testing and Deploying the Slack App
19:22 Hello World Test
19:33 User Token vs Bot Token
21:02 Incoming Webhooks
23:25 Slash Commands
27:27 Interactivity and Shortcuts
30:34 Event Subscriptions
35:21 Summary and Export

## Содержание

### [0:00](https://www.youtube.com/watch?v=z4JuK4qPJ1E) Introduction to N8N at Scale

hello everyone and Welcome to our second episode of n8n at scale once again I'm your host Angel Menendez staff developer advocate here at nadn I'm looking forward to following up on our previous episode of nadn at scale Mission Control Center in slack today's will be part two deploying slack apps for seamless NN integration let's go ahead and Dive Right In today's episode we're going to be talking about mission control again within slack why slack app integration matters we're going to be doing an overview of the slack app builder sections we're going to be doing a detailed walkthrough of setting and permissions across a few different demos of different workflows that I have that demonstrate the functionality within slack some best practices for app deployment with an anaden and we're going to summarize at the end so let's talk big picture what are

### [0:59](https://www.youtube.com/watch?v=z4JuK4qPJ1E&t=59s) Understanding Slack Apps and Their Importance

slack apps slack requires you to deploy an app in order for you to connect it to nadn so think of this the slack app as the intermediary that does the connection between n8n and the slack interface slack apps can be installed in workspaces so this allows you to deploy it within your organization and slack apps can be then added to channels individually this allows for you to have more granular controls of your slack app deployments now when I'm talking about the slack app I'm talking about this user interface that we're looking at here on the right hand side so you can think of this as a home for all of your Scopes and your permissions and it has different functionalities that you can turn on and off some of these functionalities you may need some of them you may not so we're going to be talking about some of the most common functionalities Within These slack apps that you need to utilize and it's good for you to understand in order for you to utilize nadn to your benefit now right off the bat I know it can be a little bit confusing and slack doesn't make it easy on us one of the things that I'd like to point out is the URL api. slack. com apps this is where you're going to want to go to essentially create your own slack app before we dive into it we're

### [2:22](https://www.youtube.com/watch?v=z4JuK4qPJ1E&t=142s) Creating and Installing a Slack App

going to actually go through the process of uh creating a slack app and essentially installing it into our workspace but before we do let's take a quick look at the authentication flow of creating a slack app so within slack you can essentially see here that it's not as simple as just getting an API key and being set it's a little bit more complex than that so the first step we're going to do today is we're going to be creating a slack app and again that can be found at api. slack. com apps next we're going to Grant it permissions and Scopes so in order to utilize the slack app we do need to turn on certain permissions and we're going to be taking a deeper dive into this once we've given the slack app the permissions we need we're going to go ahead and install it to our workspace this isn't too difficult to do and typically we it pops up automatically as permissions and Scopes changes once it's installed we're able if needed to install it to different slack channels so we're going to dive a little B deeper into that now this is optional if you're using something like the interactivity and shortcuts and you don't need to post into any specific Channel this is not needed we can skip this but we will be going through it today just to show how simple it is then we need to decide on whether we want to use an ooth credential or a bot token now these do have different functionalities so if you utilize ooth whenever you post in a slack Channel it will display as your username and Avatar it will not show up as the slack app however if you use the bot token that will show up as the slack app's name so I tend to use the bot token more depending on the need lastly we'll go ahead and create our n8n credential and then we'll test our functionality in n8n let's take a

### [4:21](https://www.youtube.com/watch?v=z4JuK4qPJ1E&t=261s) Exploring Slack App Functionalities

look now before we dive into these demos let's take a quick look at what features are available and what we'll be covering today so there are some functionality that we will not be covering in today's video mostly because I haven't built a lot of content with these features but they still exist and they are still very powerful and they should work just fine with nadn because most of these features utilize block kit which we covered in our previous video let's take a quick look at what functionality is available so slack allows us to do something called an app Home is like a dashboard that displays dynamic content within an app this allows you to do things like display calendars or different UI elements using block kit directly within a centralized location next up we have agents and assistants so this allows you to deploy AI assistants or other chat-based tools this is a fairly new functionality that's been added recently so we won't be covering this either additionally workflow steps slack has its own built-in autom aut a tool called workflows now you can actually build modular automations within workflow to deploy essentially like n8n nodes or blocks again this is very a fairly new functionality so we won't be covering it in today's video now what we will be covering today is these four functionalities so incoming web hooks which is a fairly simple functionality within Slack interactivity and shortcuts this is probably one of my favorites you can do so much with interactivity and shortcuts essentially building your own UI on top of Slack's interface next up we're going to be covering slash commands are a simple way of getting inputs into your app they essentially take in a single string input which essentially makes things fairly simple as far as what you can do there's really not a lot of input validation that we can do other than saying hey we weren't able to get something but it is something we will cover because sometimes that's all you need is a single string input and last but not least we're going to touch on event subscriptions now you can think of event subscriptions is essentially your slack app listening to a slack Channel and as messages are posted it receives every single one of those and it can be set to process that data in whatever way you choose so again very powerful although you need to think through what you want it to do so let's dive in so let's start with an incoming web hook again great for simple non-authenticated slack connections or simple messages need to be sent to a specific Channel via web Hub let's take a quick look at the functionality here and before we do that let's actually visit the slack apps all right so this is where we want to be so the api. slack. com apppp so from here you can create your own slack apps for the sake of today's video and because there's so much authentication keys that are going to be shown at the end of this video I'm going to be deleting this app that we're going to be creating today but let's go ahead and go through the process as you can see I've already got quite a few slack apps here deployed and we're going to be deploying this in nadn Labs now one of the things to keep in mind is you can actually back up your slack apps and deploy them as a Json file which makes sending them or essentially deploying them very simple and easy or we can start from scratch which is what we're going to be doing today so we're going to go ahead and give it a name so we're going to call this sample slack app and our workspace we're going to be deploying this in nadn Labs so we're going to go ahead and create our app pretty straightforward and here we go all right so now we've got our basic information so this here on the left are our tabs and here on the middle we have the functionality that we want to focus for the sake of what we're doing today we don't need to worry too much about this functionality these again we've got our app level tokens display information for now the only thing I'm going to focus on under the basic information is the display info one of the things I do like to do is give my app a cool code name I find that if we utilize a code name our teams are more likely to remember it and if it's something fun or exciting then we typic typically are able to essentially get more employee Buy in and in Enterprise level organizations sometimes this is the most fun we can have so it's good to come up with fun exciting names and I even like to give my apps fun icons I find that chat GPT is great for this both for generating lists of app names descriptions and even generating a slack avatars and then we essentially can give it a long description just so that the team knows what it's for and last but not least if it's something if we want to go ahead and delete it this is what I'll be doing at the end of the video today we'll just delete the app let's dive into it so here under collaborators essentially you can invite other slack users to manage your app this gives you the ability to Grant additional functionality make the tool work a little bit more collaboratively and that way you don't have a single point of failure so always a good idea to work with the team whenever you're deploying these slack apps so that you have multiple eyes on what you're deploying now we're going to go ahead and Skip socket mode in theory I believe socket mode is supported in n8n but it is not a simple to it is not very simple to deploy and I've have very little experience with it so we're going to go ahead and skip this let's go ahead and go into install app so before we can

### [10:23](https://www.youtube.com/watch?v=z4JuK4qPJ1E&t=623s) Setting Permissions and Scopes

get into this we do need to give it some kind of permission or scope so we're going to be diving into this here in just a moment and manage distribution if you build a super app that you feel needs to be Expos to the world under manage distribution we can essentially deploy it out to the world so something to keep in mind here's the functionality we're looking at for now I'm going to be focusing on oath and permissions so let's go ahead and scroll down for the ooth authentication we will need to add our instance um redirect URL this is available within the n8n credential so we'll take a look at that in a moment and here is what we're looking for so Scopes are essentially the permissions for your apps to do things within slack Itself by default these apps do not have any permissions to do anything in this case it's not even deployed to our nadn workspace let's go ahead and take a look at some of the permissions scopes that we have now slack being a messaging Channel or a messaging chat platform one of the main things we're going to be doing is sending messages in channels so I like to do a search for channels and as you can see here they're pretty straightforward and well described so you can understand essentially what you're doing so for example view messages and other content in public channels that the slack app has been installed has been added to that's pretty important if I want to do a search within a specific Channel sometimes to see if content has already been posted this is almost a requirement so additionally let's go ahead and we want to be able to join public channels we want to read about public channels that exist so this allows the nadn node to be able to give a list of the different channels within the workspace so this gives it the slack op the power to create new uh channels or even manage them so let's take a look let's see here we can write invites that's if we want to invite new members so if we wanted to create a bot that onboarded new members to specific for example onboarding channels we could do that create a topic for the channels and here we go chat WR public so send messages to channels oh that sample slack app isn't a member of so this is still not even what I'm looking for let's take a look and actually so what we'll do is we'll just go ahead and search for so chat right send so this is one of the main ones so send messages is a sample slack app Channel very important this allows us to just post in different channels that we're in and then chat right public so for public slap slack channels that this app isn't a part of this will granted that permission so for now again there's a lot of different permissions here another one that's important is start direct messages with individuals I'm going to go ahead and give it that and just go through here we'll do a few more oh add shortcuts in our slash commands we're going to need that and let's do I am here so I'm going to do I am most of the read and the slack app NAD in documentation does a great job of kind of going through which ones are best to utilize oh files read and right this is good for uploading uh files if you utilize that functionality but for now we're going to do incoming web hook and I think events nope that one we good and I recommend essentially go through this figure out which ones you need but for now we're going to go ahead and move on to the next function I'm just going to make sure that there's nothing I'm missing here one of the more useful permissions is this chat WR customize this allows you to customize essentially who your slack app posts as so you could actually change your profile image and your avatar and your username uh to something else so if you have different app names or different function fun alties you want to deploy within one slack app you can do that using this we'll look at this in here a moment in just a moment now these are the bot token Scopes we're going to be talking a little bit more about the difference between these two but here we have ooth Scopes very similar so if I do right you'll see that there's slightly different permissions here available so here we go this allows us to send if we were to utilize the ooth we would be able to send a message on behalf of for example my user account instead of the bot uh account so we'll go ahead and for now just give it that and we'll also give it I am right all right perfect so that's essentially it so now we could also further protect our instance by restricting API token usage to specific IP addresses so essentially what we can do is if we know our nadn instances IPS we can set them here and that will further protect even if one of these API Keys is exposed it's not a problem as long as the calls are being made from this IP address or this range we'll be all right so something to keep in mind and lastly if we need to revoke all ooth tokens now that we've gone ahead and

### [16:20](https://www.youtube.com/watch?v=z4JuK4qPJ1E&t=980s) Testing and Deploying the Slack App

given it more permissions what we can do is we can install this app to our workspace so let's go ahead and do that now as you can see it's giving it's asking us for permission and it wants to know where it can post as in case essentially I believe this is for the incoming web hook so I'm just going to go ahead and put let's do the ideas channel for now we'll give it just a moment and there we go so now here we have our ooth tokens and we have our bot user token so this is what I'm going to utilize in my slack app or I'm sorry my slack Ann node for essentially posting our messages so we'll take a look at that here in just a moment now that we've gone ahead and done that let's take a look at our UI so here we are in our n8n labs and if we scroll down to the bottom we can go ahead and add apps and there it is as you can see it's already been installed to our instance so our sample slack app now what we can do is we can go ahead and in install this to different channels so essentially let's go ahead and click on n8n errors we'll go ahead and go to Integrations and as you can see we have our knowledge ninja so that's another slack app that I've deployed internally so I'm going to go ahead and add oh we reached our limit here so that's fine because all we're going to do is do our sample slack app so there we go we've added our sample slack app Here and Now essentially we can post here to naden errors so we're going to go ahead and test that here in a moment and that's essentially it so what I'm going to do is I'm going to go ahead and copy my bot user token and let's go ahead and go into our slack one of our slack apps here and let's go ahead and create a new credential and we're going to use our access token and paste and we'll call this sample slack app bot token and we'll go ahead and hit save there we go and as you can see it was tested successfully great it's exactly what we want and it is now working now let's go ahead and test this so if we go ahead and pull up a new slack app we'll just go ahead and do send a message we'll go ahead and choose our there it is sample slack app Send a message we'll do channel oh we didn't give it the right permission that's why we can't see it but that's okay I know that we've added that app to nadn errors so I'm going to go ahead and copy the channel ID down here and I'm just going to go ahead and bu ID paste that here so now let's go

### [19:22](https://www.youtube.com/watch?v=z4JuK4qPJ1E&t=1162s) Hello World Test

ahead and do a Hello World test there we go let's see if we got it there it is Hello World excellent that's exactly what we're looking for now if we

### [19:33](https://www.youtube.com/watch?v=z4JuK4qPJ1E&t=1173s) User Token vs Bot Token

were to use the user token let's see what that would look like so let's go ahead and paste that we'll do sample slack app user token all right let's go ahead and retest this and there it is it's as if I posted it so as you can see the difference here it is very important which of these two credential types you utilize otherwise it's going to determine who you post as so like for example here what we could do is change the profile photo and send as user because we gave it that permission so if we give it a different image we can display a image and if we send as a user test app or actually let's do something a little funner here so Jedi bot we'll go ahead and test the message and as you can see it's still sending it under our user now if we change this to the bot token and try again there's our Jedi bot so again if you use the user it's not going to allow you to change who you're posting as you do need to use the bot token in order to that now that we've gone ahead and

### [21:02](https://www.youtube.com/watch?v=z4JuK4qPJ1E&t=1262s) Incoming Webhooks

created this let's go ahead and understand some more of the different functionalities so let's start with our incoming web hook that was the first one that we were looking at so to deploy this let's take a look here at incoming hooks now incoming web hooks are essentially a little bit simpler they don't even require really authentication unless you have some kind of Ip based uh restrictions but essentially it allows any app that uses web hooks to send a message into slack and from there it'll post a simple message now one of the things I really appreciate is that they give you this curl example here which we can utilize so I'm going to go ahead and copy this and here is our HTTP request node now I've already filled this out but I'm going to go ahead and for the sake of Simplicity show how simple is to deploy this so I'm going to go ahead and use the HTTP request and I'm just going to import curl and there we go we're ready to go so this is going to post to the ideas Channel instead and I'm going to go ahead and test and there we go hello world so very simple doesn't even require any authentication and here we can type in whatever we want and it'll essentially post it to one specific channel so here if we go back we can create a new one so add a new web uh web hook so let's do errors nadn errors and we'll go ahead allow there we go so nadn errors we'll go ahead and copy that URL let's go ahead and switch to the other channel and all we have to do here is change the url we'll go ahead and test and there it is again hello world so as you can see functionality is very limited here but it is very simple to get up and running very easy to deploy and anyone with that URL can post directly to the channel in question now the likelihood of information being stolen is low because you're only sending data in you can't receive data out so that covers essentially our incoming web hook next up let's take a

### [23:25](https://www.youtube.com/watch?v=z4JuK4qPJ1E&t=1405s) Slash Commands

look at our slash commands so this is great for simple apps that require a single string input our demo today takes in a service now ticket so let's take a look at that so here we go now you'll notice I don't have any slack nodes here we've only got the web hook nodes so let's see how this works I'm going to go ahead and copy this URL there it is so this is our test URL and let's go back into the slack app and let's take a look at Slack SL commands so we're going to go ahead and create a new command we're going to call this service now incident and the request URL this is the nadn web hook URL and here we're going to do query incident ID and then here we'll put incident ID to let the user know what string we expect so in this case just a single input and this is how it's going to look so now what we're going to do is we're going to go ahead and hit save there we are excellent and now this is ready to go so let's go ahead and head back into our service now there it is right here and let's go ahead and get the actual incident ID here believe it's this one it won't matter here we're not going to we're going to get an output no matter what and what we're going to do is we're going to head back into here and what we're going to do is hit a backs slash and snow here it is and now it's expecting the input so I'll just go ahead and paste and what we're going to do is hit enter o we forgot to turn it on let's go ahead and turn on the list listener oops and it doesn't like that there's no credentials here so we'll just create a simple credential here that's okay it doesn't have to work and let's try this once more oops there it is excellent so let's take a look at what happened here so essentially we were able to trigger this workflow now let's take a look at the execution and let's copy this to our editor so we can see the path excellent so this is what happened here so essentially we are let's go ahead and close these out excellent so here as you can see we received that web hook call and we included this text input so this text input essentially passed it into here we extracted the value that was sent into our incident search so here is our service now incident search and then here we see if we got a response or not so either we got we get an error which we will notify that hey this isn't working something's broken or incident not found also a possibility or the last one we did find it and as you can see here we're using block kit as we talked about from our previous webinar to display the content in this much nicer UI so it's broken up into these two columns and we've got Bolding in the message just essentially a little bit nicer UI here as far as notifications so that essentially covers our slash commands SL commands here essentially allow you to pass in a single string as an input into slack and then respond accordingly all right now let's go ahead and move on to the next

### [27:27](https://www.youtube.com/watch?v=z4JuK4qPJ1E&t=1647s) Interactivity and Shortcuts

one our next one is our interactivity and shortcut so this one we demoed in our last work but let's take a look at this once again anyway so if I want to deploy this what we're going to do is we're going to head into our interactivity and shortcuts here on the left and we're going to go ahead and turn this on now we will need a URL so what we're going to do is we're going to go ahead and use an existing one our image upload bot so I'm just going to go ahead and copy this and paste it into here so there we go and then we need to create a shortcut to trigger this so let's go ahead and create a global shortcut and we'll call this image upload test and then we're going to create a short description samplebot image upload and the action ID is specific to here so let's go ahead and see what we use for our action ID I believe it was either idea selector if I'm not mistaken we'll try that and then we'll go ahead and create and we're going to leave the uh menus out of it for now we'll cover that again in a future video and we'll go ahead and save changes and there we are now let's go ahead and try this so I do need to hit test workflow so I'm going to go ahead and unpin this and hit test and then let's go to image oh looks like it hasn't loaded now if you do see this happen usually it just means that the uh UI has not loaded the specific command so let's take one last look through here let's see if we need to deploy it nope all right so usually closing out the slack interface and then reopening it typically fixes these issues so we'll go ahead and close it give it a moment to load there we go back and any in8 in Labs now if I do sample there it is image upload test excellent so let's go ahead and select it and there we are so that went ahead and triggered it so let's go ahead and see what happened so here we go we got it oh and we did do idea selector so we did set the correct um callback ID we responded to slack with success and we displayed this popup UI so again I find that this is one of the most powerful UI of slacks builds because it essentially allows you to create custom uis within the slack interface itself now I've covered this in much greater detail in my part one of this series so I'm going to go ahead and move on but if you curious as to how this works check out video one for more information excellent last but not least is our

### [30:34](https://www.youtube.com/watch?v=z4JuK4qPJ1E&t=1834s) Event Subscriptions

event subscriptions so essentially this is good for listening in to different channels so let's take a look at how to deploy this as well so I'm going to go ahead and go into event subscriptions and again we're going to go ahead and turn this on and let's go ahead and pull up our event listener here and I've copied the URL and we're going to go ahead and paste it now we want to be careful because as you can see it errored out that's because it did not respond back with a challenge so it's actually pretty straightforward we have our verify web hook here and here's the Challenger basically sending back the information that we're receiving now because this was not turned on or running it didn't work so I'm going to go ahead and test it I'm going to tell it to retry and it's now verified good to go now this periodically I believe it's every two hours or so runs to test that the URL is listening so if we go back here you'll notice that I have a do nothing step so this is if it's a verification check it just does nothing it just verifies the web hook and moves on with its life now if there is a message in here then we will go ahead and process it accordingly so I'm going to go ahead and turn off the function it here and essentially what we're going to do is we're going to go ahead and fire off a message here so I'm going to go ahead and let's go back to our subscription so we can subscribe to events on behalf of users or bots so in this particular case we're going to go ahead and add a bot user event so different events allow you to listen to different things so in this case we're going to do messages so let's find the messages section here so here we go message. channels so we're going to go ahead and select that so a message was posted to a channel and actually better yet let's go ahead and let's only listen to whenever the bot is called let's go ahead and delete this one and let's do at mention and let's go ahead and hit save now you'll notice because of this change in scope we do need to reinstall the app into our workspace so essentially making sure that everything is good so we're going to choose ideas allow and there we go so now let's go ahead and head back here and I'm just going to go ahead and mention the app and before I do let's go ahead and turn this on and there it is so it received it checks it didn't pass the checks because it's this was built for something else but essentially as you can see it's listening now let's try one more let's go ahead and do that Channel or message I am let's see if we can get it to trigger on a simple message all right there we go so we we're going to go ahead and add the permission message. channels let's go ahead and see if we received that so I'm going to come back here we're going to go ahead and start listening and this is a test message now I don't believe that worked because it was a private Channel as seen here with the little lock so that is different than a public channel so let's go ahead and add another scope there we go private Channel save we do need to reinstall we'll go ahead and do NAD and errors allow there we go now let's go ahead and start listening again and this is a test there it is so as you can see now it is listening for basically any messages that come into the channel hello world there we are so essentially you can build a flow that is constantly listening to these messages that flow into these channels whether it's a public or a private Channel as you can see here and essentially that concludes

### [35:21](https://www.youtube.com/watch?v=z4JuK4qPJ1E&t=2121s) Summary and Export

it so let's go ahead and do a quick summary of what we've covered today so we've talked a little bit about the different features that are usable within slack and how to deploy these within the slack UI one thing we didn't cover was how to export these permissions so as you can imagine building these permissions can be difficult so if I want to deploy this in a different workspace for example it's very easy to export or for example if you need permission from another team member to deploy your sample Slack app internally in an Enterprise organization what I found is deploying your own slack instance first for free is usually best building it out making it work then requesting permission from the IT department or if you are the it Ops Department awesome you're good to go otherwise asking they'll ask what permissions do you need for your slack app that can be a very difficult question to answer so instead what you can do is click on app manifest here you can copy to clipboard and say hey here's the app manifest these are all the permissions URLs everything we need to essentially deploy this app and you can just pass them this Json and it allows you to quickly redeploy this app in a live instance much faster so again to summarize we've covered essentially how to deploy the slack apps how to use the credentials with an n8n and how to fire them off now I will be deleting this slack app here but other than that I hope that this was an informative video and I hope this walks you through the more difficult aspects of deploying a slack app internally I hope you enjoy and I hope you have a wonderful day take care

---
*Источник: https://ekstraktznaniy.ru/video/15506*