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 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.
| Key | Env var | Type | Required | Label |
|---|---|---|---|---|
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.
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 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.
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 - Parameters
- channel, text, blocks, thread_ts, reply_broadcast, unfurl_links, markdown
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 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 - Parameters
- channel, ts, text, blocks
kosmo integrations:call slack.slack_update_message '{"channel":"example_channel","ts":"example_ts","text":"example_text","blocks":"example_blocks"}' --json 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 - Parameters
- channel, ts
kosmo integrations:call slack.slack_delete_message '{"channel":"example_channel","ts":"example_ts"}' --json 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 - Parameters
- channel, ts, thread_ts
kosmo integrations:call slack.slack_get_message '{"channel":"example_channel","ts":"example_ts","thread_ts":"example_thread_ts"}' --json 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 - Parameters
- query, count, page, sort, sort_dir
kosmo integrations:call slack.slack_search_messages '{"query":"example_query","count":1,"page":1,"sort":"example_sort","sort_dir":"example_sort_dir"}' --json 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 - Parameters
- channel, message_ts
kosmo integrations:call slack.slack_get_permalink '{"channel":"example_channel","message_ts":"example_message_ts"}' --json 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 - Parameters
- channel, limit, oldest, latest, cursor
kosmo integrations:call slack.slack_get_channel_history '{"channel":"example_channel","limit":1,"oldest":"example_oldest","latest":"example_latest","cursor":"example_cursor"}' --json 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 - Parameters
- channel, ts, limit, cursor
kosmo integrations:call slack.slack_get_thread_replies '{"channel":"example_channel","ts":"example_ts","limit":1,"cursor":"example_cursor"}' --json 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 - Parameters
- types, exclude_archived, limit, cursor
kosmo integrations:call slack.slack_list_channels '{"types":"example_types","exclude_archived":true,"limit":1,"cursor":"example_cursor"}' --json 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 - Parameters
- channel
kosmo integrations:call slack.slack_get_channel '{"channel":"example_channel"}' --json kosmo integrations:slack slack_get_channel '{"channel":"example_channel"}' --json slack.slack_create_channel
Create a new Slack channel.
write - Parameters
- name, is_private
kosmo integrations:call slack.slack_create_channel '{"name":"example_name","is_private":true}' --json 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 - Parameters
- channel, topic
kosmo integrations:call slack.slack_set_topic '{"channel":"example_channel","topic":"example_topic"}' --json 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 - Parameters
- channel, purpose
kosmo integrations:call slack.slack_set_purpose '{"channel":"example_channel","purpose":"example_purpose"}' --json kosmo integrations:slack slack_set_purpose '{"channel":"example_channel","purpose":"example_purpose"}' --json slack.slack_archive_channel
Archive a Slack channel.
write - Parameters
- channel
kosmo integrations:call slack.slack_archive_channel '{"channel":"example_channel"}' --json 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 - Parameters
- channel, users
kosmo integrations:call slack.slack_invite_to_channel '{"channel":"example_channel","users":"example_users"}' --json 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 - Parameters
- channel, content, filename, title, initial_comment, thread_ts
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 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 - Parameters
- channel, user, types, count, page
kosmo integrations:call slack.slack_list_files '{"channel":"example_channel","user":"example_user","types":"example_types","count":1,"page":1}' --json 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 - Parameters
- file
kosmo integrations:call slack.slack_get_file '{"file":"example_file"}' --json kosmo integrations:slack slack_get_file '{"file":"example_file"}' --json slack.slack_list_users
List all users in the Slack workspace.
read - Parameters
- limit, cursor, include_locale
kosmo integrations:call slack.slack_list_users '{"limit":1,"cursor":"example_cursor","include_locale":true}' --json 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 - Parameters
- user
kosmo integrations:call slack.slack_get_user '{"user":"example_user"}' --json 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 - Parameters
kosmo integrations:call slack.slack_find_user_by_email '{"email":"example_email"}' --json 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 - Parameters
- channel, name, timestamp
kosmo integrations:call slack.slack_add_reaction '{"channel":"example_channel","name":"example_name","timestamp":"example_timestamp"}' --json 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 - Parameters
- channel, name, timestamp
kosmo integrations:call slack.slack_remove_reaction '{"channel":"example_channel","name":"example_name","timestamp":"example_timestamp"}' --json 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 - Parameters
- include_count, include_disabled, include_users
kosmo integrations:call slack.slack_list_usergroups '{"include_count":true,"include_disabled":true,"include_users":true}' --json 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 - Parameters
- usergroup, users
kosmo integrations:call slack.slack_update_usergroup_members '{"usergroup":"example_usergroup","users":"example_users"}' --json 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
kosmo integrations:schema slack.slack_send_message --json | Parameter | Type | Required | Description |
|---|---|---|---|
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
kosmo integrations:schema slack.slack_update_message --json | Parameter | Type | Required | Description |
|---|---|---|---|
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
kosmo integrations:schema slack.slack_delete_message --json | Parameter | Type | Required | Description |
|---|---|---|---|
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
kosmo integrations:schema slack.slack_get_message --json | Parameter | Type | Required | Description |
|---|---|---|---|
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
kosmo integrations:schema slack.slack_search_messages --json | Parameter | Type | Required | Description |
|---|---|---|---|
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_permalink 2 parameters
kosmo integrations:schema slack.slack_get_permalink --json | Parameter | Type | Required | Description |
|---|---|---|---|
channel | string | yes | Channel ID where the message is posted. |
message_ts | string | yes | Timestamp of the message. |
slack.slack_get_channel_history 5 parameters
kosmo integrations:schema slack.slack_get_channel_history --json | Parameter | Type | Required | Description |
|---|---|---|---|
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
kosmo integrations:schema slack.slack_get_thread_replies --json | Parameter | Type | Required | Description |
|---|---|---|---|
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
kosmo integrations:schema slack.slack_list_channels --json | Parameter | Type | Required | Description |
|---|---|---|---|
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
kosmo integrations:schema slack.slack_get_channel --json | Parameter | Type | Required | Description |
|---|---|---|---|
channel | string | yes | Channel ID. |
slack.slack_create_channel 2 parameters
kosmo integrations:schema slack.slack_create_channel --json | Parameter | Type | Required | Description |
|---|---|---|---|
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
kosmo integrations:schema slack.slack_set_topic --json | Parameter | Type | Required | Description |
|---|---|---|---|
channel | string | yes | Channel ID. |
topic | string | yes | The new topic text. |
slack.slack_set_purpose 2 parameters
kosmo integrations:schema slack.slack_set_purpose --json | Parameter | Type | Required | Description |
|---|---|---|---|
channel | string | yes | Channel ID. |
purpose | string | yes | The new purpose text. |
slack.slack_archive_channel 1 parameters
kosmo integrations:schema slack.slack_archive_channel --json | Parameter | Type | Required | Description |
|---|---|---|---|
channel | string | yes | Channel ID to archive. |
slack.slack_invite_to_channel 2 parameters
kosmo integrations:schema slack.slack_invite_to_channel --json | Parameter | Type | Required | Description |
|---|---|---|---|
channel | string | yes | Channel ID. |
users | string | yes | Comma-separated list of user IDs to invite. |
slack.slack_upload_file 6 parameters
kosmo integrations:schema slack.slack_upload_file --json | Parameter | Type | Required | Description |
|---|---|---|---|
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
kosmo integrations:schema slack.slack_list_files --json | Parameter | Type | Required | Description |
|---|---|---|---|
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
kosmo integrations:schema slack.slack_get_file --json | Parameter | Type | Required | Description |
|---|---|---|---|
file | string | yes | File ID. |
slack.slack_list_users 3 parameters
kosmo integrations:schema slack.slack_list_users --json | Parameter | Type | Required | Description |
|---|---|---|---|
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
kosmo integrations:schema slack.slack_get_user --json | Parameter | Type | Required | Description |
|---|---|---|---|
user | string | yes | User ID. |
slack.slack_find_user_by_email 1 parameters
kosmo integrations:schema slack.slack_find_user_by_email --json | Parameter | Type | Required | Description |
|---|---|---|---|
email | string | yes | Email address to look up. |
slack.slack_add_reaction 3 parameters
kosmo integrations:schema slack.slack_add_reaction --json | Parameter | Type | Required | Description |
|---|---|---|---|
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
kosmo integrations:schema slack.slack_remove_reaction --json | Parameter | Type | Required | Description |
|---|---|---|---|
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
kosmo integrations:schema slack.slack_list_usergroups --json | Parameter | Type | Required | Description |
|---|---|---|---|
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
kosmo integrations:schema slack.slack_update_usergroup_members --json | Parameter | Type | Required | Description |
|---|---|---|---|
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.