Make AI Agents (New)
Create AI agents for different...
Slack-triggered AI agent
5 min
this slack triggered ai agent {{scenario singular lowercase}} watches a slack channel for new user messages and the agent replies to them prerequisites a slack account with a private channel for interacting with the agent while a private channel is more convenient for testing, you can use either a private or public channel step 1 add a watch new events module the slack > watch new events module watches your slack channel for new messages, so the agent receives them when they arrive to add a watch new events module in the {{scenario singular}} builder, click the giant plus in the app search, search for and click slack click watch new events in webhook name , name your webhook to identify it later in event type , select the following from the dropdown new private channel message (for a private channel) new channel message (for a public channel) in connection , click add to create a new slack connection or select an existing one from the dropdown in channel , select the channel that you set up earlier click save test the slack > watch new events module click run once on the {{scenario singular}} toolbar in slack, send a message in your channel in the {{scenario singular}} builder, click the output bubble next to the module to view the data items in an output bundle for example, the text value is the user message if you've sent a message to your slack channel, but the module hasn't received data yet wait a few minutes slack webhooks sometimes delay in detecting messages stop the {{scenario singular lowercase}} run and click the down arrow next to run once to run the {{scenario singular lowercase}} using data from a previous run you've now added the slack > watch new events module to your {{scenario singular lowercase}} step 2 add a send a message module now that you've added a module that sends new slack messages to your agent, add a slack > send a message module to allow the agent to reply to them to add a slack > send a message module in the {{scenario singular}} builder, click the plus icon next to the slack > watch new events module in the app search, click slack search for and click send a message in connection , select your slack connection in channel id or name , click the field and map the channel value from the slack > watch new events module in text , configure the reply click the field and map the text value from the slack > watch new events module before the text value, enter custom text, such as "agent ", to specify that the reply is from an agent without this text, the agent won't distinguish user and agent messages, causing it to reply to itself in an infinite loop later, you'll filter messages with the "agent " text, so the agent only processes user messages optionally, to distinguish between agents and users most clearly, https //apps make com/slack#obtain your client credentials in slack and create a bot connection this way requires a more complex setup toggle advanced settings in thread message id (time stamp) , enter a function for slack timestamps click the field, and search for and click the ifempty function in the function, before the semicolon, map the thread timestamp value from the slack > watch new events module after the semicolon, map the timestamp value from the slack > watch new events module you use a function here so that the agent replies in the slack thread after receiving the first message the function covers two types of slack timestamps timestamp the identifier of the first message of the slack thread thread timestamp the identifier of the slack thread once the thread has a reply (unavailable for the first message) click save click save on the {{scenario singular}} toolbar right click the route between the modules and select set up a filter set up a filter that allows only user messages to pass through, so the agent doesn't reply to itself in an infinite loop in label , name your label "only user messages " in condition , map the text value from the slack > watch new events module, select text operators does not contain , and enter "agent " click save test the slack > send a message module click run once on the {{scenario singular}} toolbar in slack, send a message in your channel check if you see a reply in the same thread beginning with "agent " in the same thread this means the module works toggle immediately as data arrives on the {{scenario singular}} toolbar to activate the {{scenario singular lowercase}} , so that the {{scenario singular lowercase}} automatically receives new messages from slack click save click save on the {{scenario singular}} toolbar you've now added your slack modules to your {{scenario singular lowercase}} step 3 add a run an agent module to finish your {{scenario singular lowercase}} , add the make ai agents (new) > run an agent module to add the run an agent module right click the route between the slack modules and select add a module in the app search, search for and click make ai agents (new) select the run an agent module in the module settings, in connection , select an existing ai provider connection from the dropdown or click add to create a new one if you don't want to set up an account with an ai provider, select make's ai provider in model , select a small model smaller models react quickly to new data, which is ideal for this chat based ai agent in instructions , describe who the agent is and what it does for example, "you are a helpful agent answer with a warm and friendly tone " for now, the sample instructions provided are sufficient later, you can tailor them to the agent's workflow in input , map the text value from the slack > watch new events module this action gives the agent access to incoming slack messages in conversation id, enter the same function that you added to the thread message id (time stamp) field in the add a send a message module step this action allows the agent to remember previous exchanges with a user, and provide contextual responses when the user asks follow up questions in the same thread click save click the slack > send a message module in text , keep the custom "agent " text and replace the text value with the response value from the run an agent module this action allows the agent to reply with its own response click save click save on the {{scenario singular}} toolbar send a message to your channel in slack to check if the agent works you've now built a slack triggered ai agent {{scenario singular lowercase}}