Okay.
Welcome to Slack Time.
We are now going to do our third and most hardcore integration to the business messaging platform slack.
And you would need to have a workspace, a slack workspace where you have admin permissions to set up
an app, which you might not do.
And if you don't, then just follow along and see what I do.
As a way of getting some experience with OAuth two types of integrations.
If you do, then maybe make one with me.
But here I am in my my own workspace where I have admin permissions because I have this admin thing
here.
And the first thing I'm going to do is go down to apps and workflows and select this, which is where
we go into the app side of slack, because we are going to set up a slack app and slack bot.
Okay.
And so when I press this up comes a web browser and it's on this page here installed apps, and you'll
see a couple of apps that are installed in my workspace, which is my previous attempts to do this.
I've now done it twice successfully, but with with much, uh, much frustration.
But but I did make it work, and so can you.
All right.
The first thing to know.
And sometimes this takes me ages to remember.
This is where it is.
Is that on the top right.
Here you go.
You see that?
There's this navigation over here.
And the first step is to go to build over here.
Uh, so you go over to build.
And when you do that, you come to this screen, which is where there's a screen with a create new app
button.
And that's the one to do create a new app and you select from scratch.
Choose that.
You give it a name.
And this is where I'm going to give it a name of Nate N3 because this is my third time.
All right.
So far so good okay.
And then select a workspace and you have one and then create app.
Here we go.
It's created an app.
And there's stuff in here.
And there's a lot a lot to to to navigate.
There's tons of stuff over here that we are going to be be working on now as we go through this, and
we're going to need to know many of these IDs, because many of them we're going to need to be setting
up when we come to Na ten.
So let's get started.
The first place to go, and perhaps the single most important one is this one OAuth and permissions,
which is where we'll head now.
Okay OAuth and permissions.
Up it comes.
So what we're going to need to do is first of all uh set up what's called scopes.
Now scopes is a standard feature of of this this technology OAuth.
This way that that applications can authenticate themselves against another application.
And scope is saying what is someone entitled to do if they connect this way.
And we have to add in different OAuth scopes for our bot that governs what our app is able to do.
So we're going to click here add OAuth scopes.
And this is where you'll see a large number of different things that we could say our bot is going to
be allowed to do, and I'm going to just show you what the six things are that we need it to be able
to do, and you're just going to put them in.
And I discovered these by not having enough in there and having problems and then coming back and adding
them in.
But there are probably better ways to discover exactly what you need.
But the first one I'm going to do is called app Mentions read.
And as you start typing it filters so you can select it as it says.
That means that that hour is going to be able to read messages directly that that we tag the app in.
So that is done okay.
And now we go to scopes and we press add again.
And we're going to add some more.
We're going to add channels history this one right here okay.
And then we press the add again.
And we're going to do channels read.
Fine.
So far so good.
We're halfway.
We're going to say chat right.
That means it can send messages as and three for you.
It will just be Na ten I imagine.
And now we're going to have Um, I am colon history.
I am colon history, which means that it can view messages that others that in any channels that Nan
has been added to.
And then the last one is going to be users colon read view the people in a workspace.
Okay there we go.
We've set all of these scopes that are going to be permitted.
And then we have to press this install to add button which will be installed to.
And then the name of your workspace, which is saying that that this is now going to allow this OAuth
integration.
So I press that button.
Stuff happens.
Allow NH3 app to access slack.
And you say allow.
And that should happen.
And that has been created.
And we now have this bot user token.
That's a big deal to have that okay.
Onwards.
The other section that we have to look at is the next one down event subscriptions.
So you select this Okay.
What is this about?
So this is how we tell slack.
There are some situations when we are going to want you to make a call out to a call out externally,
like it's going to call a trigger.
Uh, and so we're going to turn this on.
We want to enable events, and we are going to tell uh, slack where it should go.
We're going to give it a URL, which it should hit in order to wake up N810 and say, hey, N810, something
is coming in from slack and we will come back to that.
But we also have to tell it what what events, what things do we want to happen in slack that should
trigger this?
And that's where we say subscribe to bot events and we click Add Bot User Event right here.
And we're going to do app underscore mention subscribe only to the message events that mention your
app or bot.
Okay.
That is what we've done.
We've we've put in this the subscription in here.
And we've turned this on.
We've put in place some of the plumbing.
It's time to go to Nw10.
All right.
It's time for us to do this.
So first up we have to press the Create Workflow button.
And we come in here and we add a first step.
We type slack and it's going to be a trigger.
And we're going to want to trigger on bot app mention.
That's what we want.
Let's do it.
Select credential.
Create a new credential.
Always the first step first thing to do is to put in an access token.
So what is this going to be.
Well for this we need to go back to slack again.
So here we are back in slack.
We're on our ten three.
We're in our apps.
And we're going to go back to OAuth and permissions.
And this is the bot user OAuth token.
And we're going to copy this.
Uh okay.
Now we're going to go back to here.
We're going to go in here and paste that key in there and press save.
Testing connection tested successfully.
That's an important first step.
Now look, there is another thing you can do too.
You can put in a signature secret here, which it does recommend that you do to make the interaction
more secure.
And if you want to do that, then you can you come into here, you go to the basic information and you
can add in a, you can copy the signing secret and put it in there.
But I found I had technical problems with this, so I'm not going to do it.
But if you want to, you can it will give you that extra level of security and you might have to debug
it if it doesn't work at first.
Okay.
So back we go.
Now here let's let's continue to set up this trigger.
All right.
So now we're going to go back back here again.
And we are going to select which channel we want to watch.
That is the important next step.
And before we do that we'll have to go back to slack.
All right so here we are back in slack again, and I'm going to create a new channel by uh, going to
uh, to, to you can see Ngn3 has appeared as a new app.
By the way, I'm going to go to channels, go here and say create a channel, and I'm going to call
this convo three because I've had a few of these already, but you can just call your channel convo
or whatever you want next, and then I'm just going to I'm going to leave it as a public channel for
for this workspace and press create.
And there is convo three.
And now you can choose to invite people to convo three.
I'm going to I'm going to skip for now because we're going to do it right here and now within the convo
three channel I'm going to do slash invite at Nan3.
That is how I invite the uh, the bot and and three into this channel.
It's there.
Okay, one more thing I'm going to do.
I'm going to go up here to the triple dots to the more actions.
I'm going to click in this and I'm going to go to Edit Edit Settings.
And these are the settings for this channel.
And I'm going to scroll down.
And somewhere here I am going to see I think it's under about sorry under about.
Here it is.
There is a channel ID and I'm going to copy that to the clipboard.
It took me a while to find that.
So there we go.
We have the channel ID copied to the clipboard.
Are you following all this.
So we've now got the channel ID to convo three in the clipboard.
Convo three this channel has the bot n8 m3 in it.
Now back to N810.
Here we are back at N810.
You're getting dizzy from this.
It's one way and the other way.
Select the channel to watch.
We go to the drop down here we say by ID and in here we paste that channel ID that we've just done.
And there we have now, uh, selected this this channel as, as uh, the right channel to be listening
to.
Okay, there's one more step and it's a pretty big one.
And we're going to do that in the next video.