# Slack actions

# Requirements

All Slack actions use the Slack Web API (opens new window) to perform recipe actions.

Before using Slack actions, you'll first need to create a Slack app. Check out our Slack trigger documentation to learn more about creating a Slack app.

# Permission scopes

Slack actions are performed on behalf of the user by the connected Slack app. To perform each action, the app has must have the associated permission scope. For example, the Create conversation action uses the conversations.create (opens new window) method, which requires the connected Slack app to have the channels:write scope.

The minimum permissions for optimal use are listed in the table below.

Token type Scope Reason
Bot None No bot scopes required.
User channels:read Retrieves list of public conversations.
channels:write Create/update public conversations.
groups:read Retrieves list of private conversations.
groups:write Create/update private conversations.
im:read Retrieves list of direct message conversations.
im:write Create/update direct message conversations.
mpim:write Create/update multi-party group conversations.
mpim:read Retrieves list of multi-party group conversations.
chat:write Post messages as user.
users:read Get user info.
users:read.email Get user info by email.

To add/remove permission scopes for your app, go to your Slack app's page (it should look something like 'https://api.slack.com/apps/{your_app_id} (opens new window)' — your app ID is unique to your app). Go to OAuth & PermissionsScopes to select your app's permission scopes.

Add permission scopes Remember to click 'Save changes' after selecting your permission scopes!

# Event subscriptions & Permission scopes

Subscribing to events will automatically add scopes that your app does not already have. This may give your app unintended permissions from the additional scopes. After subscribing to events, we strongly recommend going to OAuth & PermissionsScopes to confirm your app's permission scopes.

# Post message actions

The post message action posts a message to your specified channel or user. By default, messages are posted as the authenticated user.

Workato post message Message posted as the authenticated user

For more on custom OAuth profiles, go to our Custom OAuth profiles documentation.

# How it works

Your post messages can just be a simple line of text, or it can include a combination of text, buttons, menus, icons & images — depending on your use case.

# Input fields

# Channel

You can post messages to channels (public & private), or to a specific user.

If you're using channel names to post messages to a channel, prefix them with '#', for example, #support-ticket-101. Otherwise, use channel IDs & channel datapills as-is, for example, CANUXC4MU or Channel respectively.

Channel datapill

Similarly, if you're using user names to post a direct message (DM) to a user, prefix them with '@', for example, @johndoe. Otherwise, use user IDs & user datapills as-is, for example, UA12345 or User ID respectively.

User datapill

# Basic text

This is the most basic text field for a post message.

Basic text How it will look like in Slack

If Allow Slack formatting is enabled, you can tag users in the message by enclosing their user ID or user name with < >, for example, <UA12345> or <@johndoe> for user ID and user name respectively.

# Attachment title

This input adds an attachment title to the post message.

Attachment title How it will look like in Slack

When you provide a valid URL, this field will hyperlink the attachment title, redirecting users there if clicked.

Attachment title link How it will look like in Slack

# Attachment text

This field adds attachment text to the post message, below the attachment title.

Attachment text How it will look like in Slack

# Attachment message fields

This field creates a two-column layout below the message text. Enter one name-value pair per line, for example,Name: John.

Attachment message fields How it will look like in Slack

# Buttons

This field adds a button to the post message. When this button is clicked, it triggers a button click event. Another recipe is required to handle this event. Learn more at about button click triggers in our Slack triggers documentation.

# Button action handler recipes

This field lists any Slack recipes with a button click trigger. Choosing a recipe ensures that button clicks from this button will trigger it.

# Button actions

This field specifies certain characteristics of the button. Enter one button action per line in this format:

action name, action ID, style, confirmation title, confirmation text, ok button title, dismiss button title

For non-danger styled actions, only the first 2 parameters need to be filled in, as there is no popup prompt generated. For danger styled actions, all 7 parameters need to be filled in, for example,

Notify BizDev, bd, , , , ,

