KosmoKrator

productivity

Slack CLI for AI Agents

Use the Slack CLI from KosmoKrator to call Slack tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.

25 functions 13 read 12 write API token auth

Slack CLI Setup

Slack can be configured headlessly with `kosmokrator integrations:configure slack`.

# Install KosmoKrator first if it is not available on PATH.
curl -fsSL https://raw.githubusercontent.com/OpenCompanyApp/kosmokrator/main/install.sh | bash

# Configure and verify this integration.
kosmokrator integrations:configure slack --set bot_token="$SLACK_BOT_TOKEN" --enable --read allow --write ask --json
kosmokrator integrations:doctor slack --json
kosmokrator integrations:status --json

Credentials

Authentication type: API token api_token. Configure credentials once, then use the same stored profile from scripts, coding CLIs, Lua code mode, and the MCP gateway.

KeyEnv varTypeRequiredLabel
bot_token SLACK_BOT_TOKEN Secret secret yes Bot Token

Call Slack Headlessly

Use the generic call form when another coding CLI or script needs a stable universal interface.

kosmo integrations:call slack.slack_send_message '{
  "channel": "example_channel",
  "text": "example_text",
  "blocks": "example_blocks",
  "thread_ts": "example_thread_ts",
  "reply_broadcast": true,
  "unfurl_links": true,
  "markdown": true
}' --json

Use the provider shortcut form for shorter human-facing commands.

kosmo integrations:slack slack_send_message '{
  "channel": "example_channel",
  "text": "example_text",
  "blocks": "example_blocks",
  "thread_ts": "example_thread_ts",
  "reply_broadcast": true,
  "unfurl_links": true,
  "markdown": true
}' --json

Agent Discovery Commands

These commands return structured output for coding agents that need to inspect capabilities before choosing a function.

kosmo integrations:docs slack --json
kosmo integrations:docs slack.slack_send_message --json
kosmo integrations:schema slack.slack_send_message --json
kosmo integrations:search "Slack" --json
kosmo integrations:list --json

All CLI Functions

Every function below can be called headlessly. The generic form is stable across all integrations; the provider shortcut is shorter but specific to Slack.

slack.slack_send_message

Write write

Send a message to a Slack channel or DM. Supports text, blocks, and thread replies.

Parameters
channel, text, blocks, thread_ts, reply_broadcast, unfurl_links, markdown

Generic CLI call

kosmo integrations:call slack.slack_send_message '{"channel":"example_channel","text":"example_text","blocks":"example_blocks","thread_ts":"example_thread_ts","reply_broadcast":true,"unfurl_links":true,"markdown":true}' --json

Provider shortcut

kosmo integrations:slack slack_send_message '{"channel":"example_channel","text":"example_text","blocks":"example_blocks","thread_ts":"example_thread_ts","reply_broadcast":true,"unfurl_links":true,"markdown":true}' --json

slack.slack_update_message

Write write

Update an existing Slack message.

Parameters
channel, ts, text, blocks

Generic CLI call

kosmo integrations:call slack.slack_update_message '{"channel":"example_channel","ts":"example_ts","text":"example_text","blocks":"example_blocks"}' --json

Provider shortcut

kosmo integrations:slack slack_update_message '{"channel":"example_channel","ts":"example_ts","text":"example_text","blocks":"example_blocks"}' --json

slack.slack_delete_message

Write write

Delete a message from a Slack channel.

Parameters
channel, ts

Generic CLI call

kosmo integrations:call slack.slack_delete_message '{"channel":"example_channel","ts":"example_ts"}' --json

Provider shortcut

kosmo integrations:slack slack_delete_message '{"channel":"example_channel","ts":"example_ts"}' --json

slack.slack_get_message

Read read

Get a specific message by its timestamp. Optionally fetch a message within a thread.

Parameters
channel, ts, thread_ts

Generic CLI call

kosmo integrations:call slack.slack_get_message '{"channel":"example_channel","ts":"example_ts","thread_ts":"example_thread_ts"}' --json

Provider shortcut

kosmo integrations:slack slack_get_message '{"channel":"example_channel","ts":"example_ts","thread_ts":"example_thread_ts"}' --json

slack.slack_search_messages

Read read

Search for messages across all Slack channels and DMs.

