@framers/agentos-ext-channel-slack

中文文档
0.2.4发布于 2026/11/04Apache-2.0TypeScriptCommonJS构建来源已验证近 30 天下载 2.1万

Slack messaging channel adapter for AgentOS: bidirectional messaging via @slack/bolt, and posting to a person's own incoming webhook or workflow link

原始使用文档
文档目录6 节
  1. What It Provides
  2. Runtime Status
  3. Required Secrets
  4. Posting to a person's own Slack link ( ./outbound )
  5. Source of Truth
  6. Releases

Slack Channel Extension

Bidirectional Slack messaging for AgentOS via @slack/bolt.

What It Provides

  • slackChannelSendMessage
  • slackChannelSendMedia
  • slackChannel

Runtime Status

  • This is a curated channel pack.
  • Channels stay opt-in because they can connect, poll, or receive webhooks.
  • Enable it through createCuratedManifest({ channels: ['slack'] }) or a custom extension manifest.

Required Secrets

  • slack.botToken
  • slack.signingSecret
  • slack.appToken

A host that only posts messages, such as notes a person chose to send to a channel, takes the ./outbound entry. It loads no Bolt app, opens no port and needs none of the secrets above: the person makes the link in their own Slack workspace and the host keeps it as the secret it is.

import { parseSlackLink, postToSlackLink } from '@framers/agentos-ext-channel-slack/outbound';

const link = parseSlackLink(pasted); // null for anything that is not a Slack link
if (link === null) throw new Error('not a Slack incoming webhook or workflow link');

const outcome = await postToSlackLink(link, 'Decisions: ship on Friday.');
if (!outcome.ok && outcome.reason === 'link_gone') {
  // The link was removed, its channel archived or its workspace closed: ask the person for a new link.
}

parseSlackLink takes two kinds of link, and nothing else:

  • an incoming webhook of an app in the person's workspace, https://hooks.slack.com/services/<workspace>/<B...>/<secret> (Slack's guide);
  • a workflow's webhook trigger, https://hooks.slack.com/triggers/<workspace>/<number>/<secret>, made in Workflow Builder on Slack's paid plans (Slack's help). The workflow needs one text variable named text, which its message step shows.

Any other scheme, host, port (the default one written out included), user name, query, fragment, backslash or path is refused, and the link it returns is rebuilt on hooks.slack.com from the checked path, with its kind, its workspace id and its last four characters (ending) for a person to tell their links apart.

postToSlackLink(link, text, { fetch, timeoutMs, signal }) posts { "text": ... } as JSON, with the text escaped (&, < and > as &amp;, &lt; and &gt;) for either kind of link. Slack reads an incoming webhook's text as its message formatting (Slack's formatting guide), and a workflow started by a webhook takes the same formatting in its variables (Slack's platform blog), so an unescaped <!channel>, <!here>, <@U...> or <#C...> would notify people or show a link the writer never wrote. escapeSlackText is the same escaping on its own. The post follows no redirect, gives up after 10 seconds unless timeoutMs says otherwise, and refuses text with nothing but spaces or with more than SLACK_TEXT_LIMIT (40,000) characters as the link gets it, the length above which Slack truncates a message (chat.postMessage). slackTextLength(kind, text) is that length, the escaped text's, for a host to show or check before a post.

It resolves with { ok: true }, or { ok: false, reason, retryAfterSeconds?, slackError? }:

reasonWhat Slack saidWhat a host does
link_goneThe link no longer takes posts: no_service, no_active_hooks, invalid_token, channel_is_archived, team_disabled and the like, or a 404 or 410Ask for a new link
refusedThe workspace refuses the post: action_prohibited, posting_to_general_channel_denied, or a 403Tell the person; a new link to another channel may post
invalidSlack refused the message: invalid_payload, no_text, parameter_validation_failed (a workflow's JSON Slack cannot take), or another 4xxCheck the text, and that the workflow's one variable is named text
rate_limitedA 429; retryAfterSeconds is its Retry-After, 1 to 3600Wait that long; Slack takes about one post a second a link (rate limits)
unavailableNo answer in time, a 5xx, a redirectTry again later

slackError is Slack's error code when the answer carried one; nothing else from Slack's answer is returned. A 2xx answer is a post Slack took unless it is a JSON object whose top-level ok is false, so a post is never reported as failed and sent twice. Slack's answer is read from its body stream, to 8,192 characters at most, and the stream is then let go. An answer a fetch gives with no body stream is read by its status alone: its text() is never called, since that holds the whole answer at once however long it is. The timeout and the signal end the post themselves, so a fetch that leaves an answer's body pending still answers unavailable on time.

Source of Truth

  • manifest.json defines the exported tools and messaging-channel descriptor.
  • src/ contains the adapter and tool implementations.

Releases

New versions are published from framerslab/agentos-extensions by GitHub Actions through npm trusted publishing, with a provenance statement.

版本与发布记录

@framers/agentos-ext-channel-slack 共发布 9 个版本,首次发布于 2026/02/08;过去 12 个月发布了 9 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.2.4latest2026/11/0411 天前
0.2.32026/11/0214 天前
0.2.22026/11/0114 天前
0.2.12026/11/0115 天前
0.2.02026/10/2818 天前
0.1.32026/10/111 个月前

关于 @framers/agentos-ext-channel-slack 的常见问题

@framers/agentos-ext-channel-slack 是什么?

Slack messaging channel adapter for AgentOS: bidirectional messaging via @slack/bolt, and posting to a person's own incoming webhook or workflow link

如何安装 @framers/agentos-ext-channel-slack?

在项目目录运行 npm install @framers/agentos-ext-channel-slack,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@framers/agentos(>=0.10.40)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@framers/agentos-ext-channel-slack 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@framers/agentos-ext-channel-slack 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@framers/agentos-ext-channel-slack 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@framers/agentos-ext-channel-slack 可以商用吗?

@framers/agentos-ext-channel-slack 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@framers/agentos-ext-channel-slack 的下载量有多少?

根据 npm 官方下载统计,@framers/agentos-ext-channel-slack 在 2026/10/16 – 2026/11/14 这 30 天内被下载 21,314 次,日均约 710 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@framers/agentos-ext-channel-slack 还在维护吗?

最新版本 0.2.4 发布于 2026/11/04(11 天前);至今共发布 9 个版本,其中过去 12 个月发布了 9 个;首次发布于 2026/02/08。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。