Here's an example of a danger-styled button.

Notify Sales, sales, danger, Confirm, Are you sure?, Yes, Cancel

A more detailed description of each button parameter can be seen in the table below.

Button definition input fields Description
Action name Button label visible to Slack user interacting with the buttons.
Action ID Internal value of the button. This needs to be unique. Not visible on Slack to anyone.
Style Leave this field as well as the remaining 4 fields blank for non-danger styled actions since no pop-up will be generated.
Otherwise, put danger to generate a red button with a pop-up prompt, requiring the user to confirm the button click. You will then need to fill up the rest of the fields too.
Confirmation title Shows up in the popup prompt as the header.
Confirmation text Shows up in the popup prompt as the body text.
Ok button title Button label in the popup prompt to confirm the button click.
Dismiss button title Button label in the popup prompt to cancel the button click.

Buttons How it will look like in Slack

# Attachment color

This field allows you to choose the color of the vertical line to the left of the message.

Attachment color How it will look like in Slack

# Thumb URL

When a valid image URL is provided, this field will display a thumb image to the right of the message.

# Image URL

When a valid image URL is provided, this field will display the image at the bottom of the message. Image will be resized to max width of 400px or a max height of 500px.

Image URL How it will look like in Slack

# Allow Slack formatting

When enabled, this field allows you to tag users in the message by enclosing their user ID or user name with < >, for example, <UA12345> or <@johndoe> for user ID and user name respectively.

Tagging users Tagging users by allowing Slack formatting

# Thread ID

Slack threads (opens new window) allow you to group related messages together, making it easier to follow conversations in Slack channels or groups.

To post a message in an existing thread, use the Thread ID datapill in this field. Passing the Message ID of the parent message also works the same way.

# Example #1: Passing a parent message ID to continue a thread

Notify BD thread configuration The parent message's Message ID is used in the Thread ID input field.

Messages are posted under the same thread via parent message ID Messages are posted under the same thread via parent message ID

Check out this Button action example recipe (opens new window) if you want to explore how thread ID works.

If a thread does not exist yet, but you want to post a message threaded under a parent message, supply the Message ID of the parent message.

# Example #2: Passing the message ID to start a thread

Notify BD thread example Thread created and message posted if parent message ID is supplied

Notify BD thread configuration Example use of Message ID used in the Thread ID input field.

# Post message as (deprecated)

This field allows you to change the name of who the message is posted by. By default, messages will be posted as the authenticated user. This field only works for Classic Slack apps. Classic Slack apps (opens new window) are apps that were created before 10 June 2020, utilizing the old umbrella bot scope.

Post message as How it will look like in Slack

# Icon image URL (deprecated)

This field allows you to change the icon of who the message is posted by. By default, messages will be posted as the authenticated user. This field only works for Classic Slack apps. Classic Slack apps (opens new window) are apps that were created before 10 June 2020, utilizing the old umbrella bot scope.

Post message as icon How it will look like in Slack

# Respond to button click actions

The Respond to button click action works together with the button click (real-time) trigger to post messages in response to the button click.

Respond to button action example recipe Respond to button action. See the example recipe (opens new window).

# How it works

By passing the Response URL pill from the output of a button click (real-time) trigger, the recipe will know which button has been clicked at run-time.

Similar to the post message action, this action can post messages that just be a simple line of text, or it can include a combination of text, buttons, menus, icons & images — depending on your use case.

Respond to button action configuration Respond to button action configuration

# Input

The following are the additional input fields that the Slack action Respond to button has on top of the usual input fields in the Post message action.

Input field Description
Button response URL Obtained from the output datatree of the Slack trigger New button action. This tells the action what button click to respond to.
Response type In channel will post the message like a normal chat message. Ephemeral will post the message visible only to the user who clicked the button.
Replace original If yes, the new message will overwrite the original message with buttons and be posted in the same position in the channel.