Parameters
query, count, page, sort, sort_dir

Generic CLI call

kosmo integrations:call slack.slack_search_messages '{"query":"example_query","count":1,"page":1,"sort":"example_sort","sort_dir":"example_sort_dir"}' --json

Provider shortcut

kosmo integrations:slack slack_search_messages '{"query":"example_query","count":1,"page":1,"sort":"example_sort","sort_dir":"example_sort_dir"}' --json

slack.slack_get_channel_history

Read read

Get message history for a Slack channel. Supports pagination with cursors.

Parameters
channel, limit, oldest, latest, cursor

Generic CLI call

kosmo integrations:call slack.slack_get_channel_history '{"channel":"example_channel","limit":1,"oldest":"example_oldest","latest":"example_latest","cursor":"example_cursor"}' --json

Provider shortcut

kosmo integrations:slack slack_get_channel_history '{"channel":"example_channel","limit":1,"oldest":"example_oldest","latest":"example_latest","cursor":"example_cursor"}' --json

slack.slack_get_thread_replies

Read read

Get all replies in a Slack message thread.

Parameters
channel, ts, limit, cursor

Generic CLI call

kosmo integrations:call slack.slack_get_thread_replies '{"channel":"example_channel","ts":"example_ts","limit":1,"cursor":"example_cursor"}' --json

Provider shortcut

kosmo integrations:slack slack_get_thread_replies '{"channel":"example_channel","ts":"example_ts","limit":1,"cursor":"example_cursor"}' --json

slack.slack_list_channels

Read read

List all Slack channels the bot has access to.

Parameters
types, exclude_archived, limit, cursor

Generic CLI call

kosmo integrations:call slack.slack_list_channels '{"types":"example_types","exclude_archived":true,"limit":1,"cursor":"example_cursor"}' --json

Provider shortcut

kosmo integrations:slack slack_list_channels '{"types":"example_types","exclude_archived":true,"limit":1,"cursor":"example_cursor"}' --json

slack.slack_get_channel

Read read

Get detailed information about a Slack channel.

Parameters
channel

Generic CLI call

kosmo integrations:call slack.slack_get_channel '{"channel":"example_channel"}' --json

Provider shortcut

kosmo integrations:slack slack_get_channel '{"channel":"example_channel"}' --json

slack.slack_create_channel

Write write

Create a new Slack channel.

Parameters
name, is_private

Generic CLI call

kosmo integrations:call slack.slack_create_channel '{"name":"example_name","is_private":true}' --json

Provider shortcut

kosmo integrations:slack slack_create_channel '{"name":"example_name","is_private":true}' --json

slack.slack_set_topic

Write write

Set the topic for a Slack channel.

Parameters
channel, topic

Generic CLI call

kosmo integrations:call slack.slack_set_topic '{"channel":"example_channel","topic":"example_topic"}' --json

Provider shortcut

kosmo integrations:slack slack_set_topic '{"channel":"example_channel","topic":"example_topic"}' --json

slack.slack_set_purpose

Write write

Set the purpose for a Slack channel.

Parameters
channel, purpose

Generic CLI call

kosmo integrations:call slack.slack_set_purpose '{"channel":"example_channel","purpose":"example_purpose"}' --json

Provider shortcut

kosmo integrations:slack slack_set_purpose '{"channel":"example_channel","purpose":"example_purpose"}' --json

slack.slack_archive_channel

Write write

Archive a Slack channel.

Parameters
channel

Generic CLI call

kosmo integrations:call slack.slack_archive_channel '{"channel":"example_channel"}' --json

Provider shortcut

kosmo integrations:slack slack_archive_channel '{"channel":"example_channel"}' --json

slack.slack_invite_to_channel

Write write

Invite one or more users to a Slack channel.

Parameters
channel, users

Generic CLI call

kosmo integrations:call slack.slack_invite_to_channel '{"channel":"example_channel","users":"example_users"}' --json

Provider shortcut

kosmo integrations:slack slack_invite_to_channel '{"channel":"example_channel","users":"example_users"}' --json

slack.slack_upload_file

Write write

Upload a file to Slack using the modern external upload flow. The file content is posted to a channel or as a thread reply.

Parameters
channel, content, filename, title, initial_comment, thread_ts

