In this video, I'm going to show you step-by-step how to build your own Slack AI assistant. You can build out a Slack workspace like this with specialized channels where your customers or clients can ask questions, and then your assistant can answer those common questions, and it can even answer more complex questions as well. We'll build out the whole thing on Make, integrate with Slack, and I'll even show you how to set up ChatGPT assistants where you can develop and train your assistants based off of content.
You can use these vector store databases to upload your content. All you have to do is click add and upload it here. and then you can give your assistant special instructions on how to use that data and how to respond which allows you to integrate your assistant together with slack and i'm also using airtable as a database to track all of the messages and the answers so that i can better train the model as we go so i built this because i have a thriving community on the school platform and we promise really great support and so as you can imagine we get a lot of the same questions asked over and over again and the team does have to spend a lot of time answering the same question so we were able to extract all the data from school and then we were able to build out a general knowledge base for the no code architects community and then we connected that to slack in the knowledge base so that you could ask any question related to the community here and then the assistant is able to answer questions directly to our members without having to do it manually and then we also realized we could build more specialized assistance for niche topics we do have an open source project inside of our community called the no code architects toolkit and this channel here responds directly to questions related to a specific api function that we have which is called ffmpeg compose where you can ask it specific questions like how do i merge two videos and then the ncaa assistant will respond directly with how to build the json for merging two videos together using the FFmpeg compose feature.
And then you can also ask follow-up questions like to better explain what's in the JSON. And then it'll explain the whole thing to you. And then your clients can have an ongoing in-depth conversation with your expert AI assistant. All right, so first we're going to go ahead and build out our Airtable database that we use in our automations to store the incoming messages and also the responses.
from the assistants. But if you don't want to build it out yourself and you want to get access to the templates, including the templates for make so you can import the blueprint where you can just click save and the entire automation pops up just like that. Make sure to jump into the no code architects. It's a thriving community. where you can get tech support, a make an Airtable course, and a bunch of other automation templates like the one you're seeing today.
We answer everyone's question, and we've got calls almost every single day. All right, so now let's build out the Airtable database. You will need an Airtable account, and when you first join in, you'll be able to create a new base. Go ahead and start one from scratch. Now it's going to give you a default database just like this.
You can go ahead and close this here. What I recommend doing is just deleting these three columns here. and then just taking a second to rename this to message id this is the only special column we really use here it's called an auto number field so you can come back here and adjust this to message id and then you can scroll down to auto number go ahead and click save and then just take a moment to add the rest of the fields the only other column types we use in this entire project is a long text field and also a single line text field so i'm going to come up here and just show you all of the columns just like that just go through your database and add the message the user the type the timestamp go ahead and spell everything the same way i did the thread timestamp the client message id the team the channel the channel type assistant thread id and assistant response and you can see these are all the single line text and then we have two the long text fields for message and the assistant response so go ahead and build that out it'll look just like this except it won't have the data but you should have all of these columns a single line text and then our long text fields for the message and the assistant response all right so next we're going to go ahead and connect up make with our slack workspace and a specific channel so i'm here in make i'm going to go ahead and create a web hook here we're going to go ahead with a custom web hook do not use a custom mail hook then i'm going to go ahead and add the web hook now i'm going to name it the youtube demo ai slackbot i'll go ahead and click save i'm going to go ahead and click ok i don't need the url quite yet And now I'm going to jump over to api.slack.com.
Here's the app that I already created, which I showed you at the beginning. We're going to go ahead and create a new app. We're going to start from scratch. I'm going to name this app the YouTube Demo AI Slackbot.
And I'm going to add a workspace here. I'm going to install it into the content engine DB. I'm going to go ahead and create the app. It's going to give you a couple of these pop-ups.
You can go ahead and just say, got it. We don't need anything on this screen. First, we're going to jump down to event subscriptions. We're going to turn the events on. And now for the request URL, I'm going to jump back over to make.
And I'm going to jump into the webhook. And I'm going to go ahead and copy the webhook to clipboard. I'm going to go ahead and click OK.
And I am going to go ahead and click run once right now. Because when I jump back here and I put in this webhook, it is going to send a request to that webhook. So if I come back here. we will see that it sent us a challenge now it did fail because we didn't respond with the challenge i'm going to show you how to set that up next and if you need to retry and send that request again you can always just click here but that's why i ran it once before i even put the url in here so that i could be one step ahead so now all i need to do is add one more step here we're going to add a webhook webhook response and now for the body we're just going to add the challenge right back go ahead and click ok i'm going to go ahead and click save i'm going to go ahead and click run once again now i'm going to jump back to the slack api i'm going to go ahead and retry and now it is verified we can see that if i come here it got the request and then sent the challenge back to slack so we're good to go there now what we need to do is subscribe to bot events i'm going to add a bot user event i'm going to type message i'm going to scroll down and we'll do the group message history so this will be alerts for private channels and then we'll add one more message and now this time we're going to go ahead and add in the message channels and we should be good to go. I'm going to go ahead and save changes.
Then we're going to come back over here to install app. I'm going to install to the content engine DB Slack workspace. I'll go ahead and allow.
If I jump back to our workspace, I'm going to go ahead and just refresh here. Then I'm going to go ahead and add a new channel, create a new channel. I'll create a blank channel.
We'll go YouTube demo. We'll go ahead and create. I'm going to skip adding anybody to that for now. Now from here, I'm going to come up to the YouTube demo.
i'm going to go to integrations i'm going to go to add an app now you can see here we have the youtube demo ai slackbot i'm going to go ahead and add that now we've added that to the channel here so now if we come up to make i should be able to delete this webhook response i'm going to go ahead and just run this once i'm going to wait for new data i'm going to come over to our youtube demo i'm going to type test then jump back over to make and now we have that test coming through right here If I jump into the event, we see that test coming through right like that. And that means we're good to go and continue on with the video. And if you're enjoying this video, make sure to like and subscribe to the channel.
That tells me what type of content you want more of. Now, one of the things that I do want to set up first before we try to build out the rest of the make automation is just to get our chat GPT assistant up and running. So I'm going to jump up to OpenAI. You just want to make sure you're logged into OpenAI. I'm currently in the playground, but I'm going to jump over to the main settings.
I'm going to come down to projects. And of course, if you haven't set up your billing yet, you'll want to take care of that first. Using the API and the playground is a different account than your normal chat GPT. So make sure you also get your billing details in for the playground and the API. So I'm going to go ahead and create a new project.
I'm going to call this the YouTube Demo AI Slack Bot. We'll go ahead and create it. Now I'm going to go to API keys. I'm going to create a new secret YouTube demo.
AI Slack bot and then you'll be able to select the project in this case the YouTube demo AI slackbot will create that secret key I'm going to copy that key I'm going to come back to make I'll go ahead and add a new open AI module and we're going to message an assistant I'm going to go ahead and add a new connection I'm going to put in my API key here I'll go ahead and click save. Now, if I come here to assistants, it's not gonna have anything because we didn't actually create it yet. So I'm gonna come back to OpenAI.
Here, I'm gonna go ahead and select the new project. So I'm gonna come to the YouTube demo AI Slack bot. Then I'm gonna jump over to the playground and then I'm gonna come to assistants and then I'm gonna go ahead and create a new assistant. I'm gonna go ahead and call this the FFmpeg Compose Assistant. And for the system instructions, I'm actually gonna jump back and...
grab the system instructions that I already set up here. Now I'm going to jump back to our new bot, and then I'll drop those system instructions here. Basically we're just telling the assistant what they should answer questions on, and more specifically I'm asking it to answer questions on ffmpeg-compose, which is an API endpoint that I created in the no-code architects toolkit.
And then I'm saying unless you're asked more about general questions about ffmpeg, make sure to always answer in the context of my API. And then I also gave it a few sample responses. So I'm going to go ahead and click save.
Now, what I'm going to do here is I'm going to come to the file search and here's where we can add files. This is where we can upload all of the information that our assistant should be aware of. I'm going to add an API guide here.
I'm also going to add a couple of other files, a couple of other specialized files from here. Go ahead and click open. So what it's going to do is it's going to upload these files here as the source of information to use for your AI assistant. So I'll go ahead and attach those.
So now it's building the vector store of the files that we uploaded. So now I should be able to ask a question about FFmpeg Compose, the NCA toolkit endpoint for generating video files. How would I create a JSON for combining two video files?
We'll go ahead and click run. And so now it's going to give me the answer on how to do that. So I'm just telling it to re-encode a special efficiency command that you can call. So now it's going to run the same command, except it's not going to encode the two files.
You don't really need to understand what I'm doing here. I'm just showing you examples of how this new assistant works. This is really the playground where you can test it out. And now that we have this, we should be able to jump back to make. And if we come to our assistants, we should now see one.
We can go ahead and just refresh. and now you can see i have that ffmpeg compose assistant and we are ready to go so i'm going to go ahead and disconnect this module for now we don't need it and now we have everything that we need to build out our entire make automation we have our chat gpt assistant we've built out our slack app and we've connected that to our slack channel we've also run a test and we got that test back here at the webhook so finally you should already have your air table database built out i'm going to go ahead and duplicate the one that i had previously built i'm going to call this the youtube demo.ai.slackbot. I'm not going to duplicate the records.
I'm going to start with the fresh database. Let's go ahead and duplicate the base. I'll go ahead and open that base. You'll just want to make sure that you have yours and it should be a clean database with no rows in it yet. And now we can go ahead and get started.
Now I did want to provide just a little bit more context in terms of what I actually loaded up into my assistant here, just so you understand what you need to upload for your own assistant. Now I didn't upload a ton of information. I wanted a really specific assistant that knew how to handle one specific task.
And so all I did was upload a guide on my FFmpeg compose module. And so what I did was I just created a guideline for how to use the FFmpeg. compose module and different examples of the payload or the json file i need to use in order to get that module to work successfully so i can scroll down here i gave it five different examples i actually had claude write this for me using the actual source code from the ncaa toolkit modules and then we also uploaded the source code from the no code architects toolkit ffmpeg compose modules so i actually provided the source code as well so it was able to read this and really understand how the module actually works.
And that was really all I needed to upload in order to make this assistant function properly. And then of course, again, I updated the system instruction so that it knew its purpose. And it also had some examples as well on top of the files that I uploaded.
All right, so let's keep moving along. I'm going to move this assistant over to the side for a bit because we don't need it quite yet. The first thing that I'm going to do is I'm going to search our existing database.
So again, we have our Airtable database. Here's the YouTube demo AI Slackbot. The first thing that we're going to do is we're going to search the database for an existing thread that may exist for an incoming message.
Now remember the way that Slack works is when you have a message like this, there is a way to reply to that message and then it creates an actual thread. And so we're going to use the Slack thread to isolate everything for a single threaded conversation with the chatbot. so notice the chatbot also has this concept of threads so that as you talk back and forth with the assistant it will keep track of that particular thread and so we're going to connect that thread to the thread in slack so again we're going to come back to our integration here and we are going to search air table for that possibly existing thread and of course if it's just the initial message in the main channel there will not be a thread and will handle both situations so i'm going to come back here to make we're going to go ahead and search records you'll want to make sure you pick a connection that has access to your air table database i'm going to use this youtube demo account and then i'm going to pick the youtube demo ai slack bot and then for the table i'll go ahead and pick table one now for the output field here the only thing you're going to need is the assistant thread id so you can go ahead and check that everything else can be left unchecked and now we need to add in the formula so i'm going to go ahead and copy this in from a previous example you'll want to make sure that you copy this exactly so what we have here is we have an and statement that has three commas in here separating three different expressions here what we're doing is we're searching the database for a row that does not have a thread timestamp so again you're going to want to pause the video and copy this exactly as i have it make sure you match the case of the column names here notice we're referencing the thread timestamp column here and i have it in between these curly braces and then it says does not equal and then there's just two quotes here So it's basically saying that the thread timestamp is not empty. And then we're also saying that the thread timestamp is equal to the event that's coming in from here. Now, you're not going to have this placeholder here.
So I'm going to show you how to build that from scratch. I'm going to erase the one that I have. And I'll also erase this one here.
So to build this out manually, you'll want to make sure to come into these double quotes. And you can put curly brace, curly brace one. dot event dot thread underscore ts and then you put two curly braces to close it out and then here for the user you actually should already have this event here if you come in between your two quotes you should be able to select the event user that came from our initial test when we set up the slack api go ahead and add that in here just like that now that you've put in your formula you can move the limit to just one and then we can go ahead and click okay and now the next thing that we're going to do is we're actually going to create a row for the new message so here what we were doing is we were looking at the existing database to see if there was an existing thread to attach the new message to in this module here we are going to actually write the new message to the database so i'm going to come to air table create a record and again you're going to want to select the same connection that you used in the previous module for the base youtube again youtube demo ai slackbot and for the table we're going to use table one and now what we're going to do here is just basically match up all of the records from the previous example here we're going to go into the message and we'll add the text and you can see our previous test for the user we'll add the user for the type we'll add the type for the timestamp we're going to go ahead and select the ts value here and now for the thread timestamp we have to add a special if clause here we're going to jump to this configuration here with the gear and we're going to use the if empty. We're going to go ahead to this initial opening here and I'm going to go ahead and build my own make placeholder here with a curly brace open open one dot event dot thread time ts and then to close curly braces and then later on when we do actually have that value it will be replaced here and then here we're going to go ahead and add in come back to the star and we're going to add the ts So basically what we're doing here is that when we write the message here, we are either writing the current thread timestamp or we are writing the existing timestamp for a new message which will become the thread timestamp.
The way that Slack knows whether it is a thread or whether it is a new message is based off of this timestamp here. So we're going to add the client message id right here. That is right here.
We'll drop in the team which is right here and we'll put in the channel which is right here. then for the channel type we'll add the channel type and now for the assistant thread id we'll go ahead and use the value that we selected in the search here assistant thread id so now we should be good to go i'm going to go ahead and click ok i'm going to go ahead and run this once and wait for new data it always asks you that question if you've already got some requests in the queue for testing just always use new data so now i'm going to come back to our youtube demo i'm going to go ahead and type test again we'll send that message through come back to make We should see that come through. So it searched for the existing records. Now there shouldn't be anything in there. So the output bundle here is zero.
And that's what we expect because if we go to our Airtable database, we did not have any messages in here until now. Now we have one because we created that record right here. So now what I'm gonna do is I'm gonna go ahead and respond to the user.
But before I do that, I would like to show how the threads and the timestamps work. So if we come in here, notice that we do not see a thread timestamp. but we did record the timestamp of this message in the database so if i come here we have the thread timestamp right now so now i'm going to come back to make i'm going to run once again again i'm going to wait for new data don't use existing data i'm going to wait for new data then i'm going to jump back over here and now i'm going to reply inside of this thread here test 2. and we'll we'll send it we'll jump back to make notice that that message is coming through now notice we're going to have a thread id so there's a thread timestamp so now this search should be coming back with a bundle now because now this formula works it now has a thread timestamp so it was able to find the existing master thread which is in the database here this was the original thread so we have that thread timestamp so all the messages that come inside that thread will have the same thread timestamp because in the make automation again remember in the create record we either send the thread timestamp or if that's empty then we send the event timestamp and that's how we start threads and make sure that we keep track of threads so that each message that comes in we know whether it's part of a thread or whether it's a new message altogether so again back to the next step i'm going to come and add the slack module so that we can send a message go ahead and show more i'm going to create a message I'm going to go ahead and add a new connection. We're going to add a Slack bot. I'm going to go ahead and click save.
This should open up authentication, in which case you can connect it to the proper Slack workspace. In this case, it's the content engine DB. I'm going to give it permissions. Here where it says enter a channel ID or name, I'm going to go ahead and leave that enter manually. And I'll go ahead and use the channel that came from the initial message coming into the system here.
We'll just pass that straight back. And for the text, I'm going to go ahead and say, Hey, and then I'm going to use some special characters here, which will get translated into a name. So I'm going to use a greater than sign and the at symbol. And then I'm going to go ahead and use the user ID here. And then I'm going to close it with a less than.
So this is going to say, hey, user, thanks. Please give me a moment to respond. Dot, dot, dot.
And we can leave blocks empty. I'm going to go ahead and show advanced settings. And then for the thread message ID, I can go ahead and pass in the timestamp. You can leave reply broadcast as empty, link names empty, parse message no. You can leave all of this pretty much the same.
If you have an icon that you want to use for your chatbot when it responds, you can add that. I'll copy in the one that I used in my previous example and I'll also give the username ffmpegassistant and I'll go ahead and click ok. I'll go ahead and click save and I'll go ahead and just run this once.
Again I'll wait for new data. I'll come back to Slack here. and I'll do test number three, send that over to make, jump back to make real quick. So now sending the message back, if we come back here, now we have the FFmpeg assistant responding saying, hey, Steven G Pope, thanks, give me a moment to response. So I spelled that wrong.
So I'll fix that. Respond. and then we'll go ahead and click okay. So now the next thing we need to do is we need to use our assistant so I'm going to go ahead and connect that up now. I'm going to go ahead and jump into our assistant.
It looks like it reset the connection so I'm going to go ahead and change that. Remember we created the ffmpeg together and I'm going to pick the proper assistant and then I'm going to map in the message from Slack. Here we have the event and the text.
Pretty cool you can upload images. Again we're going to use the thread id from the search here. It will either have a thread or it will be empty. make sure not to use the create record we're going to scroll down and use the assistant thread id that we searched for shouldn't need any advanced settings for now i'm going to go ahead and click ok and then from here what i need to do is i need to update air table with the response from the assistant i can also update the thread id that we get from the assistant so that the next time it comes through it uses the same thread so let's go ahead and update the record that we created here go to air table update a record again for the base we're going to use the youtube demo ai slackbot and then for the table go ahead and select the table for the record id we'll use the record id from the module 5. so we'll just add that in here this id here and then the only thing we need to update is the assistant thread id which is going to come out of here which is the thread id here and then the assistant response that'll be this result here and that's all we need we can go ahead and click ok and then we're just going to respond back to the user with our message i'll go ahead and clone this Add this to the end.
We can keep everything here except our response should be the result from the assistant. I'll erase that. We'll give it the result and again we'll keep that thread message ID the timestamp.
Everything else can be the same and we have our icon URL. I'll go ahead and click OK. We'll go ahead and click save. Now before we run this and actually turn it on for good there is a filter here that we need to add because if you notice we're creating messages ourself with Slack. And so these messages are coming into the thread as well, and they are also going to trigger our webhook.
So if we send a message and then that message comes back in, it's gonna create an infinite loop and it's just going to exhaust all of our automations. So I'm gonna come here and I'm going to add the value here. And again, I'm gonna type it in manually because it does not yet exist in our sample data.
I'm gonna come here and do two open curly braces, one.event.bot. id make sure you do everything that i do exactly and then two close curly braces it's going to turn into this little placeholder here and we're just going to come down to this and we're going to say does not exist so when a message comes in it should not have this bot id if it does we're going to filter it out and then we're going to add an and rule we're going to come here and we're going to go to message type this one does exist so we'll go ahead and use it and it should be equal to message and we're going to add one more and rule and we're going to use two open curly braces one dot event dot sub type and then two close curly braces and again we're going to say does not exist and we're going to go ahead and click ok and then we'll go ahead and click save and now we should be able to come down here and turn this on again we're going to wait for new data i'll come back to slack how do i create a json for ffmpeg compose to combine two video files. And I'll go ahead and send that to our make automation, which is gonna ask the FFmpeg compose assistant.
Once it gets a response, it updates Airtable with that response and then messages back to Slack. So we'll come back to Slack. And now we have our response. So now all we need to do is come back to our automation. Let's give it a name, Slack AI bot.
I'll put YouTube. so i know it's the youtube demo then i'm going to go ahead and save it i'll go ahead and back out i'm going to turn it on and when i do i'm going to say delete all the old data we have some old records in the queue we'll delete that old data go ahead and delete and now i'll come back to slack and i'm going to come back to the main channel here and just start a new thread how can i overlay an image over a video in ffmpeg compose i'll go ahead and Send that message. We're going to get that reply. Remember, it's going to say, hey, thanks for the message. Give me a moment to respond.
And now it went ahead and gave me the message for using this endpoint and exactly how to go about doing it. So now I would be able to take this JSON and use that with the FFmpeg API call. And then, of course, you could say, hey, could you explain this JSON to me in more detail? And now because we've set up the automation correctly, it's going to. respond in this thread it's going to say hey give me a second again and then it's going to break down all of the different pieces that we just went through the inputs the filters the outputs the global options and the id which all translates to this here the inputs the filters the outputs the global options and the id i'm going to show you the example that i built out myself that's a little bit more complex one of the main things that you might need from this is just an error handler here what we're doing is that if there's an error in this module here we added an error handler to send a message to the channel that there was an error and then to ignore it and just tell them to try again so if you wanted to add that to yours here we could come to the chat gpt module we could add an error handler and then we can just scroll down to slack we can create a message for the channel id again we'll just use the channel from the original module here so we'll add the channel text we'll go ahead and say sorry we've encountered an error please try again and we'll show the advanced settings just so we put in that thread id if we didn't do that it would send a message back to the main thread here which would not be correct so we'll put in that thread message id again we get that from right here and again if we want to put in the icon url i can grab that i could drop that here ffm peg assistant i'll go ahead and click ok and then i'm going to add one more option here which is just to ignore that means that it won't recover from the error it will just send a message and then ignore and then it will just wait for the next message i'll go ahead and click save and i'll auto align everything so there we go that's a fully functional ai chatbot the message comes in we look for an existing thread save that message we let them know that we got the message we get the response we handle possible errors and then we save the actual response and give that back to the user now one other thing that i did add here which you might be interested in based off of the channel i send it to a different assistant so you can see here in my example that i first showed you here in the no code architects workspace i have a different assistant tied to different channels so all the messages here in the knowledge base go to one assistant and all the messages that come into the ffm compose channel go to a different assistant so to do that all you need to do is add a route and then you filter based off of the channel so you can see i have the channel id here and then you can see i'm passing the message to that assistant right here if there's an error i respond please try again and then instead of updating air table and sending the response because i have multiple assistants that might be called i set a variable with the thread id and the result and i do that for both channels here that way i can have a third route that handles the response from either this assistant or this assistant it gets the variables that either one of these assistants would have set.
So here again we set the same variables, the result and the thread ID. And so we get that result and thread ID right here in a get variable. And then we finally do the same thing that we did here in this module here, where we update the record that we created and then we send back the response.
So here we're doing the same thing, it's just that we're using the variables instead of the values that come directly out of the ChatGPT assistant. So you can see here we're updating the thread id and the assistant response from the get variable and then we simply respond with the result that was in one of the set variables that we got here where we saved the output from our chat gpt assistant so again if you want this more advanced template that's already built out and access to the air table template make sure to jump into the no code architects community you can jump right to the classroom to the automation vault you'll get immediate access to the blueprints and a thriving community where you can get tech support or join the almost daily calls where you can talk to me personally i hope to see you there either way i hope you enjoyed this video and i'll see you in the next one