How to automatically create tasks in Notion from Slack (Make automation)


You may exchange communication with team members and/or external partners in Slack. You may manage your projects and tasks in Notion. If that is the case, or you are pondering the idea of using these tools for those jobs, this post may interest you. You can automate tasks creation in Notion from Slack messages, triggered by a reaction to a message. This is the concept we are exploring in this post, which only considers one option of achieving this workflow, although there are other possible solutions, and armed with the knowledge from this post, you may build your own solution. If you receive many messages in Slack and sometimes there are action items derived from them, this automation can prove useful for you, because it would aid you in not letting anything get forgotten or avoided, which increases your capacity for high integrity and reliability, which, ultimately, makes you a person others can entrust with responsibility and kindness.

This post explains how to build automation to create tasks in Notion from Slack messages you receive in a specific channel, triggered by a message reaction. We will be using these tools to achieve our objective: Slack, Notion, and Make. You will need a database in Notion where to send the tasks. And a Make account to create the automated workflow. Before getting started, you will need an Internal Integration Token associated with your Notion workspace where your “Tasks” database is located. You can create one here, and make sure you activate all the integration Capabilities from the dedicated tab. Save the Internal Integration Token somewhere because you will paste it in Make when connecting your Notion workspace. Do not share the Internal Integration Token with other people unless you know why they need it, because the token would give them programmatic access to the pages where the bot has access. Finally, ensure that your bot has access to your target “Tasks” database from the “Connections” option within the three dots at the top right corner of the database. Learn more about Notion Integrations and Connections here.


How to create the workflow - the logic & the automation

We will be using the Slack and Notion APIs to create this automated workflow. That’s because the native Slack Workflows does not have sufficient capabilities to build cross-tool automation like this. Make allows us to access the APIs of these tools through a drag-and-drop interface. We will create two scenarios in Make, both triggered by events in Slack. For a full video walkthrough of the automation, click here.

Scenario 1 - get all messages in a Slack channel

A screenshot of the first Make scenario to save messages from a Slack channel

The first scenario gets all the messages from a Slack channel and stores them in a Data Store. A Data Store is a “backend” table within Make that helps you store data and access them as needed across multiple scenarios. We need this scenario so that we can cross-reference a Slack message timestamp with a reaction parent message timestamp, and find out the message content to use as the Task Name in Notion (scenario 2 below). We need to use this approach because of the structure of the response of the Slack API when “listening to” reactions (documentation here), which does not include the original message ID but does include the original message timestamp.

The first module in this scenario is the Slack “New Event” module in Make. This is a webhook (i.e., an event-based trigger that returns data about a specific event in Slack immediately as the event occurs). When setting up the webhook, select “messages” as the object of the webhook. You will also connect your Slack account following the on-screen prompts in Make. You can select “bot” as the connection type. The second module in the scenario is an “Add/replace a record” Data Store module. You will create a data structure by selecting the “Add” button. I called mine “Slack message reactions”. You will then add all the fields included in the Data Store and their data type. I included a “message_timestamp” text field, a “sent_by” text field, and a “message_content” text field. Once you have concluded the Data Store schema, you can map the values from the trigger into each field in the Data Store. Below you can see how I mapped mine.

Screenshot of the Data Store setup

The mapping of the Slack message data into the Data Store.

Scenario 2 - get reactions to messages in a Slack channel

Screenshot of the automation to send tasks to Notion

A screenshot of the second Make scenario to create tasks in Notion based on Slack message reaction

The second scenario watches for reactions in Slack, searches through the Data Store to retrieve the parent message, and creates a task in Notion when a match is found. We use three modules to achieve this workflow:

  • The Slack “New Event” module, a new webhook (different from the one used in scenario #1 above) that “listens” for reactions to messages in Slack. You can select “reactions” as the object to listen to when creating the webhook. This webhook returns any reaction to a message in Slack. We want the scenario to continue only if the reaction is a specific emoji (⬛ for example) to avoid any Slack message getting turned into a task. So, there is a filter right after this trigger that specifies to continue only if the reaction equals black_large_square. You can pick any emoji based on your preference.

Screenshot of the emoji reaction filter

the filter for the emoji reaction in Make

  • The second module is a “Search Records” Data Store module. You can select the same data structure created in scenario #1 as explained above. And use a compound filter based on the “message_timestamp” and “sent_by” fields, whose values you can map from the trigger Slack module in this scenario. We filter by those fields so that we can find the original message that was reacted to in the Data Store, and if one record is found, we map the “message_content” value to the next module for creating a task in Notion. There is a filter after the “Search Records” module for “key” “exists”. This ensures that the scenario only continues if there is a valid output from the “Search Records” module.

Screenshot of the Search Records module in Make

A screenshot of how the Search Records module is set up.

  • Third, we use a “Create a database item” Notion module, and use your Tasks database ID in the dedicated field within the Make module (make sure your bot has access to that database in Notion - see Connections). In this module, you map the “message_content” value from the Data Store as the task name. There is a limit of 2000 characters on database items’ text properties in Notion via the API. So, you can use this formula to avoid getting an error in the cases where the message_content is > 2000 characters: {{if(length(7.data.message_content) < 2000; 7.data.message_content; substring(7.data.message_content; 0; 1990) + "...")}}

Screenshot of the formula to create tasks in Notion

A screenshot of the Notion “Create a database item” module and the formula used in the task name to avoid getting an error if the length of the message is greater than 2000 characters.


That is all there is to this automation to create Notion tasks from Slack messages, triggered by a reaction. You can activate your two scenarios in Make and they will trigger immediately when new data arrives to the messages and reactions webhooks you created. You may conceptualize the tasks created via this automation as part of your “inbox” (in GTD style), ready to be processed in Notion. You may create a dedicated database view of “unprocessed tasks” in Notion so that you can categorize or act on them later in the day or week.

 
 


Similar Articles


Previous
Previous

Airtable Advanced Fundraising System - the CRM for startups that scale

Next
Next

Notion Projects: ad-hoc features for agile teams