Generic CLI call

kosmo integrations:call slack.slack_upload_file '{"channel":"example_channel","content":"example_content","filename":"example_filename","title":"example_title","initial_comment":"example_initial_comment","thread_ts":"example_thread_ts"}' --json

Provider shortcut

kosmo integrations:slack slack_upload_file '{"channel":"example_channel","content":"example_content","filename":"example_filename","title":"example_title","initial_comment":"example_initial_comment","thread_ts":"example_thread_ts"}' --json

slack.slack_list_files

Read read

List files in Slack, optionally filtered by channel, user, or file type.

Parameters
channel, user, types, count, page

Generic CLI call

kosmo integrations:call slack.slack_list_files '{"channel":"example_channel","user":"example_user","types":"example_types","count":1,"page":1}' --json

Provider shortcut

kosmo integrations:slack slack_list_files '{"channel":"example_channel","user":"example_user","types":"example_types","count":1,"page":1}' --json

slack.slack_get_file

Read read

Get detailed information about a Slack file.

Parameters
file

Generic CLI call

kosmo integrations:call slack.slack_get_file '{"file":"example_file"}' --json

Provider shortcut

kosmo integrations:slack slack_get_file '{"file":"example_file"}' --json

slack.slack_list_users

Read read

List all users in the Slack workspace.

Parameters
limit, cursor, include_locale

Generic CLI call

kosmo integrations:call slack.slack_list_users '{"limit":1,"cursor":"example_cursor","include_locale":true}' --json

Provider shortcut

kosmo integrations:slack slack_list_users '{"limit":1,"cursor":"example_cursor","include_locale":true}' --json

slack.slack_get_user

Read read

Get detailed information about a Slack user by their user ID.

Parameters
user

Generic CLI call

kosmo integrations:call slack.slack_get_user '{"user":"example_user"}' --json

Provider shortcut

kosmo integrations:slack slack_get_user '{"user":"example_user"}' --json

slack.slack_find_user_by_email

Read read

Look up a Slack user by their email address.

Parameters
email

Generic CLI call

kosmo integrations:call slack.slack_find_user_by_email '{"email":"example_email"}' --json

Provider shortcut

kosmo integrations:slack slack_find_user_by_email '{"email":"example_email"}' --json

slack.slack_add_reaction

Write write

Add an emoji reaction to a Slack message.

Parameters
channel, name, timestamp

Generic CLI call

kosmo integrations:call slack.slack_add_reaction '{"channel":"example_channel","name":"example_name","timestamp":"example_timestamp"}' --json

Provider shortcut

kosmo integrations:slack slack_add_reaction '{"channel":"example_channel","name":"example_name","timestamp":"example_timestamp"}' --json

slack.slack_remove_reaction

Write write

Remove an emoji reaction from a Slack message.

Parameters
channel, name, timestamp

Generic CLI call

kosmo integrations:call slack.slack_remove_reaction '{"channel":"example_channel","name":"example_name","timestamp":"example_timestamp"}' --json

Provider shortcut

kosmo integrations:slack slack_remove_reaction '{"channel":"example_channel","name":"example_name","timestamp":"example_timestamp"}' --json

slack.slack_list_usergroups

Read read

List all usergroups in the Slack workspace.

Parameters
include_count, include_disabled, include_users

Generic CLI call

kosmo integrations:call slack.slack_list_usergroups '{"include_count":true,"include_disabled":true,"include_users":true}' --json

Provider shortcut

kosmo integrations:slack slack_list_usergroups '{"include_count":true,"include_disabled":true,"include_users":true}' --json

slack.slack_update_usergroup_members

Write write

Update the members of a Slack usergroup.

Parameters
usergroup, users

Generic CLI call

kosmo integrations:call slack.slack_update_usergroup_members '{"usergroup":"example_usergroup","users":"example_users"}' --json

Provider shortcut

kosmo integrations:slack slack_update_usergroup_members '{"usergroup":"example_usergroup","users":"example_users"}' --json

Function Schemas

Use these parameter tables when building CLI payloads without calling integrations:schema first.

slack.slack_send_message

Send a message to a Slack channel or DM. Supports text, blocks, and thread replies.

