Skip to main content

Send a Slack message to channel

Learn how to design an action that sends a Slack message.


In this tutorial, we'll take a closer look designing an action that sends a message to selected Slack channel. We'll start creating an app and then proceed to creating an action from scratch.

You can use such an action to run your workflows. For example, when a new lead is added to your CRM or a new ticket is created in your help desk, you can set your workflows to execute this action automatically.

If you are looking to add the capability to send a Slack message to your action, you can proceed to adding components step.

Step 1. Create a new app

  1. Go to My apps page and add a new app. Select Start from scratch option.

Add a new app

  1. Enter a name for your app. You can optionally enter a description and upload an icon.

Create an app

Step 2. Add Slack connection

  1. Go to App settings tab of your app and create a new connection.

Add connection

  1. Select Slack as connection type and select your Slack workspace.

Add Slack connection

Info

If you do not see any Slack workspace, it means that your Actioner account is not connected with any Slack workspace. Visit connect to Slack page to learn how you can connect your Slack workspace.

Step 3. Create a new action

  1. Go to Actions tab and add a new action.

Add action

  1. Give a name to your action, such as Send Slack message. You can optionally add a description, tags or aliases.

Create Send Slack message action

Step 4. Add components to your action

  1. Add a new input: message. It is a text input. Enable Mandatory option.

message input

  1. Add another input: channel. It is a single select component. Enable Mandatory option.

message input

  1. Add a new Slack request. Select List channels method and give ListSlackChannels name to your request. Then, select your Slack connection.

ListSlackChannels request

  1. Go to channel input and add below values to display and identifier fields:
Display: {{request.ListSlackChannels.response.channels.map(c=>c.name)}}
Identifier: {{request.ListSlackChannels.response.channels.map(c=>c.id)}}

channel input sources

  1. Add a new Slack request. Select Send message to channel method and give SendMessage name to your request. Then, select your Slack connection.

SendMessage request

  1. Go to Channel field, select Dynamic option from the gear button and enter below:
{{input.channel}}

SendMessage Channel field

  1. Enter below to Message field on Markdown block:
{{input.message}}

SendMessage markdown field

  1. Add SendMessage Slack request to Run steps on Inputs tab.

Add SendMessage to Run steps

  1. Apply changes to your action. Make sure to mark it as Enabled while applying changes.

Apply changes to SendMessage