Slack

The Slack Node allows you to connect with your Slack account and retrieve data from specific channels through StackAI's App for Slack. You can also deploy a custom bot for full control over branding and configuration.

Please review our privacy policy before you install the application.

Disclaimer: StackAI uses advanced generative AI technology to assist users directly within Slack by answering questions, summarizing discussions, and generating helpful content. Please note that AI-generated responses may occasionally be inaccurate or incomplete. StackAI does not use Slack data to train its models, and all user data is handled in accordance with our data retention and security policies.

Adding StackAI's App for Slack

The StackAI App for Slack can be added to both private and shared channels in your Slack workspace. Below, we'll guide you through the steps required:

Step 1: Select Slack (OAuth2) as a New Connection

Step 2: Choose a Channel and Allow Access

You will see a pop-up window with StackAI requesting access.

Select a channel to validate the connection. This is the channel your app will be able to post to. Your app will also inherit your user permissions and be able to read from all the channels you have access to.

Step 3: Ensure the Connection is Selected

You can test the connection to make sure you are connected using the "Test" button.

Step 4: Use Your Slack App

Select the actions you would like to use in Slack. To run the actions, make sure you have the parameters filled out.


Available Actions

1. Search Slack Messages (slack_search_messages)

  • Description: Search for messages across the Slack workspace using query parameters with optional channel filtering.

  • Inputs:

    • query (string, required): Search query to find messages in the Slack workspace. Supports advanced search syntax like 'from:@user', 'in:#channel', date ranges, etc. Example: "project update from:@John

    • channels (array of strings, optional): List of channel IDs to filter search results. We simplify the process by adding a multi-selector that automatically retrieves all the available channels. If empty, searches all accessible channels

    • count (number, optional): Maximum number of search results to return. Default: 20, Maximum: 100

    • sort (string, optional): Sort results by timestamp or relevance score. Default: "timestamp"

    • sort_dir (string, optional): Sort direction. Options: "asc" or "desc". Default: "desc"

    • highlight (boolean, optional): Whether to highlight matching terms in results. Default: true

  • Outputs:

    • query (string): The search query that was executed (with channel filters applied)

    • total_matches (number): Total number of messages matching the search query

    • messages (array): List of messages matching the search query. Each message contains: text, user, username, timestamp, channel_id, channel_name, permalink, is_thread_reply, parent_timestamp

    • has_more (boolean): Whether there are more results available

2. Send a Message (slack_message)

  • Description: Send a message to a Slack channel.

  • Inputs:

    • message (string, required): Content/body of the message you want to send

    • channel_id (string, required): The Slack channel to send the message to

    • Dynamic options populated from available channels

  • Outputs:

    • channel_id (string): The Slack channel ID where the message was sent

    • results (string): The status of the message sent (confirmation or error)

    • message_ts (string): Slack message timestamp (unique identifier)

3. Send Message and Wait for Response (slack_send_and_wait_block_kit)

  • Description: Send a Slack message that collects an approval or free-text response using modern Block Kit.

  • Inputs:

    • message (string, required): Content/body of the interactive message

    • channel_id (string, required): The Slack channel to send the interactive message to

    • response_type (string, required): Choose response type. Options: "approval" (buttons) or "free_text" (opens modal to collect text). Default: "approval"

    • button_text (string, optional): Text displayed on the primary interactive button. Default: "Approve"

    • include_disapprove (boolean, optional): If true, include a Disapprove button. Default: true

    • disapprove_button_text (string, optional): Text displayed on the disapprove button. Default: "Disapprove"

    • free_text_placeholder (string, optional): Placeholder for the modal's text input. Used when response_type is "free_text"

    • block_id (string, optional): Unique identifier for the top section block

    • button_style (string, optional): Visual style. Options: "primary", "danger" or default

  • Outputs:

    • channel_id (string): The Slack channel ID where the interactive message was sent

    • results (string): The status of the interactive message sent

    • message_ts (string): Slack message timestamp (unique identifier)

    • resume_output (object, optional): User interaction data when workflow resumes

