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
- Go to My apps page and add a new app. Select Start from scratch option.
- Enter a name for your app. You can optionally enter a description and upload an icon.
Step 2. Add Slack connection
- Go to App settings tab of your app and create a new connection.
- Select Slack as connection type and select your Slack workspace.
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
- Go to Actions tab and add a new action.
- Give a name to your action, such as Send Slack message. You can optionally add a description, tags or aliases.
Step 4. Add components to your action
- Add a new input:
message
. It is a text input. Enable Mandatory option.
- Add another input:
channel
. It is a single select component. Enable Mandatory option.
- Add a new Slack request. Select List channels method and give
ListSlackChannels
name to your request. Then, select your Slack connection.
- 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)}}
- Add a new Slack request. Select Send message to channel method and give
SendMessage
name to your request. Then, select your Slack connection.
- Go to Channel field, select Dynamic option from the gear button and enter below:
{{input.channel}}
- Enter below to Message field on Markdown block:
{{input.message}}
- Add
SendMessage
Slack request to Run steps on Inputs tab.
- Apply changes to your action. Make sure to mark it as Enabled while applying changes.