@capybara-hq/plugin-slack 0.1.0-rc.5 → 0.1.0-rc.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.capybara-plugin/plugin.json +2 -2
- package/dist/index.mjs +1 -1
- package/guides/slack-app.md +80 -23
- package/guides/slack-app.zh.md +76 -20
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"name": "slack",
|
|
4
|
-
"version": "0.1.0-rc.
|
|
4
|
+
"version": "0.1.0-rc.6",
|
|
5
5
|
"publisher": "Capybara",
|
|
6
6
|
"description": "Slack (channel@1 bot over Socket Mode with Block Kit cards, identity-source@1 Sign in with Slack, directory@1)",
|
|
7
7
|
"displayName": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"entry": "./dist/index.mjs",
|
|
32
32
|
"manifest": {
|
|
33
33
|
"name": "slack",
|
|
34
|
-
"version": "0.1.0-rc.
|
|
34
|
+
"version": "0.1.0-rc.6",
|
|
35
35
|
"sdk": "^0.1.0-rc.0",
|
|
36
36
|
"provides": [
|
|
37
37
|
"channel@1",
|
package/dist/index.mjs
CHANGED
|
@@ -39511,7 +39511,7 @@ function appTokenCheck(opts) {
|
|
|
39511
39511
|
// src/index.ts
|
|
39512
39512
|
var index_default = defineExtension({
|
|
39513
39513
|
name: "slack",
|
|
39514
|
-
version: "0.1.0-rc.
|
|
39514
|
+
version: "0.1.0-rc.6",
|
|
39515
39515
|
sdk: "^0.1.0-rc.0",
|
|
39516
39516
|
provides: [CHANNEL_EXTENSION_POINT, IDENTITY_SOURCE_EXTENSION_POINT, DIRECTORY_EXTENSION_POINT],
|
|
39517
39517
|
permissions: {
|
package/guides/slack-app.md
CHANGED
|
@@ -8,11 +8,11 @@ app after step 2).
|
|
|
8
8
|
## 1. Create the app from the manifest
|
|
9
9
|
|
|
10
10
|
Open <https://api.slack.com/apps>, choose **Create New App → From a manifest**, pick your
|
|
11
|
-
workspace and paste the manifest below.
|
|
12
|
-
commands the plugin needs.
|
|
11
|
+
workspace and paste the manifest below.
|
|
13
12
|
|
|
14
13
|
::: mode long_connection
|
|
15
|
-
Socket Mode needs no public address: Slack keeps a connection open to Capybara.
|
|
14
|
+
Socket Mode needs no public address: Slack keeps a connection open to Capybara. The manifest
|
|
15
|
+
registers the bot scopes, the events and the slash commands the plugin needs.
|
|
16
16
|
|
|
17
17
|
```yaml title="App manifest (Socket Mode)"
|
|
18
18
|
# Slack app manifest for the Capybara Slack plugin, Socket Mode (long connection).
|
|
@@ -28,7 +28,7 @@ features:
|
|
|
28
28
|
messages_tab_enabled: true
|
|
29
29
|
messages_tab_read_only_enabled: false
|
|
30
30
|
bot_user:
|
|
31
|
-
display_name:
|
|
31
|
+
display_name: Capybara
|
|
32
32
|
always_online: true
|
|
33
33
|
slash_commands:
|
|
34
34
|
- command: /new
|
|
@@ -72,7 +72,53 @@ settings:
|
|
|
72
72
|
org_deploy_enabled: false
|
|
73
73
|
token_rotation_enabled: false
|
|
74
74
|
```
|
|
75
|
+
:::
|
|
76
|
+
|
|
77
|
+
::: mode webhook
|
|
78
|
+
In webhook mode Slack posts events, card clicks and slash commands to this connection's address,
|
|
79
|
+
which exists only once the connection is saved. Start with this basic manifest: it registers the
|
|
80
|
+
bot and its scopes, without any address. Step 5 adds the addresses after saving.
|
|
75
81
|
|
|
82
|
+
```yaml title="Basic app manifest (webhook)"
|
|
83
|
+
# Slack app manifest for the Capybara Slack plugin, webhook inbound mode, first step: no
|
|
84
|
+
# addresses yet. Step 5 replaces it with the full manifest once the connection is saved.
|
|
85
|
+
# Reference: https://docs.slack.dev/reference/app-manifest (checked 2026-11-09).
|
|
86
|
+
display_information:
|
|
87
|
+
# Slack caps app names at 35 characters; shorten it in the app settings if it is longer.
|
|
88
|
+
name: "{{connectionName}}"
|
|
89
|
+
description: Chat with your organization's Capybara agents.
|
|
90
|
+
background_color: "#3d2f24"
|
|
91
|
+
features:
|
|
92
|
+
app_home:
|
|
93
|
+
home_tab_enabled: false
|
|
94
|
+
messages_tab_enabled: true
|
|
95
|
+
messages_tab_read_only_enabled: false
|
|
96
|
+
bot_user:
|
|
97
|
+
display_name: Capybara
|
|
98
|
+
always_online: true
|
|
99
|
+
oauth_config:
|
|
100
|
+
# Sign in with Slack (identity-source@1).
|
|
101
|
+
redirect_urls:
|
|
102
|
+
- "{{signInCallbackUrl}}"
|
|
103
|
+
scopes:
|
|
104
|
+
bot:
|
|
105
|
+
- chat:write # post and update replies and cards
|
|
106
|
+
- commands # slash commands /new, /env, /capybara
|
|
107
|
+
- im:write # conversations.open: tell the bot's own DM from other DMs
|
|
108
|
+
- im:history # message.im: direct messages to the bot
|
|
109
|
+
- app_mentions:read # app_mention: @capybara in channels
|
|
110
|
+
- channels:history # message.channels: thread replies in public channels
|
|
111
|
+
- groups:history # message.groups: thread replies in private channels
|
|
112
|
+
- users:read # users.info; team_join / user_change; users.list
|
|
113
|
+
- users:read.email # directory@1: email addresses in users.list
|
|
114
|
+
settings:
|
|
115
|
+
socket_mode_enabled: false
|
|
116
|
+
org_deploy_enabled: false
|
|
117
|
+
token_rotation_enabled: false
|
|
118
|
+
```
|
|
119
|
+
:::
|
|
120
|
+
|
|
121
|
+
::: mode long_connection
|
|
76
122
|
## 2. Create the app-level token
|
|
77
123
|
|
|
78
124
|
Under **Basic Information → App-Level Tokens** choose **Generate Token and Scopes**, add the scope
|
|
@@ -82,8 +128,32 @@ Under **Basic Information → App-Level Tokens** choose **Generate Token and Sco
|
|
|
82
128
|
:::
|
|
83
129
|
|
|
84
130
|
::: mode webhook
|
|
85
|
-
|
|
86
|
-
|
|
131
|
+
## 2. Copy the signing secret
|
|
132
|
+
|
|
133
|
+
Copy **Basic Information → App Credentials → Signing Secret** into the **Signing secret** field
|
|
134
|
+
below. Every webhook request is verified with it; without it every request is refused.
|
|
135
|
+
:::
|
|
136
|
+
|
|
137
|
+
## 3. Install the app and copy the bot token
|
|
138
|
+
|
|
139
|
+
Choose **Install App → Install to Workspace** and copy the **Bot User OAuth Token** (`xoxb-…`)
|
|
140
|
+
into the **Bot token** field below.
|
|
141
|
+
|
|
142
|
+
::check bot-token Bot token works
|
|
143
|
+
::check bot-scopes The app has every scope in the manifest
|
|
144
|
+
|
|
145
|
+
## 4. Save the channel
|
|
146
|
+
|
|
147
|
+
Fill in the remaining fields on this page and save. Capybara verifies the bot token when you save.
|
|
148
|
+
With Socket Mode that is all: the bot connects and is ready for messages.
|
|
149
|
+
|
|
150
|
+
::: mode webhook
|
|
151
|
+
## 5. Point Slack at this connection
|
|
152
|
+
|
|
153
|
+
After saving, the manifest below carries this connection's address `{{webhookUrl}}` (before saving
|
|
154
|
+
it is shown as written). In the app open **App Manifest**, replace the manifest with this one and
|
|
155
|
+
save. It adds the slash commands, the event subscriptions and interactivity, all sent to this
|
|
156
|
+
address.
|
|
87
157
|
|
|
88
158
|
```yaml title="App manifest (webhook)"
|
|
89
159
|
# Slack app manifest for the Capybara Slack plugin, webhook inbound mode.
|
|
@@ -99,7 +169,7 @@ features:
|
|
|
99
169
|
messages_tab_enabled: true
|
|
100
170
|
messages_tab_read_only_enabled: false
|
|
101
171
|
bot_user:
|
|
102
|
-
display_name:
|
|
172
|
+
display_name: Capybara
|
|
103
173
|
always_online: true
|
|
104
174
|
slash_commands:
|
|
105
175
|
- command: /new
|
|
@@ -149,27 +219,14 @@ settings:
|
|
|
149
219
|
token_rotation_enabled: false
|
|
150
220
|
```
|
|
151
221
|
|
|
152
|
-
Slack
|
|
153
|
-
|
|
154
|
-
If Slack reports the URL unverified, save the connection here, then retry under **Event
|
|
155
|
-
Subscriptions**.
|
|
156
|
-
|
|
157
|
-
## 2. Copy the signing secret
|
|
158
|
-
|
|
159
|
-
Copy **Basic Information → App Credentials → Signing Secret** into the **Signing secret** field
|
|
160
|
-
below. Every webhook request is verified with it; without it every request is refused.
|
|
222
|
+
Slack verifies the Request URL when you save, and Capybara answers because the connection now
|
|
223
|
+
exists. Reinstall the app if Slack asks.
|
|
161
224
|
|
|
162
225
|
::check capybara:webhook-public Webhook address is reachable from the internet
|
|
163
226
|
::check capybara:webhook-received Slack has delivered a signed request
|
|
164
227
|
:::
|
|
165
228
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
Choose **Install App → Install to Workspace** and copy the **Bot User OAuth Token** (`xoxb-…`)
|
|
169
|
-
into the **Bot token** field below.
|
|
170
|
-
|
|
171
|
-
::check bot-token Bot token works
|
|
172
|
-
::check bot-scopes The app has every scope in the manifest
|
|
229
|
+
---
|
|
173
230
|
|
|
174
231
|
## Sign in with Slack
|
|
175
232
|
|
package/guides/slack-app.zh.md
CHANGED
|
@@ -7,10 +7,11 @@
|
|
|
7
7
|
## 1. 用 manifest 创建应用
|
|
8
8
|
|
|
9
9
|
打开 <https://api.slack.com/apps>,选择 **Create New App → From a manifest**,选中你的工作区,
|
|
10
|
-
粘贴下面的 manifest
|
|
10
|
+
粘贴下面的 manifest。
|
|
11
11
|
|
|
12
12
|
::: mode long_connection
|
|
13
|
-
Socket Mode 不需要公网地址:由 Slack 与 Capybara
|
|
13
|
+
Socket Mode 不需要公网地址:由 Slack 与 Capybara 之间保持一条长连接。这份 manifest 会登记插件需要的
|
|
14
|
+
机器人权限、事件和斜杠命令。
|
|
14
15
|
|
|
15
16
|
```yaml title="应用 manifest(Socket Mode)"
|
|
16
17
|
# Slack app manifest for the Capybara Slack plugin, Socket Mode (long connection).
|
|
@@ -26,7 +27,7 @@ features:
|
|
|
26
27
|
messages_tab_enabled: true
|
|
27
28
|
messages_tab_read_only_enabled: false
|
|
28
29
|
bot_user:
|
|
29
|
-
display_name:
|
|
30
|
+
display_name: Capybara
|
|
30
31
|
always_online: true
|
|
31
32
|
slash_commands:
|
|
32
33
|
- command: /new
|
|
@@ -70,7 +71,52 @@ settings:
|
|
|
70
71
|
org_deploy_enabled: false
|
|
71
72
|
token_rotation_enabled: false
|
|
72
73
|
```
|
|
74
|
+
:::
|
|
75
|
+
|
|
76
|
+
::: mode webhook
|
|
77
|
+
Webhook 模式下,Slack 把事件、卡片点击和斜杠命令发到这个渠道连接的地址,而这个地址要等连接保存后
|
|
78
|
+
才存在。先用这份基础 manifest:它只登记机器人和权限,不含任何地址。保存之后,第 5 步再补上地址。
|
|
73
79
|
|
|
80
|
+
```yaml title="基础应用 manifest(Webhook)"
|
|
81
|
+
# Slack app manifest for the Capybara Slack plugin, webhook inbound mode, first step: no
|
|
82
|
+
# addresses yet. Step 5 replaces it with the full manifest once the connection is saved.
|
|
83
|
+
# Reference: https://docs.slack.dev/reference/app-manifest (checked 2026-11-09).
|
|
84
|
+
display_information:
|
|
85
|
+
# Slack caps app names at 35 characters; shorten it in the app settings if it is longer.
|
|
86
|
+
name: "{{connectionName}}"
|
|
87
|
+
description: Chat with your organization's Capybara agents.
|
|
88
|
+
background_color: "#3d2f24"
|
|
89
|
+
features:
|
|
90
|
+
app_home:
|
|
91
|
+
home_tab_enabled: false
|
|
92
|
+
messages_tab_enabled: true
|
|
93
|
+
messages_tab_read_only_enabled: false
|
|
94
|
+
bot_user:
|
|
95
|
+
display_name: Capybara
|
|
96
|
+
always_online: true
|
|
97
|
+
oauth_config:
|
|
98
|
+
# Sign in with Slack (identity-source@1).
|
|
99
|
+
redirect_urls:
|
|
100
|
+
- "{{signInCallbackUrl}}"
|
|
101
|
+
scopes:
|
|
102
|
+
bot:
|
|
103
|
+
- chat:write # post and update replies and cards
|
|
104
|
+
- commands # slash commands /new, /env, /capybara
|
|
105
|
+
- im:write # conversations.open: tell the bot's own DM from other DMs
|
|
106
|
+
- im:history # message.im: direct messages to the bot
|
|
107
|
+
- app_mentions:read # app_mention: @capybara in channels
|
|
108
|
+
- channels:history # message.channels: thread replies in public channels
|
|
109
|
+
- groups:history # message.groups: thread replies in private channels
|
|
110
|
+
- users:read # users.info; team_join / user_change; users.list
|
|
111
|
+
- users:read.email # directory@1: email addresses in users.list
|
|
112
|
+
settings:
|
|
113
|
+
socket_mode_enabled: false
|
|
114
|
+
org_deploy_enabled: false
|
|
115
|
+
token_rotation_enabled: false
|
|
116
|
+
```
|
|
117
|
+
:::
|
|
118
|
+
|
|
119
|
+
::: mode long_connection
|
|
74
120
|
## 2. 创建应用级令牌
|
|
75
121
|
|
|
76
122
|
在 **Basic Information → App-Level Tokens** 选择 **Generate Token and Scopes**,添加权限
|
|
@@ -80,7 +126,30 @@ settings:
|
|
|
80
126
|
:::
|
|
81
127
|
|
|
82
128
|
::: mode webhook
|
|
83
|
-
|
|
129
|
+
## 2. 复制签名密钥
|
|
130
|
+
|
|
131
|
+
把 **Basic Information → App Credentials → Signing Secret** 填进下方的 **签名密钥**。每个 webhook
|
|
132
|
+
请求都用它校验;不填则所有请求都会被拒绝。
|
|
133
|
+
:::
|
|
134
|
+
|
|
135
|
+
## 3. 安装应用并复制机器人令牌
|
|
136
|
+
|
|
137
|
+
选择 **Install App → Install to Workspace**,把 **Bot User OAuth Token**(`xoxb-…`)填进下方的
|
|
138
|
+
**机器人令牌**。
|
|
139
|
+
|
|
140
|
+
::check bot-token 机器人令牌可用
|
|
141
|
+
::check bot-scopes 应用具备 manifest 中的全部权限
|
|
142
|
+
|
|
143
|
+
## 4. 保存渠道
|
|
144
|
+
|
|
145
|
+
填好本页其余字段并保存,保存时 Capybara 会校验机器人令牌。使用 Socket Mode 时到这里就完成了:机器人
|
|
146
|
+
会自动连上,可以开始收消息。
|
|
147
|
+
|
|
148
|
+
::: mode webhook
|
|
149
|
+
## 5. 让 Slack 指向这个连接
|
|
150
|
+
|
|
151
|
+
保存之后,下面的 manifest 会带上这个连接的地址 `{{webhookUrl}}`(保存前按原样显示)。在应用里打开
|
|
152
|
+
**App Manifest**,用这份 manifest 整体替换并保存。它会加上斜杠命令、事件订阅和交互,全部发往这个地址。
|
|
84
153
|
|
|
85
154
|
```yaml title="应用 manifest(Webhook)"
|
|
86
155
|
# Slack app manifest for the Capybara Slack plugin, webhook inbound mode.
|
|
@@ -96,7 +165,7 @@ features:
|
|
|
96
165
|
messages_tab_enabled: true
|
|
97
166
|
messages_tab_read_only_enabled: false
|
|
98
167
|
bot_user:
|
|
99
|
-
display_name:
|
|
168
|
+
display_name: Capybara
|
|
100
169
|
always_online: true
|
|
101
170
|
slash_commands:
|
|
102
171
|
- command: /new
|
|
@@ -146,26 +215,13 @@ settings:
|
|
|
146
215
|
token_rotation_enabled: false
|
|
147
216
|
```
|
|
148
217
|
|
|
149
|
-
|
|
150
|
-
应答校验,所以要先保存渠道连接。若 Slack 提示地址未通过校验,先在这里保存连接,再到
|
|
151
|
-
**Event Subscriptions** 重试。
|
|
152
|
-
|
|
153
|
-
## 2. 复制签名密钥
|
|
154
|
-
|
|
155
|
-
把 **Basic Information → App Credentials → Signing Secret** 填进下方的 **签名密钥**。每个 webhook
|
|
156
|
-
请求都用它校验;不填则所有请求都会被拒绝。
|
|
218
|
+
保存时 Slack 会校验 Request URL;连接已经存在,Capybara 会应答校验。Slack 要求时重新安装应用。
|
|
157
219
|
|
|
158
220
|
::check capybara:webhook-public Webhook 地址可从公网访问
|
|
159
221
|
::check capybara:webhook-received Slack 已送达一个签名有效的请求
|
|
160
222
|
:::
|
|
161
223
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
选择 **Install App → Install to Workspace**,把 **Bot User OAuth Token**(`xoxb-…`)填进下方的
|
|
165
|
-
**机器人令牌**。
|
|
166
|
-
|
|
167
|
-
::check bot-token 机器人令牌可用
|
|
168
|
-
::check bot-scopes 应用具备 manifest 中的全部权限
|
|
224
|
+
---
|
|
169
225
|
|
|
170
226
|
## Slack 登录
|
|
171
227
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capybara-hq/plugin-slack",
|
|
3
|
-
"version": "0.1.0-rc.
|
|
3
|
+
"version": "0.1.0-rc.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"description": "Slack (channel@1 bot over Socket Mode with Block Kit cards, identity-source@1 Sign in with Slack, directory@1)",
|