If no, the original message with buttons will remain in the same position in the channel. The new message will be added to the end of the channel conversation.

Delete original If yes, the original message with buttons will be removed from the channel. The new message will be added to the end of the channel conversation.

If no, the original message with buttons will remain in the same position in the channel. The new message will be added to the end of the channel conversation.

# Invite user to conversation action

The Invite user to conversation action invites a user to a conversation.

Invite user to conversation

# Input fields

# User

You can use either the user ID/name or user ID datapill. Prefix user names with ‘@’, for example, @johndoe. However, use user IDs and user ID datapills as-is, for example, UA12345 or ID, without prefixing them with '@'.

To select available users, switch to 'Select user'. select-user

# Conversation

Select the conversation to invite the user to. Alternatively, you can use a conversation ID or dynamically set one with a channel datapill.

To select available conversations, switch to ‘Select conversation'. select-channel

# Archive conversation action

The Archive conversation action allows you to archive public, private channels, and multi-party groups to which your app has been added. Note that the #general channel of a Slack workspace cannot be archived.

Archive conversation

# Input fields

# Conversation

Select the conversation to archive. Alternatively, you can use a conversation ID or dynamically set one with a channel datapill.

To select available conversations, switch to ‘Select conversation'. select-channel Switching to 'Select channel'

# Unarchive conversation action

The Unarchive conversation action allows you to unarchive public and private channels.

Unarchive conversation

# Input fields

# Conversation

Select the conversation to unarchive. Alternatively, you can use a conversation ID or dynamically set one with a channel datapill.

To select available conversations, switch to ‘Select conversation'. select-channel Switching to 'Select conversation'

# Create conversation action

The Create conversation action creates a channel with a specified channel name. You can also create private channels. Channel names may only contain lowercase letters, numbers, hyphens, and underscores, and must be 80 characters or less.

Create conversation

# Input fields

# Private channel?

Set to 'Yes' to create a private channel. Defaults to 'No'.

# Return channel details if already exists?

By default, if the channel already exists, this action will return an error. Set this input to 'Yes' if to prevent this — action will return the existing channel's details instead. Note that in workspaces with large number of conversations, Workato will only retrieve and search through the first 1000 records given that currently there is no way to filter by conversations by channel name in the Slack API. If no matching entry is found within the first 1000 records, Workato will still return an error.

# Set conversation purpose action

The Set conversation purpose action allows you to set the purpose of a conversation.

Set conversation purpose

# Input fields

# Conversation

Select the conversation for which the purpose is to be set. Alternatively, you can use a conversation ID or dynamically set one with a channel datapill.

To select available conversations, switch to ‘Select conversation'. select-channel Switching to 'Select conversation'

# Conversation purpose

Set the conversation's purpose. Slack formatting works in this field, including tagging of users. For example:

Input

  • "Hi <@johndoe>, how ~you~ *doing*?"

Output

  • Hi @johndoe, how you doing?

Learn more about Slack's message formatting in their documentation (opens new window).

# Set conversation topic action

The Set conversation topic action allows you to set the topic of a conversation.

Set conversation topic

Slack formatting works in this field, including tagging of users. For example:

Input

  • "Hi <@johndoe>, how ~you~ *doing*?"

Output

  • Hi @johndoe, how you doing?

Learn more about Slack's message formatting in their documentation (opens new window).

# Input fields

# Conversation

Select the conversation for which the topic is to be set. Alternatively, you can use a conversation ID or dynamically set one with a channel datapill.

To select available conversations, switch to ‘Select conversations'. select-channel Switching to 'Select conversations'

# Conversations topic

Set the conversation's purpose. Topic must be 250 characters or less. Slack formatting works in this field, including tagging of users. For example:

Input

  • "Hi <@johndoe>, how ~you~ *doing*?"

Output

  • Hi @johndoe, how you doing?

Learn more about Slack's message formatting in their documentation (opens new window).


Last updated: 8/15/2022, 7:20:10 AM