slack
There is no first-party Slack CLI fit for daily use, so we drive the
Slack Web API with curl + jq. The
user's OAuth bearer token is in $SLACK_TOKEN; every call needs it as
Authorization: Bearer $SLACK_TOKEN.
The Slack API ALWAYS returns 200 — check the JSON ok field for success.
A failed call has {"ok": false, "error": "<reason>"}. Surface the
error value verbatim to the user when it occurs.
Always start with auth.test to confirm the connection works AND
to learn what bot user / team you're posting as. Many subsequent calls
need the bot's user id (auth.test returns user_id).
Recipes
Verify auth (always run first)
curl -sS -H "Authorization: Bearer $SLACK_TOKEN" \
https://slack.com/api/auth.test
# {"ok": true, "team": "...", "team_id": "...", "user": "<bot>", "user_id": "U..."}
Resolve a channel name to its ID (you'll need this a lot)
curl -sS -H "Authorization: Bearer $SLACK_TOKEN" \
"https://slack.com/api/conversations.list?limit=1000&types=public_channel,private_channel" \
| jq -r --arg name "general" '.channels[] | select(.name == $name) | .id'
Post a message
curl -sS -X POST https://slack.com/api/chat.postMessage \
-H "Authorization: Bearer $SLACK_TOKEN" \
-H "Content-Type: application/json; charset=utf-8" \
-d "$(jq -nc \
--arg ch "C0123456789" \
--arg text "Deploy complete." \
'{channel:$ch, text:$text}')"
Reply in a thread
curl -sS -X POST https://slack.com/api/chat.postMessage \
-H "Authorization: Bearer $SLACK_TOKEN" \
-H "Content-Type: application/json; charset=utf-8" \
-d "$(jq -nc \
--arg ch "C0123456789" \
--arg ts "1777656720.123456" \
--arg text "Thanks!" \
'{channel:$ch, thread_ts:$ts, text:$text}')"
Search messages
curl -sS -G \
-H "Authorization: Bearer $SLACK_TOKEN" \
"https://slack.com/api/search.messages" \
--data-urlencode "query=in:#engineering deploy" \
--data-urlencode "count=20"
Send a DM to a user (by email)
USER_ID=$(curl -sS -G -H "Authorization: Bearer $SLACK_TOKEN" \
"https://slack.com/api/users.lookupByEmail" \
--data-urlencode "email=alice@example.com" \
| jq -r '.user.id')
# DM channels are auto-created the first time you postMessage to a user id.
curl -sS -X POST https://slack.com/api/chat.postMessage \
-H "Authorization: Bearer $SLACK_TOKEN" \
-H "Content-Type: application/json; charset=utf-8" \
-d "$(jq -nc --arg ch "$USER_ID" --arg text "Hi from the bot." '{channel:$ch, text:$text}')"
Upload a file to a channel
Two-step: create an upload URL, then complete.
UPLOAD=$(curl -sS -G -H "Authorization: Bearer $SLACK_TOKEN" \
"https://slack.com/api/files.getUploadURLExternal" \
--data-urlencode "filename=report.pdf" \
--data-urlencode "length=$(wc -c < report.pdf)")
URL=$(echo "$UPLOAD" | jq -r '.upload_url')
ID=$(echo "$UPLOAD" | jq -r '.file_id')
curl -sS -T report.pdf "$URL"
curl -sS -X POST https://slack.com/api/files.completeUploadExternal \
-H "Authorization: Bearer $SLACK_TOKEN" \
-H "Content-Type: application/json; charset=utf-8" \
-d "$(jq -nc --arg fid "$ID" --arg ch "C0123456789" \
'{files:[{id:$fid, title:"report.pdf"}], channel_id:$ch}')"
Notes
chat.postMessageto a public channel requires the bot to be a member of that channel. If you getnot_in_channel, callconversations.joinfirst (which also takes the channel id), then retry. Private channels and DMs need a manual invite — ask the user.- Always check
.okon the JSON response.not_authed/invalid_auth→ ask the user to re-authorize atauth.acedata.cloud/user/connections. - Channel ids start with
C(channels),D(DMs),G(private). Don't invent ids — always look them up viaconversations.listorusers.lookupByEmail. - Slack rate-limits aggressively;
Retry-Afteris in the response headers if you get a 429. Sleep and retry rather than parallelizing.
More from acedatacloud/skills
luma-video
Generate AI videos with Luma Dream Machine via AceDataCloud API. Use when creating videos from text prompts, generating videos from reference images, extending existing videos, or any video generation task with Luma. Supports text-to-video, image-to-video, and video extension.
10short-url
Create short URLs via AceDataCloud API. Use when generating shortened links for sharing, or batch-creating multiple short URLs at once. Supports custom slugs and expiration.
9seedream-image
Generate and edit AI images with Seedream (ByteDance) via AceDataCloud API. Use when creating images from text prompts, editing existing images, or working with high-resolution outputs. Supports Seedream 3.0 T2I, 4.0, 4.5, 5.0, and SeedEdit 3.0 models.
9flux-image
Generate and edit images with Flux (Black Forest Labs) via AceDataCloud API. Use when creating images from text prompts, editing existing images with text instructions, or when high-quality image generation is needed. Supports multiple Flux models including dev, pro, ultra, and kontext for editing.
9veo-video
Generate AI videos with Google Veo via AceDataCloud API. Use when creating videos from text descriptions, animating still images into video, upscaling/extending videos, re-shooting with new camera motion, or inserting/removing objects. Supports Veo 2, Veo 3, and Veo 3.1 models including fast variants.
9sora-video
Generate AI videos with OpenAI Sora via AceDataCloud API. Use when creating videos from text prompts, generating videos from reference images, or using character references from existing videos. Supports text-to-video, image-to-video, and character-driven generation with multiple models and resolutions.
8