@frogbotai/piece-slack 0.22.0 → 0.24.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.
- package/README.md +114 -0
- package/dist/actions.d.ts +1673 -0
- package/dist/actions.d.ts.map +1 -0
- package/dist/actions.js +641 -0
- package/dist/actions.js.map +1 -0
- package/dist/client.d.ts +44 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +116 -0
- package/dist/client.js.map +1 -0
- package/dist/config.d.ts +11 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +42 -0
- package/dist/config.js.map +1 -0
- package/dist/files.d.ts +11 -0
- package/dist/files.d.ts.map +1 -0
- package/dist/files.js +48 -0
- package/dist/files.js.map +1 -0
- package/dist/index.d.ts +1010 -61
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +99 -113
- package/dist/index.js.map +1 -1
- package/dist/options.d.ts +12 -0
- package/dist/options.d.ts.map +1 -0
- package/dist/options.js +50 -0
- package/dist/options.js.map +1 -0
- package/dist/triggers.d.ts +592 -0
- package/dist/triggers.d.ts.map +1 -0
- package/dist/triggers.js +348 -0
- package/dist/triggers.js.map +1 -0
- package/dist/webhook.d.ts +15 -0
- package/dist/webhook.d.ts.map +1 -0
- package/dist/webhook.js +99 -0
- package/dist/webhook.js.map +1 -0
- package/package.json +8 -11
- package/slack-manifest.yaml +32 -0
package/README.md
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# `@frogbotai/piece-slack`
|
|
2
|
+
|
|
3
|
+
Native Slack messaging, file, workspace administration, and app-event capabilities for FrogBot.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import { createSlack } from '@frogbotai/piece-slack';
|
|
9
|
+
|
|
10
|
+
export const slack = createSlack({
|
|
11
|
+
oauth: {
|
|
12
|
+
clientId: process.env.SLACK_CLIENT_ID!,
|
|
13
|
+
clientSecret: process.env.SLACK_CLIENT_SECRET!,
|
|
14
|
+
},
|
|
15
|
+
signingSecret: process.env.SLACK_SIGNING_SECRET!,
|
|
16
|
+
});
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Static credentials use `{ botToken, userToken?, teamId? }`. OAuth uses Slack OAuth v2 and stores the bot token, workspace ID, and optional authed-user token returned by Slack.
|
|
20
|
+
|
|
21
|
+
To attach the app to an agent, use the static bot token and add the piece instance to `channels`:
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import { createSlack } from '@frogbotai/piece-slack';
|
|
25
|
+
import { buildConfig } from 'frogbot';
|
|
26
|
+
|
|
27
|
+
export const slack = createSlack({
|
|
28
|
+
auth: { botToken: process.env.SLACK_BOT_TOKEN! },
|
|
29
|
+
signingSecret: process.env.SLACK_SIGNING_SECRET!,
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export default buildConfig({
|
|
33
|
+
agents: [
|
|
34
|
+
{
|
|
35
|
+
slug: 'support',
|
|
36
|
+
channels: [slack],
|
|
37
|
+
access: ({ req }) => !!req.user || req.context.channel?.piece === 'slack',
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
pieces: [slack],
|
|
41
|
+
});
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Actions
|
|
45
|
+
|
|
46
|
+
| Upstream action slug | Previous wrapper export | Native action | Notes |
|
|
47
|
+
| --------------------------------- | ------------------------------ | ------------------------ | ------------------------------------------------------------------------------------ |
|
|
48
|
+
| `slack-add-reaction-to-message` | `slackAddReactionToMessage` | `addReaction` | |
|
|
49
|
+
| `send_direct_message` | `sendDirectMessage` | `sendDirectMessage` | |
|
|
50
|
+
| `send_channel_message` | `sendChannelMessage` | `sendChannelMessage` | |
|
|
51
|
+
| `request_approval_direct_message` | `requestApprovalDirectMessage` | Omitted | Workflow waitpoint approval action. |
|
|
52
|
+
| `request_approval_message` | `requestApprovalMessage` | Omitted | Workflow waitpoint approval action. |
|
|
53
|
+
| `request_action_direct_message` | `requestActionDirectMessage` | Omitted | Workflow waitpoint action selection. |
|
|
54
|
+
| `request_action_message` | `requestActionMessage` | Omitted | Workflow waitpoint action selection. |
|
|
55
|
+
| `uploadFile` | `uploadFile` | `uploadFile` | Uses Slack's external upload flow. |
|
|
56
|
+
| `get-file` | `getFile` | `getFile` | Safely persists downloaded bytes in the FrogBot files collection. |
|
|
57
|
+
| `searchMessages` | `searchMessages` | `searchMessages` | Requires a user token. |
|
|
58
|
+
| `slack-find-user-by-email` | `slackFindUserByEmail` | `findUserByEmail` | |
|
|
59
|
+
| `slack-find-user-by-handle` | `slackFindUserByHandle` | `findUserByHandle` | |
|
|
60
|
+
| `find-user-by-id` | `findUserById` | `findUserById` | |
|
|
61
|
+
| `listUsers` | `listUsers` | `listUsers` | |
|
|
62
|
+
| `updateMessage` | `updateMessage` | `updateMessage` | |
|
|
63
|
+
| `delete-message` | `deleteMessage` | `deleteMessage` | Requires a user token. |
|
|
64
|
+
| `slack-create-channel` | `slackCreateChannel` | `createChannel` | |
|
|
65
|
+
| `slack-update-profile` | `slackUpdateProfile` | `updateProfile` | Requires a user token. |
|
|
66
|
+
| `getChannelHistory` | `getChannelHistory` | `getChannelHistory` | |
|
|
67
|
+
| `slack-set-user-status` | `slackSetUserStatus` | `setUserStatus` | Requires a user token. |
|
|
68
|
+
| `markdownToSlackFormat` | `markdownToSlackFormat` | `markdownToSlack` | Local conversion. |
|
|
69
|
+
| `retrieveThreadMessages` | `retrieveThreadMessages` | `listThreadMessages` | |
|
|
70
|
+
| `set-channel-topic` | `setChannelTopic` | `setChannelTopic` | |
|
|
71
|
+
| `get-message` | `getMessage` | `getMessage` | |
|
|
72
|
+
| `invite-user-to-channel` | `inviteUserToChannel` | `inviteUserToChannel` | |
|
|
73
|
+
| `get_group_by_handle` | `getGroupByHandle` | `getUserGroupByHandle` | |
|
|
74
|
+
| `update_group_users` | `updateGroupUsers` | `updateUserGroupMembers` | User-token update. |
|
|
75
|
+
| `custom_api_call` | `customApiCall` | `customApiCall` | Relative Slack Web API methods only; redirects and caller auth headers are rejected. |
|
|
76
|
+
|
|
77
|
+
## Triggers
|
|
78
|
+
|
|
79
|
+
Trigger filters use manual Slack IDs: channel IDs such as `C0123`, user IDs such as `U0123`, user group IDs such as `S0123`, and emoji names without colons. Empty filter arrays match every accessible value.
|
|
80
|
+
|
|
81
|
+
| Upstream trigger slug | Native trigger | Type | Slack subscription |
|
|
82
|
+
| ------------------------------- | ----------------------- | ----- | ------------------------------------ |
|
|
83
|
+
| `new-message` | `messageCreated` | `app` | `message.channels`, `message.groups` |
|
|
84
|
+
| `new-message-in-channel` | `channelMessageCreated` | `app` | `message.channels`, `message.groups` |
|
|
85
|
+
| `new-direct-message` | `directMessageCreated` | `app` | `message.im` |
|
|
86
|
+
| `new_mention` | `channelMentionCreated` | `app` | `message.channels`, `message.groups` |
|
|
87
|
+
| `new-mention-in-direct-message` | `directMentionCreated` | `app` | `message.im` |
|
|
88
|
+
| `new_reaction_added` | `reactionAdded` | `app` | `reaction_added` |
|
|
89
|
+
| `new_reaction_removed` | `reactionRemoved` | `app` | `reaction_removed` |
|
|
90
|
+
| `channel_created` | `channelCreated` | `app` | `channel_created` |
|
|
91
|
+
| `new_command` | `channelCommandCreated` | `app` | `message.channels`, `message.groups` |
|
|
92
|
+
| `new-command-in-direct-message` | `directCommandCreated` | `app` | `message.im` |
|
|
93
|
+
| `new-user` | `userJoined` | `app` | `team_join` |
|
|
94
|
+
| `new-saved-message` | `messageSaved` | `app` | `star_added` |
|
|
95
|
+
| `new-team-custom-emoji` | `customEmojiAdded` | `app` | `emoji_changed` |
|
|
96
|
+
| `new-modal-interaction` | `modalInteraction` | `app` | Interactivity request URL |
|
|
97
|
+
|
|
98
|
+
## Slack App Setup
|
|
99
|
+
|
|
100
|
+
1. Copy `slack-manifest.yaml`, replace `{{FROGBOT_URL}}` with the public origin and `{{SLACK_INSTANCE_SLUG}}` with the piece instance slug, then create the Slack app from the manifest.
|
|
101
|
+
2. Install the app and set `SLACK_BOT_TOKEN` to its Bot User OAuth Token and `SLACK_SIGNING_SECRET` to the app's signing secret.
|
|
102
|
+
3. Add the piece instance to one agent's `channels`. The Events URL is `{{FROGBOT_URL}}/api/webhooks/{{SLACK_INSTANCE_SLUG}}`; FrogBot verifies requests and answers Slack's URL challenge through the channel adapter.
|
|
103
|
+
4. Reinstall the app after changing scopes or subscriptions, and invite the bot to private channels it must access.
|
|
104
|
+
|
|
105
|
+
The manifest grants `users:read` and `users:read.email`. For each message, FrogBot calls `users.info` with the bot token and matches the returned profile email to the configured FrogBot user collection. No match or no email produces an anonymous channel participant; the agent's `access` function decides whether that participant may run the agent.
|
|
106
|
+
|
|
107
|
+
The existing OAuth setup remains available for actions and app-event triggers. Add corresponding user scopes for actions marked as requiring a user token.
|
|
108
|
+
|
|
109
|
+
## Limitations
|
|
110
|
+
|
|
111
|
+
- The Chat SDK may suppress redelivery after a failed channel-job enqueue, leaving the message unprocessed. Channel ingress is not durable and does not guarantee exactly-once delivery.
|
|
112
|
+
- The four approval/action actions are deliberately omitted because durable waits belong to FrogBot workflows.
|
|
113
|
+
- Slack app webhooks are configured once on the Slack app; individual trigger instances only filter routed deliveries.
|
|
114
|
+
- Message search, profile/status changes, message deletion, and user-group membership updates need an OAuth user token and the applicable user scopes.
|