Skip to main content
Send Slack messages from Coda

Learn how to send messages in Slack, directly from your Coda doc.

Updated over 6 months ago

You can use the Slack Pack to send Slack messages directly from your Coda doc with the click of a button. This makes managing tasks and your team even easier. Before you begin, install the Slack pack to your Coda doc. Visit our Slack Pack basics article for instructions on how to install.

Within this article you’ll find...


Options for sending Slack messages

Once you've authenticated with the Slack pack, you can send Slack messages directly from inside your doc. There are two main Coda building blocks that you can use to do so:

  • Buttons: Buttons can exist either in tables or in the canvas of your doc. When clicked by someone in the doc, buttons perform an action. To learn more about creating buttons, check out this article.

  • Automations: Automations perform actions automatically, either on a regular cadence or when certain criteria are met. To learn more about creating automations, check out this article.

This article will primarily describe how to set up buttons for Slack messages, but know that most of the information also applies to setting up automations.

Create a Slack message button

To create buttons that send a Slack messages, just follow these steps:

  1. If you haven’t yet, create the canvas button or button column you wish to use. To create a canvas button, simply type /button in the canvas of your doc. To create a button column, add a new column to your table and choose button as the column type.

    1. Check out this article if you need more info on creating buttons.

  2. Once created, right-click on the button to open the settings.

  3. In the On click field, choose Send message or notify user.

  4. In the Send as field, choose Slack from the options.

    1. If you haven’t yet added the Slack Pack, you’ll be prompted to do so now.

  5. Choose the Mode for the button.

    1. Private means that each person who clicks the button will have to connect their own Slack account. Shared means that each person who clicks the button will use whatever shared Slack account is listed in the button.

  6. Connect either the shared or private account that you’ll be using. This will be the Slack account that the message will come from.

    1. Check out this article for more info on connecting Pack accounts.

  7. Now it’s time to customize your button. Jump to the next section for more instructions on this.

create new slack message button.gif

Customize your Slack message button

Now that you have the basics of your button (or automation) set up, and you’ve connected to a Slack account, it’s time for the details: content, format, recipients, etc.

Create and format message content

In the settings of your button or automation, you can write out the content of your message (in the Content field). You can use the @ symbol to reference people, pages, tables, and more.

You can even create dynamic text using the formula builder. Just type = into the Content field, and the formula builder will open. If your button is part of a button column, you can use the formula builder to dynamically pull text from that row of your table. Check out the example below to see this in practice.

Additionally, you can add formatting to your text in this Content field. If you bold, italicize, and underline text, this formatting will carry through to Slack. Hyperlinks will also be preserved.

slack button compose example .gif

💡Tip: Next to the Content field, you can click on the icon with the arrows to expand. You will also see previews of what the message will look like for each row in the table (if your button is in a table).

Choose your message destination

In the Channel or email field, choose where to send your Slack message. You can post a the message in Slack channels or send the message to someone directly as a DM.

  • To send as a DM to an individual user, just enter the email address associated with the Slack account for that user. The email field is not case-sensitive, so it can be upper or lower case.

  • To send to a public channel, enter the channel name, including the hashtag. For instance, #channel-name. Note that the channel name must be all lower case.

  • To send to a private channel or to a multi-user DM, you’ll need to grab the channel ID (rather than the name) from Slack, and paste it into this field. Note that the channel ID must match exactly what's shown in Slack and must be all upper case.

💡Tip: You can also use formulas in this field (just type = to open the formula builder, which allows the destination channel or email to be dynamic. Check out the example below to see this in practice.

Add additional fields

There are several optional fields you can also use in your Slack message button setup. Each of these fields should show a small ? near the field name, which reveals more info about the field when hovered over. Below are some of the more commonly used fields:

  • Results column: Pick a column in your Coda table, and this results column will be populated with a code whenever the Slack button successfully sends a message for that row. This is a way to confirm that the Slack message was sent.

  • Thread timestamp: Use this field if you want your button to send Slack messages as a reply to an existing thread. Put the timestamp of said thread into this field, so Coda knows which thread to send to.

  • No unfurl: This checkbox tells Slack whether or not to unfurl any links that may be included in the message.

Example

Pulling it all together, here is an example of when you might use a Slack message button and how you’d set it up.

Let’s say you have a table of tasks, called Tasks. This table has columns for Task Name, Assignee, Due Date, and Status. You want to be able to send Slack messages from this table, so you add a button column (called Slack message). Following the steps in the section above, you make set this button to send Slack messages when clicked.

Specifically, you want to use this Slack button to notify assignees whenever their task is past due and incomplete. You want the message to include the name of the task. Since there are different tasks and different assignees, the content of the message and the recipient of the message will change per row. You can use some simple thisRow formulas in the Content field and Channel or email field of your Slack button settings to accomplish this.

  • In the Content field of the button settings, type = to open the formula builder. Then type thisRow.TaskName. Outside of the formula editor, you can add any other static text you’d like (ex: The following task is overdue: ).

  • In the Channel or email field of the button settings, type = to open the formula builder. Then type thisRow.TaskName.email. Since the assignee is a People column (which contains a few data points), you need to include the .email to extract just the email address of the assignee.

Here’s how that will look in practice:

NEW set up slack button with thisrow.gif

As you can see in the example above, when you expand the Content field, you can then see previews of how the message will look for each row in the table.

That’s it! Now when you click that Slack button, a message will be sent to the correct assignee containing the relevant task name.


FAQs

Who will the Slack message be from?

The Slack message will be sent from whichever Slack account is being used to push the button. If the Slack button is set to private mode, then each person who clicks the button will have to connect their own Slack account. Therefore, the message will come from that specific user. If the Slack button is set to shared mode, then the Slack message will always come from whichever shared account is set in the button settings.

Can I send Slack messages from Slack Bot?

No, there isn’t currently any way to send messages from Slack Bot. Messages will always come from an individual Slack user.

Can I include hyperlinks in my Slack message?

Yes. The new Content field of your Slack button or automation settings allows for even easier composing and formatting. Simply add your hyperlinks to your message, just as you would in the canvas of a Coda doc (cmd + k keyboard shortcut). These hyperlinks will seamlessly carry over to Slack.

Can I send my Slack message as a reply to a thread?

Yes you can! Within the settings of your Slack message button, click on Add more, then select Thread timestamp. In the Thread timestamp field, add the timestamp of the thread that you want to reply to.

1_1 (24).png

How do I create an automation that sends Slack messages?

To set up an automation that sends Slack messages, just choose the Send message or notify user action in the Then step of your automation. Then from the Send as field, choose Slack. From there, the setup is just like setting up a Slack button. So you can follow the steps in this article to complete the setup.

💡Tip: If you’ve already built Slack message buttons, you can create an automation that simply presses these buttons.

Can I send Slack messages to myself?

Technically you can send Slack messages to yourself from Coda. But if you are using your own Slack account as the sender for these messages, then you won’t be notified in Slack when these messages are sent.


Related resources

Did this answer your question?