@owlmeans/bot-slack 0.0.0-stage → 0.2.0-alpha.0

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.
Files changed (66) hide show
  1. package/README.md +74 -2
  2. package/agent-meta/manifest.json +16 -0
  3. package/agent-meta/skills/bot-slack/SKILL.md +117 -0
  4. package/build/api.d.ts +7 -0
  5. package/build/api.d.ts.map +1 -0
  6. package/build/api.js +65 -0
  7. package/build/api.js.map +1 -0
  8. package/build/append.d.ts +9 -0
  9. package/build/append.d.ts.map +1 -0
  10. package/build/append.js +13 -0
  11. package/build/append.js.map +1 -0
  12. package/build/consts.d.ts +70 -0
  13. package/build/consts.d.ts.map +1 -0
  14. package/build/consts.js +205 -0
  15. package/build/consts.js.map +1 -0
  16. package/build/errors.d.ts +22 -0
  17. package/build/errors.d.ts.map +1 -0
  18. package/build/errors.js +35 -0
  19. package/build/errors.js.map +1 -0
  20. package/build/index.d.ts +8 -0
  21. package/build/index.d.ts.map +1 -0
  22. package/build/index.js +7 -0
  23. package/build/index.js.map +1 -0
  24. package/build/mock.d.ts +10 -0
  25. package/build/mock.d.ts.map +1 -0
  26. package/build/mock.js +253 -0
  27. package/build/mock.js.map +1 -0
  28. package/build/normalize.d.ts +4 -0
  29. package/build/normalize.d.ts.map +1 -0
  30. package/build/normalize.js +131 -0
  31. package/build/normalize.js.map +1 -0
  32. package/build/plugin.d.ts +11 -0
  33. package/build/plugin.d.ts.map +1 -0
  34. package/build/plugin.js +165 -0
  35. package/build/plugin.js.map +1 -0
  36. package/build/signature.d.ts +8 -0
  37. package/build/signature.d.ts.map +1 -0
  38. package/build/signature.js +25 -0
  39. package/build/signature.js.map +1 -0
  40. package/build/text.d.ts +9 -0
  41. package/build/text.d.ts.map +1 -0
  42. package/build/text.js +12 -0
  43. package/build/text.js.map +1 -0
  44. package/build/types.d.ts +185 -0
  45. package/build/types.d.ts.map +1 -0
  46. package/build/types.js +2 -0
  47. package/build/types.js.map +1 -0
  48. package/package.json +56 -4
  49. package/src/api.ts +70 -0
  50. package/src/append.ts +18 -0
  51. package/src/consts.ts +231 -0
  52. package/src/errors.ts +38 -0
  53. package/src/index.ts +7 -0
  54. package/src/mock.ts +287 -0
  55. package/src/normalize.ts +157 -0
  56. package/src/plugin.ts +191 -0
  57. package/src/signature.ts +33 -0
  58. package/src/text.ts +16 -0
  59. package/src/types.ts +207 -0
  60. package/tests/context.ts +85 -0
  61. package/tests/descriptor.spec.ts +64 -0
  62. package/tests/mock-ids.spec.ts +36 -0
  63. package/tests/slack-runtime.spec.ts +210 -0
  64. package/tests/slack.spec.ts +420 -0
  65. package/tests/tsconfig.json +12 -0
  66. package/tsconfig.json +16 -0
