← Public packages
@kentcdodds/slack
Read Slack conversations and safely send messages as the authorizing user through the saved slack OAuth integration.
AGENTS.md
81 lines · 2.3 KB · Markdown@kentcdodds/slack — agent notes
Human setup and intent live in README.md. This file is for
agents: imports, smoke/dryRun snippets, and edge cases. Auth is the saved OAuth
integration named slack (user token). Do not paste tokens. Do not disable
live webhooks or jobs.
Auth
- Integration id:
slack(viacreateAuthenticatedFetch('slack')) - Must be a Slack user token (
xoxp-…style), never a bot token - API origin:
https://slack.com
Import paths
| Export | Import |
|---|---|
| overview / safety metadata | kody:@kentcdodds/slack |
| smoke-test | kody:@kentcdodds/slack/smoke-test |
| list-conversations | kody:@kentcdodds/slack/list-conversations |
| list-users | kody:@kentcdodds/slack/list-users |
| get-history | kody:@kentcdodds/slack/get-history |
| get-replies | kody:@kentcdodds/slack/get-replies |
| send-message | kody:@kentcdodds/slack/send-message |
Prefer static kody:@kentcdodds/slack/... imports from execute.
Smoke test (read-only)
import smokeTest from 'kody:@kentcdodds/slack/smoke-test'
export default async function main() {
return await smokeTest()
// => { ok: true, userIdentity: true, botIdentity: false, teamIdentity }
// throws if token looks like a bot
}dryRun / confirm (send)
Preview never calls Slack:
import sendMessage from 'kody:@kentcdodds/slack/send-message'
export default async function main() {
return await sendMessage({
channel: 'C0123456789',
text: 'Hello from Kody',
dryRun: true,
})
// => { dryRun: true, method: 'chat.postMessage', identity: 'authorizing-user', payload }
}Live send requires explicit user approval of destination + content, then
confirm: true (not only dryRun: false).
Read helpers
import listConversations from 'kody:@kentcdodds/slack/list-conversations'
export default async function main() {
return await listConversations({
types: ['public_channel', 'private_channel'],
})
}types may include only: public_channel, private_channel, im, mpim.
Edge cases
- Private channels / DMs only if the authorizing user can already see them.
send-messagethrows withoutconfirm: truewhen not dry-running.- Optional send fields:
threadTs,blocks(array),unfurlLinks,unfurlMedia. - Always prefer dry-run before any live send; never treat smoke as permission to post.