Guides

ADDSLACKCHANNEL formula

Learn how to create Slack channels using Lido.

Click here to book a demo

--

Lido's ADDSLACKCHANNEL() formula lets you create new Slack channels in your workspace. You can customize the channel topic, and invite other users or groups.

=ADDSLACKCHANNEL(slack_credential, channel_name, status_cell, [channel_topic],[channel_members])

As with any Lido formula, there are many ways to set up ADDSLACKCHANNEL to make it the most useful for your workflow. These instructions will take you through configuring it as in the above demo, but they can be adapted without much trouble.

1. Set up your channel name (and topic if you need one)

First, you will need to set up a Computed Column to hold the channel names you want to create for each row of data. Slack restricts channel names so that they can only contain lowercase letters, numbers, hyphens, and underscores, and must be 80 characters or less. In the above demo, we want to create a channel for each lead, where the channel contains their name. To follow this convention, we can use the formula ="lead-" & LOWER(A2), where the cell A2 contains the name for row two. The LOWER() formula makes all the letters in its input text lowercase, and the & adds the prefix "lead-". So our final channel name is lead-alice. If we instead had full names, we would need to replace the space between first and last names with a hyphen, which we could do with the SUBSTITUTE formula, like so:

="lead-" & SUBSTITUTE(LOWER(A2), " ", "-")

which would change Alice Smith into lead-alice-smith.

To make your channel name, write the formula in the second row to the right of your table, and hit enter

If you want a channel topic, create a Computed Column for that as well. In this example, we want to include the date acquired and address information. So we'll create the channel topic column like so, with the formula ="date acquired: " & B2 & "; address: " & C2:

You can rename these columns by editing their header cells. Slack channel topics are limited to 250 characters in length.

2. Set up the ADDSLACKCHANNEL formula

Now you're ready to set up your ADDSLACKCHANNEL formula. This formula will live in another Computed Column, with one for each row.

Type in =ADDSLACKCHANNEL( in the second row to the right of your table. A dropdown will appear with a button to add a Credential. If you already have a Slack Credential, it will appear in the list, and you may select it. If not, click the button to add a Credential. Type in the name for your Slack Credential in the pop-up box, and click "Connect to Slack". You will need to allow Lido to create channels in your workspace. Once finished, you will be brought back to Lido, and your Slack credential will be placed as the first argument of the formula.

Next, we need to fill out the other arguments to ADDSLACKCHANNEL. We have two more required arguments: the channel name, and the status cell. We already have the channel name column filled out, so we can just select the corresponding cell. The status cell is where ADDSLACKCHANNEL will output that it has finished with no errors (with the message success), or it may place error information if not successful. We will create a Linked Column to hold these status messages shortly; for now, just enter the cell directly to the right of your ADDSLACKCHANNEL formula (in our example, that's G2). Now, our formula looks like

=ADDSLACKCHANNEL(<My Slack>, D2, G2

If you don't need a channel topic, and you don't need to add members to the channel, then you can hit Enter and save the formula. In our example, we'll fill in E2 for the channel_topic argument, and enter the name of the Slack group we want to add in the last argument, "Leads Team". Make sure you are not part of any group you invite to the channel; if you are, the group will not be invited, and ADDSLACKCHANNEL will error. You will be added to the channel as well, but for technical reasons this happens on a separate step. With these optional arguments, our formula looks like

=ADDSLACKCHANNEL(<My Slack>, D2, G2, E2, "Leads Team"

We could also invite a user instead of a group. To do this, we will need their Slack User ID, which can be found on their Slack profile.

In that case, our formula would instead look like

=ADDSLACKCHANNEL(<My Slack>, D2, G2, E2, "U12345678".

We can also add any combination of users and groups by using an array for the channel_members argument:

=ADDSLACKCHANNEL(<My Slack>, D2, G2, E2, {"Leads Team", "U12345678"}.

You do not need to invite yourself. ADDSLACKCHANNEL will error if you enter your own User ID.

Submit the formula, and you will have a finished ADDSLACKCHANNEL Computed Column.

Finally, we want to add a Linked Column to hold the status values. Mouse over the right of your table, select the add column icon, and select "Add Linked Column". Select the ID column you would like and hit "Save".

That's everything! ADDSLACKCHANNEL is now ready to use.

To try it out, right-click on one of the ADDSLACKCHANNEL cells and click "Run action". If everything worked, you should see success appear in the Linked Column next to the formula you ran, and a channel with the parameters you selected will have appeared in your Slack workspace. Otherwise, you will see an error appear. Once the error has been fixed, try running the formula again to test it out.


What’s Next

Automate your ADDSLACKCHANNEL column: