What?
You're probably about ready to kill me from how hard this is being with slack.
And we're only halfway.
But this is about as hard as they get.
And I tell you, once you've done a few of these integrations, they get easier and easier.
You, like, build the basic building blocks of these integrations, and they're often quite similar.
Okay, we're back now in N810.
We're looking at the slack trigger node, which is exactly where we left it.
And we've put in the channel ID we've got everything set up here.
There's there's one thing that's left to do.
You remember when we were in slack?
We left something blank.
It's where we were setting up the the part that tells slack.
How does it call when a message comes in?
And the way we do that is on this screen, there's this little collapsed swizzle here called webhook
URLs and webhooks.
These are the things which external systems can call into to trigger n810 and tell N810 something has
happened.
And it's a webhook we have to use now for for slack to inform N810 that a message has arrived and actually
gives us two.
It gives us one to be used for testing and one for production.
And we're going to start.
You can see you can toggle between them here.
We're going to start by looking at the test one.
And you click here to copy it into the clipboard.
And just before we go back to slack again that's what we're going to do.
I just want you to press this execute step button so that this is starting to listen.
It's listening right now.
It's listening for this webhook.
And now we're going to go back to slack and give it a try.
And here we go.
We're at slack right now.
And I am now going to to come to the event subscriptions page.
And I realize I know I set this up before I forgot to press the save changes button down there, which
is really easy to do with slack.
So we're going to have to fill in this page again and be careful of that.
I've done that many times okay.
We're going to turn enable events on.
We're going to change.
Subscribe to bot events.
This is the thing I did before.
We're going to put in here a app mention.
That's the one.
There it is.
And now the request URL.
I'm going to press paste to paste in that webhook.
And look at that.
It says verified and it only says verify because I've got that trigger running.
And if you don't it's going to say yellow not verified.
And it's a right bore.
And all I can do is tell you to keep trying until verified comes on.
But it took me many times to get verified to appear, and now you press save changes and that's done.
Success.
We've hooked up the slack trigger part of the story okay.
And now we're going to go back to my workflow.
So we do now have this this working hopefully so that in slack we could be now sending messages.
Well next up we're going to do the usual stuff.
We're going to put on an AI agent at least.
If nothing else we're getting really good at this.
We will give it an open AI model.
Open OpenAI chat model.
For now, we're not going to worry about memory or tools.
We just want to worry about what goes on the other side of this.
We want it to be slack.
And here we go.
And we're going to want it to put basically to be able to, uh, to do a message.
We're going to want it to, to to send a message.
That's what we want.
Here we are.
Okay.
So we're going to connect with with slack.
We are going to have a resource be a message.
The operations should be send.
We're going to send the message to a channel.
The channel we're going to pick an ID.
And I've just gone and copied that channel ID again from slack pasting it in there.
That's the same channel ID.
It's a simple text message.
Okay.
That's done.
Now you can probably guess that the message text is where we're going to have some problems, because
we're going to want to have some sort of expression based on the data right here.
And you may or may not remember what that JSON looks like.
See if you can.
But for now, let's just put the word bananas.
Let's have it be a fixed string.
Let's now go back and give this thing a whirl.
Okay.
First up I'm going to press Execute Workflow so that it starts waiting for an event.
I'm going to go back over to slack.
Let's make this slack window a bit smaller.
So we get to see all this.
And basically in slack I'm going to message the bot itself and say hi there.
Press enter and keep fingers crossed.
And oh it ran.
There was a problem but it ran okay.
The trigger worked.
If the trigger didn't work for you, you have to go through and check everything really carefully,
but hopefully it did.
Hopefully we just got slack to send a webhook into our workflow.
Okay, onwards.
So our workflow had an error and the error was no prompt specified.
And that's familiar because we had that before when we were were working with a slightly simpler integration,
uh, with, with telegram.
So if I double click on it, you can see what's happening.
It's exactly the same thing.
It thinks it's trying to connect to a chat trigger node and it's looking for JSON chat input.
But that's not what we're getting from slack.
And so it's confused.
So we know what to do.
We don't want this.
We want to change this to define below, giving us the opportunity to say, hey, how do you unpack
this JSON?
Pluck out the thing that you want this.
Hi there and put it in here in order to to select that as the message.
So there's a few things we could do here.
We could just drag this and drop it here and get a bunch of, of this sort of um, description, this
expression which drills in to find this.
But actually that's not what I want to do.
What I want to do is I want to, to give all of this JSON as it is, as JSON to our AI agent and say,
hey, we've got this message from slack.
You're smart enough to know how to read JSON.
Please respond to this fully understanding what's going on here?
So that's that's what I'm going to say.
I'm going to put as the prompt here, please respond to this message from slack.
And then I'm going to put a couple of empty lines.
And then I want to shove in this JSON as it is.
So unfortunately if I just type now something like I put an expression and I just do dollar JSON when
I do that, what gets put here is some sort of funny JavaScript object object thing, because this is
JSON, it's not text and I don't know if you remember, but I mentioned that there's a way to turn JSON
into a text version of that JSON and you just, you know, I'll show it to you.
It's you type json.stringify, which is a special thing.
And then you put this in brackets like that and bam, as soon as I've done that.
And this is just one of those things, you can always look it up if you ever need to know it.
Now the message going to the LLM is please respond to this message from slack.
And then there is a bunch of JSON shoved in there.
Okay, now you could also do it the way I showed you before.
You could give it a try.
See what happens.
But I want to do it this way.
And it's useful to let the LLM unpack the JSON.
Let's see how it does.
Okay.
So press escape to come back here I press the execute button to start things going.
I go back to slack and I'm going to repeat this this same message a second time.
Let's do that again.
Let me paste that in.
Send.
Hi there.
And it's all running over here.
Stuff is happening.
We've got some ticks and it came back with bananas.
Okay, okay.
We did a round trip.
It was all brilliant with one small caveat.
Just a small, small thing, which is that we just got the hard coded word bananas.
So the final, the final piece of the puzzle is to make it actually respond from our AI agent.
Let's do that now.
So back we are here in slack.
I'm double clicking on send a message up it comes and we don't want the message text to be the word
bananas.
What do we want?
Well, first up, we want to change this from being fixed to being an expression.
And now do you remember how we do this?
Do you remember how you do the expression?
See if you can remember.
And of course, the cheat is simply to drag from here and drop it here and you'll see exactly what it
is.
It's dollar JSON output, just as it was with telegram.
We're collecting the output of the JSON that's coming in and taking, taking, taking the thing that
is at the key output.
And so at this point I can now press escape, I can come back here and we can give this a try.
Okay.
So I press Execute workflow I have the thing running I go back to slack I'm going to paste one more
time.
Hi there.
Press enter see what happens.
Yes I see things are running.
Things are running.
Hi there.
How can I assist you today?
We did it.
We just had a round trip to slack.
We used Oauth2 for the credentials.
For the authentication.
We set up a webhook so that slack could could send that message in to NHSN.
And we got the round trip coming back.
And we even used expressions as a way of hooking everything up.
It held together.
We did it.
Congratulations.
There is one more thing left to do, and that is to push this to production and to deploy to production.
There's one more hoop we have to jump through.
And that is, of course, to change the webhook.
You remember the slack trigger.
Double click on this.
In this there is the setting here which is telling us where should slack call to to update this this
trigger.
And it's set to a test URL.
Right now I want to look at the production URL.
This is the production URL.
That's the test one that we already hooked up to.
This is the production one.
Click to copy the URL.
So I click and that's been copied to the clipboard okay.
Now I'm just going to press the execute step button to have this thing running.
I'm going to go back to slack.
We are going to go to event subscriptions.
Here it is.
We're going to press the change here.
We want to change the URL.
This is the URL that slack calls when a message comes in.
Change.
What's the new.
This is the previous one.
We go to the new one and we paste the new URL in there.
It doesn't have tests anymore.
And then I'm didn't respond.
Aha.
Now I realize of course I made a little mistake there.
We don't want to do this.
In order for this production URL to run, we actually have to publish this properly.
We're going to have to come back here and publish it into production.
Just before I do that, I might add in a date node as well.
Just why not?
Let's do this.
This is our new favorite thing to do get the current date.
We will put that in there as well.
And now with that in mind I'm going to publish this publish Publish.
Off it goes.
It is now running in production.
So now we'll come back here again.
Back to slack.
We will retry this and it's verified.
It works.
We've deployed to production.
So this webhook was received.
So now don't forget to press save changes I always forget to press save changes.
It says success.
Has it been successful?
Let's give it a whirl.
Let's find out okay.
We're going to go back.
This is this is showing the production deployed uh workflow.
We're going to go back to slack now and I'm going to, uh, send our usual.
Hi there.
And we'll see what happens.
There's no nothing going on around here.
And we get back from production.
Hi, there.
How can I help you today?
Well, this time we are going to we're going to send this message again.
But we're going to ask, of course, for the current date, what's the current date And see how it does.
Off it goes.
The current date December 15th.
Yes, it used the date tool correctly.
Everything is working.
We have been able to just do a round trip with N810 in production from slack.
It felt like quite a palaver, but we got it done.
And I hope that you did too.
All right, I'll see you for the wrap.
So there you have it.
We did three integrations.
The push pushover was quite simple.
Telegram was and slack was quite hardcore, but we got through them all.
They're all working.
I hopefully you picked a couple of them and did it too.
Most important, you've got a better sense of things like OAuth two of using webhooks as the way that
slack was able to send in that message.
And you've got your first experience writing expressions, and even at looking back at a prior node
and using Json.stringify.
So just some insights to different pieces.
And it honestly, it doesn't matter if you wouldn't know how to go in and do this yourself right now,
because we're going to do lots of these and over time you'll get more and more confident, and you can
always check out the docs for any of these integrations.
And they're pretty good.
And it's been a big day, but the day is done.
We work with data, we did a bit of expressions and then we built three robust integrations.
Communicating one was a one way communication with pushover and then two two way integrations with telegram
and with slack.
And you saw that idea of the trigger and then the pushing back to the platform.
So much got done.
Fantastic.
Well, tomorrow is when we actually build a business project.
And once you've made once you've put these integrations in place, using them is so easy.
It's wonderful.
So if today was a little bit grueling, I hope to make up for it tomorrow.
And I will see you then.
And just take a moment to recognize your 27% of the way through building your expertise.
See you tomorrow.