package/README.md CHANGED
@@ -1,3 +1,75 @@
1
- # Temporary Holding Version
1
+ # @owlmeans/bot-slack
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The Slack plugin of OwlMeans chat bots: a `BotPlatformPlugin` for `@owlmeans/server-bot` over
4
+ the Slack Events API and Web API: `auth.test` verifies the bot (and the optional admin user) token, every event's `v0` signature is checked over the raw body, `url_verification` is answered, and `chat.postMessage` (always in the thread), `reactions.add` and — with the admin user token — `chat.delete` act; the Request URL is set up by hand in the Slack app. It ships the platform's descriptor (`SLACK_DESCRIPTOR` — credentials with their labels and
5
+ hints in eight languages, receive modes, actions, setup hint) that the
6
+ `@owlmeans/web-bot` panels draw through `platform.list`, and an API-faithful mock the platform's tests,
7
+ the runtime smoke and end-to-end runs use. It lives in OwlMeans connect because it names a provider;
8
+ the bot runtime and contract it plugs into are in common, which never depends on it.
9
+
10
+ ## Installation
11
+
12
+ ```bash
13
+ bun add @owlmeans/bot-slack@^0.2.0-alpha.0
14
+ ```
15
+
16
+ ## Usage
17
+
18
+ Registration is explicit — importing the package registers nothing:
19
+
20
+ ```typescript
21
+ import { makeBotService } from '@owlmeans/server-bot'
22
+ import { slackBotPlatform } from '@owlmeans/bot-slack'
23
+
24
+ export const makeService = () => makeBotService({
25
+ secret: () => process.env.APP_SECRET ?? '',
26
+ platforms: [slackBotPlatform], // beside the other platforms the product supports
27
+ })
28
+
29
+ // or, on a context whose bot service may not exist yet:
30
+ import { appendSlackBotPlatform } from '@owlmeans/bot-slack'
31
+ appendSlackBotPlatform(context)
32
+ ```
33
+
34
+ ## The platform
35
+
36
+ | | |
37
+ |---|---|
38
+ | Id (stored, in the hook URL) | `slack` (`SLACK_PLATFORM`) |
39
+ | Credentials | `botToken`, `signingSecret`, optional admin `userToken` (enables `delete`) |
40
+ | Receive | webhook (manual) |
41
+ | Actions | reply, send, react; delete with `userToken` |
42
+ | Refusals | `SlackApiError` (`bot:platform:slack:<method>:<error>`, `method`, `code`, `retryAfter`) — subclasses of `BotErrorPlatform`, travelling under its type name |
43
+ | Options | `makeSlackBotPlatform({ … })`: `base`, `retries`, `maxRetryWaitS` |
44
+
45
+ ## API
46
+
47
+ - `slackBotPlatform` — the ready instance; `makeSlackBotPlatform(options?)` — a configured one;
48
+ `appendSlackBotPlatform(context, options?, alias?)` — register on the context's bot service
49
+ - `SLACK_PLATFORM`, `SLACK_DESCRIPTOR`, `SLACK_CREDENTIALS`, `SLACK_HINT`, `slackSignatureHelper`, `slackTextHelper` and the protocol constants
50
+ - the native payload types and the plugin's options
51
+
52
+ The `bot-slack` skill covers every API call the plugin makes, its normalization and its mock; the
53
+ `server-bot` skill (common) covers the plugin interface, the mock transport and the runtime.
54
+
55
+ ## Related packages
56
+
57
+ - `@owlmeans/server-bot` — the bot runtime this plugs into (common)
58
+ - `@owlmeans/bot` — the contract: the descriptor, connections, updates, the errors (common)
59
+ - `@owlmeans/web-bot` — the panels that draw the descriptor (common)
60
+
61
+ <!-- owlmeans:agent-guidance:start -->
62
+ ## Agent guidance
63
+
64
+ This package ships embedded agent skills under `agent-meta/`. After installing your
65
+ `@owlmeans/*` packages, run the OwlMeans agent-skills installer to place them into
66
+ your project's skill store (`.agents/skills/`):
67
+
68
+ ```sh
69
+ npx @owlmeans/agent-skills@^0.2.0-alpha.0
70
+ ```
71
+
72
+ The embedded files are version-matched to this package release. Do not edit them
73
+ directly — they are regenerated on each publish. To contribute guidance edits,
74
+ open a PR against the source monorepo.
75
+ <!-- owlmeans:agent-guidance:end -->
@@ -0,0 +1,16 @@
1
+ {
2
+ "schemaVersion": 3,
3
+ "package": "@owlmeans/bot-slack",
4
+ "version": "0.2.0-alpha.0",
5
+ "generatedAt": "2026-11-09T19:45:13.356Z",
6
+ "canonicalRepo": "https://github.com/owlmeans/connect",
7
+ "entries": [
8
+ {
9
+ "kind": "skill",
10
+ "name": "bot-slack",
11
+ "category": "package-specific",
12
+ "file": "skills/bot-slack/SKILL.md",
13
+ "canonicalPath": ".agents/skills/bot-slack/SKILL.md"
14
+ }
15
+ ]
16
+ }
@@ -0,0 +1,117 @@
1
+ ---
2
+ name: bot-slack
3
+ description: "How to use @owlmeans/bot-slack (OwlMeans connect) — the Slack plugin of @owlmeans/server-bot: registering it (makeSlackBotPlatform, slackBotPlatform, appendSlackBotPlatform), its descriptor (bot token, signing secret, the optional admin user token that enables delete; labels and hints in eight languages), the Web API calls each step makes, the v0 request signature and url_verification, the manual setup (scopes, events, Request URL), its normalization (threads, edits, retries deduplicated) and its mock (auth recorded as bot, user or none). Auto-invoked when wiring Slack into a bot service, debugging a Slack connection, event delivery or refusal, or testing against the Slack mock."
4
+ user-invocable: false
5
+ ---
6
+ <!-- AUTO-GENERATED — do not edit. Regenerate via sync-agent-meta. -->
7
+
8
+ # @owlmeans/bot-slack
9
+
10
+ **Layer:** Server (a platform plugin)
11
+ **Repo:** OwlMeans connect (`@owlmeans/bot-slack`) — the Slack-specific half; the bot runtime it plugs
12
+ into (`@owlmeans/server-bot`) and the contract (`@owlmeans/bot`) are in common, which never depends on it
13
+ **Install:** `"@owlmeans/bot-slack": "^0.2.0-alpha.0"` in the backend's `dependencies`
14
+
15
+ The Slack plugin (Events API + Web API: manual Request URL): a `BotPlatformPlugin` over server-bot's public helpers, its
16
+ descriptor (`SLACK_DESCRIPTOR` — the data the panels draw through `platform.list`, its labels and hints
17
+ in the eight panel languages) and its API-faithful mock. The plugin interface, the rules every plugin
18
+ follows and the mock transport are the `server-bot` skill's `platforms` part.
19
+
20
+ ## Registration — explicit, never a side-effect import
21
+
22
+ ```ts
23
+ import { makeBotService } from '@owlmeans/server-bot'
24
+ import { slackBotPlatform } from '@owlmeans/bot-slack'
25
+
26
+ makeBotService({ secret, platforms: [slackBotPlatform /* , the other platforms the product supports */] })
27
+ // or, on a context whose bot service exists (appendBot's defaults otherwise):
28
+ appendSlackBotPlatform(context, options?) // = appendBot(context).register(makeSlackBotPlatform(options))
29
+ ```
30
+
31
+ | Export | What it is |
32
+ |---|---|
33
+ | `slackBotPlatform` | the ready instance — its `mock` holds the mock state of every mock connection it serves |
34
+ | `makeSlackBotPlatform({ base, retries, maxRetryWaitS })` | a configured plugin (a test or a proxy) |
35
+ | `appendSlackBotPlatform(ctx, options?, alias?)` | registers a configured plugin on the context's bot service |
36
+ | `SLACK_PLATFORM` (`'slack'`), `SLACK_DESCRIPTOR`, `SLACK_CREDENTIALS`, `SLACK_HINT` | the stored id and the descriptor data |
37
+ | `SlackApiError` | the API refusals — subclasses of `BotErrorPlatform` declaring NO type name of their own: they travel as `BotErrorPlatform` (`bot:platform:slack:<detail>`), so a refusal is rebuilt and explained where this package is not loaded |
38
+ | `SLACK_*`, `SLACK_DESCRIPTOR`, `slackSignatureHelper`, `slackTextHelper` | protocol constants and helpers |
39
+
40
+ - The id `slack` is stored on every connection, inbox row and activity, and is the hook URL segment —
41
+ it never changes.
42
+ - The descriptor's texts are complete in `en`, `pl`, `ru`, `be`, `uk`, `es`, `de`, `fr`
43
+ (`tests/descriptor.spec.ts` holds that); a new language is added here, never in `@owlmeans/web-bot`.
44
+
45
+ ## The Slack API
46
+
47
+ Docs (moved from api.slack.com to docs.slack.dev, which the old URLs redirect to):
48
+ https://docs.slack.dev/apis/events-api/ (envelope, retries, 3 s answer, 30 000 events/workspace/app/h),
49
+ https://docs.slack.dev/authentication/verifying-requests-from-slack (signature),
50
+ https://docs.slack.dev/reference/events/url_verification (handshake: answer `{"challenge"}` as JSON,
51
+ form or text), https://docs.slack.dev/reference/events/message (subtypes, `edited`) and
52
+ …/message/message_changed, https://docs.slack.dev/reference/events/app_mention (`app_mentions:read`; no
53
+ event in DMs or in channels the app is not in), https://docs.slack.dev/reference/methods/{auth.test,
54
+ chat.postMessage, chat.delete, reactions.add}, https://docs.slack.dev/apis/web-api/rate-limits (HTTP 429
55
+ + `Retry-After` seconds, per method and workspace), https://docs.slack.dev/messaging/formatting-message-text/
56
+ (`& < >` escaping). Calls are `POST <base>/<method>`, `Authorization: Bearer <token>`, JSON
57
+ (`application/json; charset=utf-8`); every answer is `{ ok, error?, warning? }`, `ok: false` →
58
+ `SlackApiError` `bot:platform:slack:<method>:<error>` (`method`, `code`, `retryAfter`). `base` defaults to
59
+ `https://slack.com/api` (`makeSlackBotPlatform({ base, retries = 2, maxRetryWaitS = 30 })`): a 429 is
60
+ retried after its `Retry-After` at most `retries` times and never when the wait exceeds the bound —
61
+ then the call fails `ratelimited`.
62
+
63
+ | Plugin step | Slack | Notes |
64
+ |---|---|---|
65
+ | verify | `auth.test` (bot token) → `{ id: user_id, username: user, name: team }` | live needs `botToken` + `signingSecret`; `invalid_auth` `not_authed` `account_inactive` `token_revoked` `token_expired` `not_allowed_token_type` → `BotCredentialsRejected`; no `bot_id` → not a bot token |
66
+ | verify (admin) | `auth.test` with `userToken` when set | must be a user token (no `bot_id`) of the SAME `team_id` |
67
+ | setup | manual | scopes `chat:write channels:history groups:history im:history app_mentions:read reactions:write`; bot events `message.channels message.groups message.im app_mention`; Request URL = `hookUrl`; invite the bot; optional admin user token (user scope `chat:write`) for delete. Credentials are saved BEFORE the URL: Slack sends `url_verification` at once |
68
+ | authenticate | `X-Slack-Signature` = `v0=` hex HMAC-SHA256(signingSecret, `v0:<X-Slack-Request-Timestamp>:<raw body>`) | timing-safe; timestamp ±300 s; POST only; then `url_verification` → `{ result: 'challenge', reply: { challenge } }` (signed like any event). A MOCK connection also accepts its `hookSecret`; a live one never |
69
+ | reply | `chat.postMessage { channel, text, thread_ts: to.thread ?? to.id }` | always in the thread; the created ref keeps the thread |
70
+ | send | `chat.postMessage { channel, text, thread_ts? }` | text clipped to 40 000, then `& < >` escaped (plain text stays literal) |
71
+ | delete | `chat.delete { channel, ts }` with the `userToken` | a bot token deletes only the bot's own posts; without `userToken` the plugin throws `BotUnsupportedAction` (the descriptor already hides `delete`) |
72
+ | react | `reactions.add { channel, timestamp, name }` | a name, colons stripped; common Unicode emoji map to names (`SLACK_EMOJI_NAMES`: 👍 `+1`, 👎 `-1`, ⚠️ `warning` …), others go as given (`invalid_name`) |
73
+ | mute / ban | — | `BotUnsupportedAction` |
74
+
75
+ Normalization (`event_callback` only; `url_verification`, `app_rate_limited` and other events → none):
76
+ `message` with no subtype or `thread_broadcast` / `file_share` / `me_message` → `message`/`command`;
77
+ `message_changed` → `edited` only when its `message` carries text that changed (`edited` set, or the
78
+ text differs from `previous_message`) — metadata/unfurl changes are ignored; every other subtype
79
+ (`bot_message`, `message_deleted`, `channel_join` …) and the bot's own posts (`user` = the bot user,
80
+ or `bot_id` with this app's `app_id` / `bot_profile.app_id` = `api_app_id`) → none. Another app's bot
81
+ is kept with `sender.bot`. `app_mention` → a message, `addressed`. Chat = `channel`, `private` for
82
+ `channel_type: 'im'` (or a `D…` id — `app_mention` has no type), else `group`; `space` = `team_id`;
83
+ `thread` = `thread_ts`; message id = `ts`; `replyTo` = the parent (`thread_ts` ≠ `ts`, sender
84
+ `parent_user_id`); sender = `user` (`user_profile` / `bot_profile` names when delivered); text decoded
85
+ (`&amp; &lt; &gt;`); command via `botCommandHelper.parse` on the text. `addressed`: a DM, an
86
+ `app_mention`, `<@BOTID>` (or `<@BOTID|name>`) in the ESCAPED text, or a thread reply under the bot's
87
+ post. The bot id is `identity.id`, else the envelope's `authorizations[].user_id` with `is_bot`.
88
+
89
+ `platformId` = `<channel>:<ts>` (an edit: `<channel>:<ts>:edited:<edited.ts>`), not `event_id`: Slack
90
+ re-signs a retry (`X-Slack-Retry-Num` 1–3, ~now, +1 min, +5 min) with the same message, AND sends one
91
+ mention twice (`message.*` and `app_mention`, different `event_id`s) — one key stores both once.
92
+
93
+ Slash commands (`/cmd` registered in the app) are a separate form-encoded flow with its own
94
+ `response_url` — not handled; a `/word` typed as a message is parsed as a command like any text.
95
+
96
+ Mock: `auth.test` answers a stable fake workspace/app/bot per connection id
97
+ (`slackBotPlatform.mock.identityOf(id)`: `teamId`, `appId`, `botId`, `botUserId`, `username`
98
+ `mock_<id>_bot`, `adminUserId`) — the admin for the connection's `userToken`; `chat.postMessage` answers
99
+ `{ ok, channel, ts, message }` with increasing `ts` (`<s>.<µs>`, now with random sub-millisecond µs; inbound too, `event_id` random), `no_text` / `channel_not_found`;
100
+ `chat.delete` lets the bot token delete its own posts and the user token anyone's
101
+ (`cant_delete_message` otherwise); `reactions.add` refuses `:name:` and Unicode (`invalid_name`) and a
102
+ repeat (`already_reacted`); every call is a `BotMockCall` with `auth` `bot | user | none`.
103
+ `inbound` builds a real `event_callback` (`message`, `channel_type` `channel`, or `im` in a `D…` channel
104
+ for a private chat; `replyTo`/`thread` → `thread_ts` + `parent_user_id`; `@<bot username>` → `<@U…>`;
105
+ `& < >` escaped) signed NOW with `signingSecret`, else the `hookSecret`; `mock.challenge(connection,
106
+ value?)` builds a signed `url_verification`. Slack has no receiver: `mock.feed` throws.
107
+ `slackSignatureHelper.sign(secret, timestamp, body)` signs a hand-made payload.
108
+
109
+
110
+ ## Testing
111
+
112
+ `bun test ./tests` (category A — the mock and a test `fetch`, no network): normalization over the
113
+ documented payloads, authentication, the API client and its refusals, the mock's answers and its ids'
114
+ uniqueness across lifetimes (`mock-ids.spec.ts`), the descriptor (`descriptor.spec.ts`: complete in eight
115
+ languages, a restart simulated over the same store), and the platform end to end on a mock connection
116
+ through the service (`tests/context.ts`'s `makeTestBot` registers `slackBotPlatform`; `botMockHelper` is
117
+ `makeBotMockHelper([slackBotPlatform])`).
package/build/api.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ import type { SlackApiFactory } from './types.js';
2
+ /**
3
+ * The Web API over a session: `POST <base>/<method>`, JSON in, `Authorization: Bearer <token>`, the
4
+ * `{ ok, error? }` answer out. Tokens travel in a header — never in a URL, never in an error.
5
+ */
6
+ export declare const makeSlackApi: SlackApiFactory;
7
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAyB,eAAe,EAAoB,MAAM,YAAY,CAAA;AAkB1F;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,eA6C1B,CAAA"}
package/build/api.js ADDED
@@ -0,0 +1,65 @@
1
+ import { SLACK_CALL_TIMEOUT_MS, SLACK_RATE_LIMIT_DEFAULT_WAIT_S } from './consts.js';
2
+ import { SlackApiError } from './errors.js';
3
+ import { botSignalHelper } from '@owlmeans/server-bot';
4
+ /** `Retry-After` in seconds (an HTTP date counts from now); the default when absent or unreadable. */
5
+ const retryAfterOf = (response) => {
6
+ const value = response.headers.get('retry-after');
7
+ if (value == null || value.trim() === '') {
8
+ return SLACK_RATE_LIMIT_DEFAULT_WAIT_S;
9
+ }
10
+ const seconds = Number(value);
11
+ if (Number.isFinite(seconds) && seconds >= 0) {
12
+ return Math.ceil(seconds);
13
+ }
14
+ const at = Date.parse(value);
15
+ return Number.isFinite(at) ? Math.max(0, Math.ceil((at - Date.now()) / 1000)) : SLACK_RATE_LIMIT_DEFAULT_WAIT_S;
16
+ };
17
+ /**
18
+ * The Web API over a session: `POST <base>/<method>`, JSON in, `Authorization: Bearer <token>`, the
19
+ * `{ ok, error? }` answer out. Tokens travel in a header — never in a URL, never in an error.
20
+ */
21
+ export const makeSlackApi = (session, base, retry) => {
22
+ const call = async (method, params = {}, opts = {}) => {
23
+ const token = opts.token ?? session.connection.credentials.botToken ?? '';
24
+ for (let attempt = 0;; attempt++) {
25
+ let response;
26
+ try {
27
+ response = await session.fetch(`${base}/${method}`, {
28
+ method: 'POST',
29
+ headers: { 'content-type': 'application/json; charset=utf-8', authorization: `Bearer ${token}` },
30
+ body: JSON.stringify(params),
31
+ signal: botSignalHelper.deadline(opts.timeoutMs ?? SLACK_CALL_TIMEOUT_MS, opts.signal),
32
+ });
33
+ }
34
+ catch (error) {
35
+ if (opts.signal?.aborted === true) {
36
+ throw error;
37
+ }
38
+ // Only the error's kind is passed on: a transport message is not ours to repeat.
39
+ const name = error instanceof Error ? error.name : 'Error';
40
+ throw SlackApiError.of(method, name === 'TimeoutError' ? 'timeout' : 'unreachable');
41
+ }
42
+ if (response.status === 429) {
43
+ const wait = retryAfterOf(response);
44
+ if (attempt < retry.retries && wait <= retry.maxRetryWaitS) {
45
+ await botSignalHelper.pause(wait * 1000, opts.signal);
46
+ continue;
47
+ }
48
+ throw SlackApiError.of(method, 'ratelimited', wait);
49
+ }
50
+ let answer;
51
+ try {
52
+ answer = await response.json();
53
+ }
54
+ catch {
55
+ throw SlackApiError.of(method, `http_${response.status}`);
56
+ }
57
+ if (answer?.ok !== true) {
58
+ throw SlackApiError.of(method, typeof answer?.error === 'string' && answer.error !== '' ? answer.error : `http_${response.status}`);
59
+ }
60
+ return answer;
61
+ }
62
+ };
63
+ return { call };
64
+ };
65
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,+BAA+B,EAAE,MAAM,aAAa,CAAA;AACpF,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAE3C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAEtD,sGAAsG;AACtG,MAAM,YAAY,GAAG,CAAC,QAAkB,EAAU,EAAE;IAClD,MAAM,KA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ACP,MAAM,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,QAAQ,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAA;YAC3D,CAAC;YACD,IAAI,MAAM,EAAE,EAAE,KAAK,IAAI,EAAE,CAAC;gBACxB,MAAM,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,MAAM,EAAE,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAA;YACrI,CAAC;YAED,OAAO,MAAM,CAAA;QACf,CAAC;IACH,CAAC,CAAA;IAED,OAAO,EAAE,IAAI,EAAE,CAAA;AACjB,CAAC,CAAA"}
@@ -0,0 +1,9 @@
1
+ import type { BasicContext } from '@owlmeans/context';
2
+ import type { SlackBotPlatformOptions, SlackBotPlatform } from './types.js';
3
+ /**
4
+ * Register the Slack plugin on the context's bot service — appending the service (`appendBot`, its
5
+ * default options) when it is not there yet — and answer the plugin. Registration is explicit:
6
+ * importing this package registers nothing.
7
+ */
8
+ export declare const appendSlackBotPlatform: <C extends BasicContext<any>>(context: C, opts?: SlackBotPlatformOptions, alias?: string) => SlackBotPlatform;
9
+ //# sourceMappingURL=append.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"append.d.ts","sourceRoot":"","sources":["../src/append.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAGrD,OAAO,KAAK,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAE3E;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,GAAI,CAAC,SAAS,YAAY,CAAC,GAAG,CAAC,WACvD,CAAC,SAAS,uBAAuB,UAAS,MAAM,KACxD,gBAKF,CAAA"}
@@ -0,0 +1,13 @@
1
+ import { appendBot, BOT_SERVICE } from '@owlmeans/server-bot';
2
+ import { makeSlackBotPlatform } from './plugin.js';
3
+ /**
4
+ * Register the Slack plugin on the context's bot service — appending the service (`appendBot`, its
5
+ * default options) when it is not there yet — and answer the plugin. Registration is explicit:
6
+ * importing this package registers nothing.
7
+ */
8
+ export const appendSlackBotPlatform = (context, opts, alias = BOT_SERVICE) => {
9
+ const plugin = makeSlackBotPlatform(opts);
10
+ appendBot(context, undefined, alias).register(plugin);
11
+ return plugin;
12
+ };
13
+ //# sourceMappingURL=append.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"append.js","sourceRoot":"","sources":["../src/append.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAGlD;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,OAAU,EAAE,IAA8B,EAAE,KAAK,GAAW,WAAW,EACrD,EAAE;IACpB,MAAM,MAAM,GAAG,oBAAoB,CAAC,IAAI,CAAC,CAAA;IACzC,SAAS,CAAC,OAAO,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;IAErD,OAAO,MAAM,CAAA;AACf,CAAC,CAAA"}
@@ -0,0 +1,70 @@
1
+ import { type BotCredentialField, type BotPlatformDescriptor, type BotTexts } from '@owlmeans/bot';
2
+ /** The Web API (https://docs.slack.dev/apis/web-api/) — override `base` for a proxy or a fake server. */
3
+ export declare const SLACK_API_BASE = "https://slack.com/api";
4
+ /** The headers Slack signs an Events API request with (lower-cased, as servers hand them over). */
5
+ export declare const SLACK_SIGNATURE_HEADER = "x-slack-signature";
6
+ export declare const SLACK_TIMESTAMP_HEADER = "x-slack-request-timestamp";
7
+ /** Set on a redelivery (1, 2, 3) — the inbox's dedupe key absorbs it. */
8
+ export declare const SLACK_RETRY_NUM_HEADER = "x-slack-retry-num";
9
+ /** The signature scheme: `v0=` + hex HMAC-SHA256(signing secret, `v0:<timestamp>:<raw body>`). */
10
+ export declare const SLACK_SIGNATURE_VERSION = "v0";
11
+ /** A request whose timestamp is further than this from now is a replay (seconds). */
12
+ export declare const SLACK_SIGNATURE_TOLERANCE_S = 300;
13
+ /** How long one Web API call may take. */
14
+ export declare const SLACK_CALL_TIMEOUT_MS = 15000;
15
+ /** Retries of a call answered 429, waiting its `Retry-After` each time. */
16
+ export declare const SLACK_RATE_LIMIT_RETRIES = 2;
17
+ /** A `Retry-After` longer than this (seconds) is not waited for: the call fails `ratelimited`. */
18
+ export declare const SLACK_RATE_LIMIT_MAX_WAIT_S = 30;
19
+ /** The wait when a 429 names none (seconds). */
20
+ export declare const SLACK_RATE_LIMIT_DEFAULT_WAIT_S = 1;
21
+ /** Slack truncates longer text; it is clipped here first, without splitting a surrogate pair. */
22
+ export declare const SLACK_TEXT_MAX = 40000;
23
+ /** The `message` subtypes that are a member's new message — every other subtype is ignored. */
24
+ export declare const SLACK_MESSAGE_SUBTYPES: readonly string[];
25
+ /** The subtype of an edit; it carries the new message in `message`. */
26
+ export declare const SLACK_EDIT_SUBTYPE = "message_changed";
27
+ /** `auth.test` refusals that mean the token itself is wrong — `BotCredentialsRejected`, not a fault. */
28
+ export declare const SLACK_CREDENTIAL_ERRORS: readonly string[];
29
+ /** The bot events a connection subscribes to (Event Subscriptions → Subscribe to bot events). */
30
+ export declare const SLACK_BOT_EVENTS: readonly string[];
31
+ /** The bot token scopes the plugin's calls and events need. */
32
+ export declare const SLACK_BOT_SCOPES: readonly string[];
33
+ /** The user token scope `chat.delete` needs with an admin's token. */
34
+ export declare const SLACK_USER_SCOPES: readonly string[];
35
+ /** What a person does first: the credentials, saved before Slack checks the Request URL. */
36
+ export declare const SLACK_SETUP_CREDENTIALS_STEP: string;
37
+ /** Followed by the connection's hook URL. */
38
+ export declare const SLACK_SETUP_HOOK_STEP = "Under Event Subscriptions, turn events on and paste the Request URL: ";
39
+ /** When the connection has no hook URL yet (saved without the application's public address). */
40
+ export declare const SLACK_SETUP_HOOK_PENDING_STEP: string;
41
+ /** The rest of the manual setup. */
42
+ export declare const SLACK_SETUP_TAIL_STEPS: readonly string[];
43
+ /**
44
+ * Slack reacts by emoji NAME. A Unicode emoji a handler written for any platform passes is mapped
45
+ * here (variation selectors stripped first); an unknown one goes as given and Slack answers `invalid_name`.
46
+ */
47
+ export declare const SLACK_EMOJI_NAMES: Readonly<Record<string, string>>;
48
+ /** The mock's simulated defaults: one public channel and one member of the fake workspace. */
49
+ export declare const SLACK_MOCK_CHANNEL_ID = "C0MOCK00001";
50
+ export declare const SLACK_MOCK_MEMBER_ID = "U0MOCK00001";
51
+ /** Who wrote a simulated thread's parent when it was not the fake bot. */
52
+ export declare const SLACK_MOCK_OTHER_ID = "U0MOCK00002";
53
+ export declare const SLACK_MOCK_TEAM_NAME = "Mock workspace";
54
+ /** The deprecated verification token every Events API payload still carries — ignored by the plugin. */
55
+ export declare const SLACK_MOCK_VERIFICATION_TOKEN = "mock-verification-token";
56
+ /** A mock `event_id` is `Ev` and this many random characters of {@link SLACK_MOCK_EVENT_ID_ALPHABET}. */
57
+ export declare const SLACK_MOCK_EVENT_ID_LENGTH = 10;
58
+ export declare const SLACK_MOCK_EVENT_ID_ALPHABET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
59
+ /** The platform id — a stored column and a hook URL segment: it never changes. */
60
+ export declare const SLACK_PLATFORM = "slack";
61
+ /** What a Slack connection needs typed (or generated), with its labels and hints in every panel language. */
62
+ export declare const SLACK_CREDENTIALS: readonly BotCredentialField[];
63
+ /** What a person does in Slack itself so the bot can act — in every panel language. */
64
+ export declare const SLACK_HINT: BotTexts;
65
+ /**
66
+ * The Slack descriptor — what the server verifies and acts by and what the panels draw (`platform.list`).
67
+ * `actions` are the calls the required credentials allow; `note` is never listed.
68
+ */
69
+ export declare const SLACK_DESCRIPTOR: BotPlatformDescriptor;
70
+ //# sourceMappingURL=consts.d.ts.map
@@ -0,0 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O,MAAM,6BAA6B,QAC+C,CAAA;AAEzF,oCAAoC;AACpC,eAAO,MAAM,sBAAsB,mBAMjC,CAAA;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAyB7D,CAAA;AAEF,8FAA8F;AAC9F,eAAO,MAAM,qBAAqB,gBAAgB,CAAA;AAClD,eAAO,MAAM,oBAAoB,gBAAgB,CAAA;AACjD,0EAA0E;AAC1E,eAAO,MAAM,mBAAmB,gBAAgB,CAAA;AAChD,eAAO,MAAM,oBAAoB,mBAAmB,CAAA;AACpD,wGAAwG;AACxG,eAAO,MAAM,6BAA6B,4BAA4B,CAAA;AACtE,yGAAyG;AACzG,eAAO,MAAM,0BAA0B,KAAK,CAAA;AAC5C,eAAO,MAAM,4BAA4B,yCAAyC,CAAA;AAElF,kFAAkF;AAClF,eAAO,MAAM,cAAc,UAAU,CAAA;AAErC,6GAA6G;AAC7G,eAAO,MAAM,iBAAiB,EAAE,SAAS,kBAAkB,EA6ExB,CAAA;AAEnC,uFAAuF;AACvF,eAAO,MAAM,UAAU,EAAE,QASvB,CAAA;AAEF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,qBAUJ,CAAA"}
@@ -0,0 +1,205 @@
1
+ import { BotActionKind, BotReceiveMode, } from '@owlmeans/bot';
2
+ /** The Web API (https://docs.slack.dev/apis/web-api/) — override `base` for a proxy or a fake server. */
3
+ export const SLACK_API_BASE = 'https://slack.com/api';
4
+ /** The headers Slack signs an Events API request with (lower-cased, as servers hand them over). */
5
+ export const SLACK_SIGNATURE_HEADER = 'x-slack-signature';
6
+ export const SLACK_TIMESTAMP_HEADER = 'x-slack-request-timestamp';
7
+ /** Set on a redelivery (1, 2, 3) — the inbox's dedupe key absorbs it. */
8
+ export const SLACK_RETRY_NUM_HEADER = 'x-slack-retry-num';
9
+ /** The signature scheme: `v0=` + hex HMAC-SHA256(signing secret, `v0:<timestamp>:<raw body>`). */
10
+ export const SLACK_SIGNATURE_VERSION = 'v0';
11
+ /** A request whose timestamp is further than this from now is a replay (seconds). */
12
+ export const SLACK_SIGNATURE_TOLERANCE_S = 300;
13
+ /** How long one Web API call may take. */
14
+ export const SLACK_CALL_TIMEOUT_MS = 15_000;
15
+ /** Retries of a call answered 429, waiting its `Retry-After` each time. */
16
+ export const SLACK_RATE_LIMIT_RETRIES = 2;
17
+ /** A `Retry-After` longer than this (seconds) is not waited for: the call fails `ratelimited`. */
18
+ export const SLACK_RATE_LIMIT_MAX_WAIT_S = 30;
19
+ /** The wait when a 429 names none (seconds). */
20
+ export const SLACK_RATE_LIMIT_DEFAULT_WAIT_S = 1;
21
+ /** Slack truncates longer text; it is clipped here first, without splitting a surrogate pair. */
22
+ export const SLACK_TEXT_MAX = 40_000;
23
+ /** The `message` subtypes that are a member's new message — every other subtype is ignored. */
24
+ export const SLACK_MESSAGE_SUBTYPES = Object.freeze(['thread_broadcast', 'file_share', 'me_message']);
25
+ /** The subtype of an edit; it carries the new message in `message`. */
26
+ export const SLACK_EDIT_SUBTYPE = 'message_changed';
27
+ /** `auth.test` refusals that mean the token itself is wrong — `BotCredentialsRejected`, not a fault. */
28
+ export const SLACK_CREDENTIAL_ERRORS = Object.freeze([
29
+ 'invalid_auth', 'not_authed', 'account_inactive', 'token_revoked', 'token_expired', 'not_allowed_token_type',
30
+ ]);
31
+ /** The bot events a connection subscribes to (Event Subscriptions → Subscribe to bot events). */
32
+ export const SLACK_BOT_EVENTS = Object.freeze(['message.channels', 'message.groups', 'message.im', 'app_mention']);
33
+ /** The bot token scopes the plugin's calls and events need. */
34
+ export const SLACK_BOT_SCOPES = Object.freeze([
35
+ 'chat:write', 'channels:history', 'groups:history', 'im:history', 'app_mentions:read', 'reactions:write',
36
+ ]);
37
+ /** The user token scope `chat.delete` needs with an admin's token. */
38
+ export const SLACK_USER_SCOPES = Object.freeze(['chat:write']);
39
+ /** What a person does first: the credentials, saved before Slack checks the Request URL. */
40
+ export const SLACK_SETUP_CREDENTIALS_STEP = 'In your Slack app (https://api.slack.com/apps) add the bot token scopes '
41
+ + `${SLACK_BOT_SCOPES.join(', ')} under OAuth & Permissions and install the app to the workspace; save its Bot `
42
+ + 'User OAuth Token (xoxb-…) as botToken and the Signing Secret (Basic Information → App Credentials) as '
43
+ + 'signingSecret on this connection BEFORE the next step — Slack checks the Request URL at once.';
44
+ /** Followed by the connection's hook URL. */
45
+ export const SLACK_SETUP_HOOK_STEP = 'Under Event Subscriptions, turn events on and paste the Request URL: ';
46
+ /** When the connection has no hook URL yet (saved without the application's public address). */
47
+ export const SLACK_SETUP_HOOK_PENDING_STEP = 'Under Event Subscriptions, turn events on and paste this connection\'s '
48
+ + 'Request URL — open the connection from the application\'s public address to see it.';
49
+ /** The rest of the manual setup. */
50
+ export const SLACK_SETUP_TAIL_STEPS = Object.freeze([
51
+ `Under "Subscribe to bot events" add ${SLACK_BOT_EVENTS.join(', ')}, save, and reinstall the app if Slack asks.`,
52
+ 'Invite the bot to every channel it should read (/invite @your-bot) — it only sees channels it is a member of.',
53
+ 'Optional, to delete members\' messages: a workspace admin or owner adds the user token scope '
54
+ + `${SLACK_USER_SCOPES.join(', ')}, reinstalls the app and saves their User OAuth Token (xoxp-…) as userToken; `
55
+ + 'without it the bot warns instead of deleting.',
56
+ ]);
57
+ /**
58
+ * Slack reacts by emoji NAME. A Unicode emoji a handler written for any platform passes is mapped
59
+ * here (variation selectors stripped first); an unknown one goes as given and Slack answers `invalid_name`.
60
+ */
61
+ export const SLACK_EMOJI_NAMES = Object.freeze({
62
+ '👍': '+1',
63
+ '👎': '-1',
64
+ '✅': 'white_check_mark',
65
+ '✔': 'heavy_check_mark',
66
+ '❌': 'x',
67
+ '⚠': 'warning',
68
+ '🚫': 'no_entry_sign',
69
+ '⛔': 'no_entry',
70
+ '🛑': 'octagonal_sign',
71
+ '👀': 'eyes',
72
+ '🙏': 'pray',
73
+ '❤': 'heart',
74
+ '🔥': 'fire',
75
+ '🎉': 'tada',
76
+ '👋': 'wave',
77
+ '😂': 'joy',
78
+ '😀': 'grinning',
79
+ '🙂': 'slightly_smiling_face',
80
+ '😢': 'cry',
81
+ '😡': 'rage',
82
+ '🤔': 'thinking_face',
83
+ '💯': '100',
84
+ '⭐': 'star',
85
+ '🦉': 'owl',
86
+ });
87
+ /** The mock's simulated defaults: one public channel and one member of the fake workspace. */
88
+ export const SLACK_MOCK_CHANNEL_ID = 'C0MOCK00001';
89
+ export const SLACK_MOCK_MEMBER_ID = 'U0MOCK00001';
90
+ /** Who wrote a simulated thread's parent when it was not the fake bot. */
91
+ export const SLACK_MOCK_OTHER_ID = 'U0MOCK00002';
92
+ export const SLACK_MOCK_TEAM_NAME = 'Mock workspace';
93
+ /** The deprecated verification token every Events API payload still carries — ignored by the plugin. */
94
+ export const SLACK_MOCK_VERIFICATION_TOKEN = 'mock-verification-token';
95
+ /** A mock `event_id` is `Ev` and this many random characters of {@link SLACK_MOCK_EVENT_ID_ALPHABET}. */
96
+ export const SLACK_MOCK_EVENT_ID_LENGTH = 10;
97
+ export const SLACK_MOCK_EVENT_ID_ALPHABET = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
98
+ /** The platform id — a stored column and a hook URL segment: it never changes. */
99
+ export const SLACK_PLATFORM = 'slack';
100
+ /** What a Slack connection needs typed (or generated), with its labels and hints in every panel language. */
101
+ export const SLACK_CREDENTIALS = Object.freeze([
102
+ Object.freeze({
103
+ key: 'botToken',
104
+ secret: true,
105
+ required: true,
106
+ label: Object.freeze({
107
+ en: 'Bot token (xoxb-…)',
108
+ pl: 'Token bota (xoxb-…)',
109
+ ru: 'Токен бота (xoxb-…)',
110
+ be: 'Токен бота (xoxb-…)',
111
+ uk: 'Токен бота (xoxb-…)',
112
+ es: 'Token del bot (xoxb-…)',
113
+ de: 'Bot-Token (xoxb-…)',
114
+ fr: 'Jeton du bot (xoxb-…)',
115
+ }),
116
+ hint: Object.freeze({
117
+ en: 'Your Slack app → OAuth & Permissions → Bot User OAuth Token.',
118
+ pl: 'Twoja aplikacja Slack → OAuth & Permissions → Bot User OAuth Token.',
119
+ ru: 'Ваше приложение Slack → OAuth & Permissions → Bot User OAuth Token.',
120
+ be: 'Ваша праграма Slack → OAuth & Permissions → Bot User OAuth Token.',
121
+ uk: 'Ваш застосунок Slack → OAuth & Permissions → Bot User OAuth Token.',
122
+ es: 'Tu app de Slack → OAuth & Permissions → Bot User OAuth Token.',
123
+ de: 'Ihre Slack-App → OAuth & Permissions → Bot User OAuth Token.',
124
+ fr: 'Votre app Slack → OAuth & Permissions → Bot User OAuth Token.',
125
+ }),
126
+ }),
127
+ Object.freeze({
128
+ key: 'signingSecret',
129
+ secret: true,
130
+ required: true,
131
+ label: Object.freeze({
132
+ en: 'Signing secret',
133
+ pl: 'Sekret podpisu',
134
+ ru: 'Секрет подписи',
135
+ be: 'Сакрэт подпісу',
136
+ uk: 'Секрет підпису',
137
+ es: 'Secreto de firma',
138
+ de: 'Signaturgeheimnis',
139
+ fr: 'Secret de signature',
140
+ }),
141
+ hint: Object.freeze({
142
+ en: 'Your Slack app → Basic Information → App Credentials.',
143
+ pl: 'Twoja aplikacja Slack → Basic Information → App Credentials.',
144
+ ru: 'Ваше приложение Slack → Basic Information → App Credentials.',
145
+ be: 'Ваша праграма Slack → Basic Information → App Credentials.',
146
+ uk: 'Ваш застосунок Slack → Basic Information → App Credentials.',
147
+ es: 'Tu app de Slack → Basic Information → App Credentials.',
148
+ de: 'Ihre Slack-App → Basic Information → App Credentials.',
149
+ fr: 'Votre app Slack → Basic Information → App Credentials.',
150
+ }),
151
+ }),
152
+ Object.freeze({
153
+ key: 'userToken',
154
+ secret: true,
155
+ required: false,
156
+ enables: Object.freeze([BotActionKind.Delete]),
157
+ label: Object.freeze({
158
+ en: 'Admin user token (xoxp-…)',
159
+ pl: 'Token administratora (xoxp-…)',
160
+ ru: 'Токен администратора (xoxp-…)',
161
+ be: 'Токен адміністратара (xoxp-…)',
162
+ uk: 'Токен адміністратора (xoxp-…)',
163
+ es: 'Token de usuario administrador (xoxp-…)',
164
+ de: 'Admin-Benutzertoken (xoxp-…)',
165
+ fr: 'Jeton utilisateur administrateur (xoxp-…)',
166
+ }),
167
+ hint: Object.freeze({
168
+ en: 'Lets the bot delete messages. Installed by a workspace admin; without it the bot warns instead.',
169
+ pl: 'Pozwala botowi usuwać wiadomości. Instaluje go administrator przestrzeni roboczej; bez niego bot zamiast tego ostrzega.',
170
+ ru: 'Позволяет боту удалять сообщения. Устанавливается администратором рабочего пространства; без него бот вместо этого предупреждает.',
171
+ be: 'Дазваляе боту выдаляць паведамленні. Усталёўваецца адміністратарам працоўнай прасторы; без яго бот замест гэтага папярэджвае.',
172
+ uk: 'Дозволяє боту видаляти повідомлення. Встановлює адміністратор робочого простору; без нього бот натомість попереджає.',
173
+ es: 'Permite al bot eliminar mensajes. Lo instala un administrador del espacio de trabajo; sin él, el bot advierte en su lugar.',
174
+ de: 'Erlaubt dem Bot, Nachrichten zu löschen. Ein Workspace-Admin installiert es; ohne es verwarnt der Bot stattdessen.',
175
+ fr: 'Permet au bot de supprimer des messages. Installé par un administrateur de l’espace de travail ; sans lui, le bot avertit à la place.',
176
+ }),
177
+ }),
178
+ ]);
179
+ /** What a person does in Slack itself so the bot can act — in every panel language. */
180
+ export const SLACK_HINT = Object.freeze({
181
+ en: 'Paste the URL below as the Request URL under Event Subscriptions of your Slack app, subscribe to message events and add the bot to its channels.',
182
+ pl: 'Wklej poniższy adres jako Request URL w Event Subscriptions swojej aplikacji Slack, zasubskrybuj zdarzenia wiadomości i dodaj bota do jego kanałów.',
183
+ ru: 'Вставьте URL ниже как Request URL в разделе Event Subscriptions вашего приложения Slack, подпишитесь на события сообщений и добавьте бота в нужные каналы.',
184
+ be: 'Устаўце URL ніжэй як Request URL у раздзеле Event Subscriptions вашай праграмы Slack, падпішыцеся на падзеі паведамленняў і дадайце бота ў патрэбныя каналы.',
185
+ uk: 'Вставте URL нижче як Request URL у розділі Event Subscriptions вашого застосунку Slack, підпишіться на події повідомлень і додайте бота до потрібних каналів.',
186
+ es: 'Pega la URL de abajo como Request URL en Event Subscriptions de tu app de Slack, suscríbete a los eventos de mensajes y añade el bot a sus canales.',
187
+ de: 'Fügen Sie die URL unten als Request URL unter Event Subscriptions Ihrer Slack-App ein, abonnieren Sie Nachrichtenereignisse und fügen Sie den Bot seinen Kanälen hinzu.',
188
+ fr: 'Collez l’URL ci-dessous comme Request URL dans Event Subscriptions de votre app Slack, abonnez-vous aux événements de message et ajoutez le bot à ses canaux.',
189
+ });
190
+ /**
191
+ * The Slack descriptor — what the server verifies and acts by and what the panels draw (`platform.list`).
192
+ * `actions` are the calls the required credentials allow; `note` is never listed.
193
+ */
194
+ export const SLACK_DESCRIPTOR = Object.freeze({
195
+ platform: SLACK_PLATFORM,
196
+ title: 'Slack',
197
+ glyph: 'hash',
198
+ credentials: SLACK_CREDENTIALS,
199
+ receive: Object.freeze([BotReceiveMode.Webhook]),
200
+ actions: Object.freeze([BotActionKind.Reply, BotActionKind.Send, BotActionKind.React]),
201
+ setup: 'manual',
202
+ docs: 'https://api.slack.com/apis/events-api',
203
+ hint: SLACK_HINT,
204
+ });
205
+ //# sourceMappingURL=consts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consts.js","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EAAE,cAAc,GAC9B,MAAM,eAAe,CAAA;AAEtB,yGAAyG;AACzG,MAAM,CAAC,MAAM,cAAc,GAAG,uBAAuB,CAAA;AAErD,mGAAmG;AACnG,MAAM,CAAC,MAAM,sBAAsB,GAAG,mBAAmB,CAAA;AACzD,MAAM,CAAC,MAAM,sBAAsB,GAAG,2BAA2B,CAAA;AACjE,yEAAyE;AACzE,MAAM,CAAC,MAAM,sBAAsB,GAAG,mBAAmB,CAAA;AAEzD,kGAAkG;AAClG,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAI,CAAA;AAE3C,qFAAqF;AACrF,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