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.

Slack CLI Setup

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

Install, configure, and verify
# 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 reuse the same stored profile from scripts, coding CLIs, Lua, and MCP.

KeyEnv varTypeRequiredLabel
bot_token SLACK_BOT_TOKEN Secret secret yes Bot Token

Command Patterns

The generic command is stable across every integration. The provider shortcut is shorter for humans.

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

Discovery

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

Discovery commands
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

Automation Contexts

The same configured command surface works in these environments. The command does not change unless the host wrapper, credentials, or permissions change.

CLI Functions

Every function below can be called headlessly. Commands are highlighted, copyable, and scroll horizontally when payloads are long.

slack.slack_send_message

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

Write write
Parameters
channel, text, blocks, thread_ts, reply_broadcast, unfurl_links, markdown
Generic 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
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

Update an existing Slack message.

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

slack.slack_delete_message

Delete a message from a Slack channel.

Write write
Parameters
channel, ts
Generic call
kosmo integrations:call slack.slack_delete_message '{"channel":"example_channel","ts":"example_ts"}' --json
Shortcut
kosmo integrations:slack slack_delete_message '{"channel":"example_channel","ts":"example_ts"}' --json

slack.slack_get_message

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

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

slack.slack_search_messages

Search for messages across all Slack channels and DMs.

Read read
Parameters
query, count, page, sort, sort_dir
Generic call
kosmo integrations:call slack.slack_search_messages '{"query":"example_query","count":1,"page":1,"sort":"example_sort","sort_dir":"example_sort_dir"}' --json
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_permalink

Get a permalink URL for a specific Slack message.

Read read
Parameters
channel, message_ts
Generic call
kosmo integrations:call slack.slack_get_permalink '{"channel":"example_channel","message_ts":"example_message_ts"}' --json
Shortcut
kosmo integrations:slack slack_get_permalink '{"channel":"example_channel","message_ts":"example_message_ts"}' --json

slack.slack_get_channel_history

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

Read read
Parameters
channel, limit, oldest, latest, cursor
Generic call
kosmo integrations:call slack.slack_get_channel_history '{"channel":"example_channel","limit":1,"oldest":"example_oldest","latest":"example_latest","cursor":"example_cursor"}' --json
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

Get all replies in a Slack message thread.

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

slack.slack_list_channels

List all Slack channels the bot has access to.

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

slack.slack_get_channel

Get detailed information about a Slack channel.

Read read
Parameters
channel
Generic call
kosmo integrations:call slack.slack_get_channel '{"channel":"example_channel"}' --json
Shortcut
kosmo integrations:slack slack_get_channel '{"channel":"example_channel"}' --json

slack.slack_create_channel

Create a new Slack channel.

Write write
Parameters
name, is_private
Generic call
kosmo integrations:call slack.slack_create_channel '{"name":"example_name","is_private":true}' --json
Shortcut
kosmo integrations:slack slack_create_channel '{"name":"example_name","is_private":true}' --json

slack.slack_set_topic

Set the topic for a Slack channel.

Write write
Parameters
channel, topic
Generic call
kosmo integrations:call slack.slack_set_topic '{"channel":"example_channel","topic":"example_topic"}' --json
Shortcut
kosmo integrations:slack slack_set_topic '{"channel":"example_channel","topic":"example_topic"}' --json

slack.slack_set_purpose

Set the purpose for a Slack channel.

Write write
Parameters
channel, purpose
Generic call
kosmo integrations:call slack.slack_set_purpose '{"channel":"example_channel","purpose":"example_purpose"}' --json
Shortcut
kosmo integrations:slack slack_set_purpose '{"channel":"example_channel","purpose":"example_purpose"}' --json

slack.slack_archive_channel

Archive a Slack channel.

Write write
Parameters
channel
Generic call
kosmo integrations:call slack.slack_archive_channel '{"channel":"example_channel"}' --json
Shortcut
kosmo integrations:slack slack_archive_channel '{"channel":"example_channel"}' --json

slack.slack_invite_to_channel

Invite one or more users to a Slack channel.

Write write
Parameters
channel, users
Generic call
kosmo integrations:call slack.slack_invite_to_channel '{"channel":"example_channel","users":"example_users"}' --json
Shortcut
kosmo integrations:slack slack_invite_to_channel '{"channel":"example_channel","users":"example_users"}' --json

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.

Write write
Parameters
channel, content, filename, title, initial_comment, thread_ts
Generic 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
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

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

Read read
Parameters
channel, user, types, count, page
Generic call
kosmo integrations:call slack.slack_list_files '{"channel":"example_channel","user":"example_user","types":"example_types","count":1,"page":1}' --json
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

Get detailed information about a Slack file.

Read read
Parameters
file
Generic call
kosmo integrations:call slack.slack_get_file '{"file":"example_file"}' --json
Shortcut
kosmo integrations:slack slack_get_file '{"file":"example_file"}' --json

slack.slack_list_users

List all users in the Slack workspace.

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

slack.slack_get_user

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

Read read
Parameters
user
Generic call
kosmo integrations:call slack.slack_get_user '{"user":"example_user"}' --json
Shortcut
kosmo integrations:slack slack_get_user '{"user":"example_user"}' --json

slack.slack_find_user_by_email

Look up a Slack user by their email address.

Read read
Parameters
email
Generic call
kosmo integrations:call slack.slack_find_user_by_email '{"email":"example_email"}' --json
Shortcut
kosmo integrations:slack slack_find_user_by_email '{"email":"example_email"}' --json

slack.slack_add_reaction

Add an emoji reaction to a Slack message.

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

slack.slack_remove_reaction

Remove an emoji reaction from a Slack message.

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

slack.slack_list_usergroups

List all usergroups in the Slack workspace.

Read read
Parameters
include_count, include_disabled, include_users
Generic call
kosmo integrations:call slack.slack_list_usergroups '{"include_count":true,"include_disabled":true,"include_users":true}' --json
Shortcut
kosmo integrations:slack slack_list_usergroups '{"include_count":true,"include_disabled":true,"include_users":true}' --json

slack.slack_update_usergroup_members

Update the members of a Slack usergroup.

Write write
Parameters
usergroup, users
Generic call
kosmo integrations:call slack.slack_update_usergroup_members '{"usergroup":"example_usergroup","users":"example_users"}' --json
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 7 parameters
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 4 parameters
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 2 parameters
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 3 parameters
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 5 parameters
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 5 parameters
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 4 parameters
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 4 parameters
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 1 parameters
Schema command
kosmo integrations:schema slack.slack_get_channel --json
ParameterTypeRequiredDescription
channel string yes Channel ID.
slack.slack_create_channel 2 parameters
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 2 parameters
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 2 parameters
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 1 parameters
Schema command
kosmo integrations:schema slack.slack_archive_channel --json
ParameterTypeRequiredDescription
channel string yes Channel ID to archive.
slack.slack_invite_to_channel 2 parameters
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 6 parameters
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 5 parameters
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 1 parameters
Schema command
kosmo integrations:schema slack.slack_get_file --json
ParameterTypeRequiredDescription
file string yes File ID.
slack.slack_list_users 3 parameters
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 1 parameters
Schema command
kosmo integrations:schema slack.slack_get_user --json
ParameterTypeRequiredDescription
user string yes User ID.
slack.slack_find_user_by_email 1 parameters
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 3 parameters
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 3 parameters
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 3 parameters
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 2 parameters
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.