Note: Remember if you are using your own connection to enable Interactivity and include the https://api.stack-ai.com/workflow/v1/resume url, as explained in the connection. This is critical, otherwise you will not be able to resume the workflow.

4. Upload File (slack_upload_file)

  • Description: Upload files to Slack using modern external upload workflow with multiple source options.

  • Inputs:

    • source_url (string, optional): URL to download file from.

    • bytes_b64 (string, optional): Base64 encoded file content.

    • text (string, optional): Raw text content to upload as a file.

    • filename (string, optional): Name of the file. Required for bytes_b64 and text modes. Optional for source_url (inferred from URL).

    • title (string, optional): Title for the file (defaults to filename).

    • content_type (string, optional): MIME type of the file. Auto-set to 'text/plain' for text mode.

    • channel_id (string, optional): Channel to share the file. Leave empty to keep file private.

    • thread_ts (string, optional): Timestamp of thread to reply in.

    • initial_comment (string, optional): Initial comment with the file.

    • unfurl_links (boolean, optional): Auto-unfurl links in comment. Default: true.

    • unfurl_media (boolean, optional): Auto-unfurl media in comment. Default: true.

  • Outputs:

    • success (boolean): Whether the file was uploaded successfully.

    • file_id (string): Unique ID of the uploaded file.

    • file_url (string): Private URL to access the file.

    • permalink (string): Permanent link to the file.

    • sharing_summary (string): Summary of where the file was shared.

    • upload_method (string): Method used for upload.

5. Delete Slack File (slack_delete_file)

  • Description: Delete a file from the Slack workspace permanently.

  • Inputs:

    • file_id (string, required): The unique ID of the file to delete.

  • Outputs:

    • success (boolean): Whether the file was successfully deleted.

    • file_id (string): The ID of the file that was deleted.

    • message (string): Message describing the deletion result.

6. Get Slack File Info (slack_get_file_info)

  • Description: Get detailed information about a specific Slack file.

  • Inputs:

    • file_id (string, required): The unique ID of the file to get information about.

  • Outputs:

    • file (object): Detailed information about the file.

    • Includes: id, name, title, mimetype, filetype, size, created, user, urls, etc.

    • access_urls (object): URLs for accessing the file (require Authorization header).

    • sharing_info (object): Information about where the file is shared.

7. List Files (slack_list_files)

  • Description: List files in the Slack workspace with filtering options.

  • Inputs:

    • user (string, optional): Filter files by specific user ID.

    • channel (string, optional): Filter files by specific channel.

    • ts_from (string, optional): Filter files created after this timestamp (Unix timestamp).

    • ts_to (string, optional): Filter files created before this timestamp (Unix timestamp).

    • types (string, optional): Filter by file types. Options: "all", "spaces", "snippets", "images", "gdocs", "zips", "pdfs".

    • count (number, optional): Maximum number of files to return. Default: 20, Maximum: 1000.

    • show_files_hidden_by_limit (boolean, optional): Show files hidden by 5GB limit in free workspaces. Default: false.

  • Outputs:

    • files (array): List of files matching the criteria. Each file contains: id, name, title, mimetype, size, created, user, etc.

    • total_count (number): Total number of files found.

    • has_more (boolean): Whether there are more files available.

    • paging (object): Pagination information.

8. Query Slack Channel (slack_query)

  • Description: Retrieve messages from a Slack channel. Query and retrieve messages from a pre-configured Slack channel.

  • Inputs:

    • No required input parameters (the channel is typically configured in the connection or node settings).

  • Outputs:

    • channel_id: The Slack channel ID that was queried.

    • results: The messages retrieved from the Slack channel. Includes main messages and thread replies. Each message contains: id, text, timestamp, is_thread_reply, parent_ts.

Last updated

Was this helpful?