Operation
Write write
Schema command
kosmo integrations:schema slack.slack_send_message --json
ParameterTypeRequiredDescription
channel string yes Channel ID or name (e.g., "#general" or "C12345678").
text string yes Message text.
blocks string no JSON array of Slack Block Kit blocks for rich formatting.
thread_ts string no Timestamp of the parent message to reply in a thread.
reply_broadcast boolean no If true, also post the reply to the channel (thread_ts required).
unfurl_links boolean no If true, enable unfurling of links.
markdown boolean no If true, enable mrkdwn formatting in text.

slack.slack_update_message

Update an existing Slack message.

Operation
Write write
Schema command
kosmo integrations:schema slack.slack_update_message --json
ParameterTypeRequiredDescription
channel string yes Channel ID where the message was posted.
ts string yes Timestamp of the message to update.
text string no New message text.
blocks string no JSON array of Slack Block Kit blocks.

slack.slack_delete_message

Delete a message from a Slack channel.

Operation
Write write
Schema command
kosmo integrations:schema slack.slack_delete_message --json
ParameterTypeRequiredDescription
channel string yes Channel ID where the message was posted.
ts string yes Timestamp of the message to delete.

slack.slack_get_message

Get a specific message by its timestamp. Optionally fetch a message within a thread.

Operation
Read read
Schema command
kosmo integrations:schema slack.slack_get_message --json
ParameterTypeRequiredDescription
channel string yes Channel ID.
ts string yes Timestamp of the message to retrieve.
thread_ts string no If provided, fetches a reply within this thread instead.

slack.slack_search_messages

Search for messages across all Slack channels and DMs.

Operation
Read read
Schema command
kosmo integrations:schema slack.slack_search_messages --json
ParameterTypeRequiredDescription
query string yes Search query. Supports Slack search modifiers like "from:", "in:", "has:", etc.
count integer no Number of results per page (default 20, max 100).
page integer no Page number of results (default 1).
sort string no Sort order: "score" (default) or "timestamp".
sort_dir string no Sort direction: "desc" (default) or "asc".

slack.slack_get_channel_history

Get message history for a Slack channel. Supports pagination with cursors.

Operation
Read read
Schema command
kosmo integrations:schema slack.slack_get_channel_history --json
ParameterTypeRequiredDescription
channel string yes Channel ID.
limit integer no Number of messages to return (default 100, max 1000).
oldest string no Start of time range, as a Unix timestamp.
latest string no End of time range, as a Unix timestamp.
cursor string no Pagination cursor from a previous response.

slack.slack_get_thread_replies

Get all replies in a Slack message thread.

Operation
Read read
Schema command
kosmo integrations:schema slack.slack_get_thread_replies --json
ParameterTypeRequiredDescription
channel string yes Channel ID.
ts string yes Timestamp of the parent message (thread root).
limit integer no Number of replies to return per page (default 1000).
cursor string no Pagination cursor from a previous response.

slack.slack_list_channels

List all Slack channels the bot has access to.

Operation
Read read
Schema command
kosmo integrations:schema slack.slack_list_channels --json
ParameterTypeRequiredDescription
types string no Comma-separated channel types: "public_channel", "private_channel", "mpim", "im". Default: "public_channel".
exclude_archived boolean no Exclude archived channels (default: true).
limit integer no Number of channels to return per page (default 100, max 1000).
cursor string no Pagination cursor from a previous response.

slack.slack_get_channel

Get detailed information about a Slack channel.

Operation
Read read
Schema command
kosmo integrations:schema slack.slack_get_channel --json
ParameterTypeRequiredDescription
channel string yes Channel ID.

slack.slack_create_channel

Create a new Slack channel.

Operation
Write write
Schema command
kosmo integrations:schema slack.slack_create_channel --json
ParameterTypeRequiredDescription
name string yes Channel name (lowercase, no spaces, max 80 chars).
is_private boolean no Create a private channel instead of a public one (default: false).

slack.slack_set_topic

Set the topic for a Slack channel.

Operation
Write write
Schema command
kosmo integrations:schema slack.slack_set_topic --json
ParameterTypeRequiredDescription
channel string yes Channel ID.
topic string yes The new topic text.

slack.slack_set_purpose

Set the purpose for a Slack channel.

Operation
Write write
Schema command
kosmo integrations:schema slack.slack_set_purpose --json
ParameterTypeRequiredDescription
channel string yes Channel ID.
purpose string yes The new purpose text.

slack.slack_archive_channel

Archive a Slack channel.

Operation
Write write
Schema command
kosmo integrations:schema slack.slack_archive_channel --json
ParameterTypeRequiredDescription
channel string yes Channel ID to archive.

slack.slack_invite_to_channel

Invite one or more users to a Slack channel.

Operation
Write write
Schema command
kosmo integrations:schema slack.slack_invite_to_channel --json
ParameterTypeRequiredDescription
channel string yes Channel ID.
users string yes Comma-separated list of user IDs to invite.

slack.slack_upload_file

Upload a file to Slack using the modern external upload flow. The file content is posted to a channel or as a thread reply.

Operation
Write write
Schema command
kosmo integrations:schema slack.slack_upload_file --json
ParameterTypeRequiredDescription
channel string yes Channel ID to post the file to.
content string yes File content (text).
filename string yes Filename with extension (e.g., "report.txt").
title string no Title of the file.
initial_comment string no Comment to include with the file post.
thread_ts string no Timestamp of the parent message to reply in a thread.

slack.slack_list_files

List files in Slack, optionally filtered by channel, user, or file type.

Operation
Read read
Schema command
kosmo integrations:schema slack.slack_list_files --json
ParameterTypeRequiredDescription
channel string no Channel ID to filter files by.
user string no User ID to filter files by.
types string no Comma-separated file types: "spaces", "snippets", "images", "gdocs", "zips", "pdfs".
count integer no Number of files per page (default 100).
page integer no Page number (default 1).

slack.slack_get_file

Get detailed information about a Slack file.

Operation
Read read
Schema command
kosmo integrations:schema slack.slack_get_file --json
ParameterTypeRequiredDescription
file string yes File ID.

slack.slack_list_users

List all users in the Slack workspace.

Operation
Read read
Schema command
kosmo integrations:schema slack.slack_list_users --json
ParameterTypeRequiredDescription
limit integer no Number of users per page (default 100, max 1000).
cursor string no Pagination cursor from a previous response.
include_locale boolean no Include user locale information (default: false).

slack.slack_get_user

Get detailed information about a Slack user by their user ID.

Operation
Read read
Schema command
kosmo integrations:schema slack.slack_get_user --json
ParameterTypeRequiredDescription
user string yes User ID.

slack.slack_find_user_by_email

Look up a Slack user by their email address.

Operation
Read read
Schema command
kosmo integrations:schema slack.slack_find_user_by_email --json
ParameterTypeRequiredDescription
email string yes Email address to look up.

slack.slack_add_reaction

Add an emoji reaction to a Slack message.

Operation
Write write
Schema command
kosmo integrations:schema slack.slack_add_reaction --json
ParameterTypeRequiredDescription
channel string yes Channel ID where the message is posted.
name string yes Emoji name without colons (e.g., "thumbsup", "heart").
timestamp string yes Timestamp of the message to react to.

slack.slack_remove_reaction

Remove an emoji reaction from a Slack message.

Operation
Write write
Schema command
kosmo integrations:schema slack.slack_remove_reaction --json
ParameterTypeRequiredDescription
channel string yes Channel ID where the message is posted.
name string yes Emoji name without colons (e.g., "thumbsup", "heart").
timestamp string yes Timestamp of the message.

slack.slack_list_usergroups

List all usergroups in the Slack workspace.

Operation
Read read
Schema command
kosmo integrations:schema slack.slack_list_usergroups --json
ParameterTypeRequiredDescription
include_count boolean no Include the number of users in each usergroup (default: false).
include_disabled boolean no Include disabled usergroups (default: false).
include_users boolean no Include the list of users in each usergroup (default: false).

slack.slack_update_usergroup_members

Update the members of a Slack usergroup.

Operation
Write write
Schema command
kosmo integrations:schema slack.slack_update_usergroup_members --json
ParameterTypeRequiredDescription
usergroup string yes Usergroup ID.
users string yes Comma-separated list of user IDs to set as members.

Permissions

Headless calls still follow the integration read/write permission policy. Configure read/write defaults with integrations:configure. Add --force only for trusted automation that should bypass that policy.