agent-messenger 1.2.0 → 1.3.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/.claude-plugin/plugin.json +1 -1
- package/README.md +1 -1
- package/dist/package.json +3 -2
- package/dist/src/platforms/slackbot/cli.d.ts +5 -0
- package/dist/src/platforms/slackbot/cli.d.ts.map +1 -0
- package/dist/src/platforms/slackbot/cli.js +19 -0
- package/dist/src/platforms/slackbot/cli.js.map +1 -0
- package/dist/src/platforms/slackbot/client.d.ts +43 -0
- package/dist/src/platforms/slackbot/client.d.ts.map +1 -0
- package/dist/src/platforms/slackbot/client.js +347 -0
- package/dist/src/platforms/slackbot/client.js.map +1 -0
- package/dist/src/platforms/slackbot/commands/auth.d.ts +35 -0
- package/dist/src/platforms/slackbot/commands/auth.d.ts.map +1 -0
- package/dist/src/platforms/slackbot/commands/auth.js +185 -0
- package/dist/src/platforms/slackbot/commands/auth.js.map +1 -0
- package/dist/src/platforms/slackbot/commands/channel.d.ts +3 -0
- package/dist/src/platforms/slackbot/commands/channel.d.ts.map +1 -0
- package/dist/src/platforms/slackbot/commands/channel.js +40 -0
- package/dist/src/platforms/slackbot/commands/channel.js.map +1 -0
- package/dist/src/platforms/slackbot/commands/index.d.ts +6 -0
- package/dist/src/platforms/slackbot/commands/index.d.ts.map +1 -0
- package/dist/src/platforms/slackbot/commands/index.js +6 -0
- package/dist/src/platforms/slackbot/commands/index.js.map +1 -0
- package/dist/src/platforms/slackbot/commands/message.d.ts +3 -0
- package/dist/src/platforms/slackbot/commands/message.d.ts.map +1 -0
- package/dist/src/platforms/slackbot/commands/message.js +135 -0
- package/dist/src/platforms/slackbot/commands/message.js.map +1 -0
- package/dist/src/platforms/slackbot/commands/reaction.d.ts +3 -0
- package/dist/src/platforms/slackbot/commands/reaction.d.ts.map +1 -0
- package/dist/src/platforms/slackbot/commands/reaction.js +43 -0
- package/dist/src/platforms/slackbot/commands/reaction.js.map +1 -0
- package/dist/src/platforms/slackbot/commands/shared.d.ts +9 -0
- package/dist/src/platforms/slackbot/commands/shared.d.ts.map +1 -0
- package/dist/src/platforms/slackbot/commands/shared.js +13 -0
- package/dist/src/platforms/slackbot/commands/shared.js.map +1 -0
- package/dist/src/platforms/slackbot/commands/user.d.ts +3 -0
- package/dist/src/platforms/slackbot/commands/user.d.ts.map +1 -0
- package/dist/src/platforms/slackbot/commands/user.js +40 -0
- package/dist/src/platforms/slackbot/commands/user.js.map +1 -0
- package/dist/src/platforms/slackbot/credential-manager.d.ts +18 -0
- package/dist/src/platforms/slackbot/credential-manager.d.ts.map +1 -0
- package/dist/src/platforms/slackbot/credential-manager.js +187 -0
- package/dist/src/platforms/slackbot/credential-manager.js.map +1 -0
- package/dist/src/platforms/slackbot/index.d.ts +4 -0
- package/dist/src/platforms/slackbot/index.d.ts.map +1 -0
- package/dist/src/platforms/slackbot/index.js +4 -0
- package/dist/src/platforms/slackbot/index.js.map +1 -0
- package/dist/src/platforms/slackbot/types.d.ts +460 -0
- package/dist/src/platforms/slackbot/types.d.ts.map +1 -0
- package/dist/src/platforms/slackbot/types.js +114 -0
- package/dist/src/platforms/slackbot/types.js.map +1 -0
- package/docs/content/docs/integrations/meta.json +1 -1
- package/docs/content/docs/integrations/slackbot.mdx +204 -0
- package/docs/src/app/page.tsx +18 -1
- package/e2e/config.ts +26 -0
- package/e2e/helpers.ts +6 -1
- package/e2e/slackbot.e2e.test.ts +306 -0
- package/package.json +3 -2
- package/skills/agent-slackbot/SKILL.md +285 -0
- package/skills/agent-slackbot/references/authentication.md +253 -0
- package/skills/agent-slackbot/references/common-patterns.md +218 -0
- package/skills/agent-slackbot/templates/monitor-channel.sh +98 -0
- package/skills/agent-slackbot/templates/post-message.sh +107 -0
- package/skills/agent-slackbot/templates/workspace-summary.sh +113 -0
- package/src/platforms/slackbot/cli.ts +30 -0
- package/src/platforms/slackbot/client.test.ts +282 -0
- package/src/platforms/slackbot/client.ts +401 -0
- package/src/platforms/slackbot/commands/auth.test.ts +245 -0
- package/src/platforms/slackbot/commands/auth.ts +240 -0
- package/src/platforms/slackbot/commands/channel.ts +46 -0
- package/src/platforms/slackbot/commands/index.ts +5 -0
- package/src/platforms/slackbot/commands/message.ts +182 -0
- package/src/platforms/slackbot/commands/reaction.ts +59 -0
- package/src/platforms/slackbot/commands/shared.ts +23 -0
- package/src/platforms/slackbot/commands/user.ts +46 -0
- package/src/platforms/slackbot/credential-manager.test.ts +264 -0
- package/src/platforms/slackbot/credential-manager.ts +218 -0
- package/src/platforms/slackbot/index.ts +19 -0
- package/src/platforms/slackbot/types.test.ts +90 -0
- package/src/platforms/slackbot/types.ts +222 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-messenger",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Messaging platform interaction skills for AI agents. Interact with Slack workspaces and Discord servers - send messages, read channels, manage reactions, upload files, and more through simple CLI interfaces.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "devxoul",
|
package/README.md
CHANGED
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-messenger",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Multi-platform messaging CLI for AI agents (Slack, Discord, Teams)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "dist/cli.js",
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
"amsg": "./src/cli.ts",
|
|
11
11
|
"agent-slack": "./src/platforms/slack/cli.ts",
|
|
12
12
|
"agent-discord": "./src/platforms/discord/cli.ts",
|
|
13
|
-
"agent-teams": "./src/platforms/teams/cli.ts"
|
|
13
|
+
"agent-teams": "./src/platforms/teams/cli.ts",
|
|
14
|
+
"agent-slackbot": "./src/platforms/slackbot/cli.ts"
|
|
14
15
|
},
|
|
15
16
|
"scripts": {
|
|
16
17
|
"build": "tsc",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../../../src/platforms/slackbot/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAUnC,QAAA,MAAM,OAAO,SAAgB,CAAA;AAiB7B,eAAe,OAAO,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import pkg from '../../../package.json';
|
|
4
|
+
import { authCommand, channelCommand, messageCommand, reactionCommand, userCommand, } from './commands/index';
|
|
5
|
+
const program = new Command();
|
|
6
|
+
program
|
|
7
|
+
.name('agent-slackbot')
|
|
8
|
+
.description('CLI tool for Slack bot integration using bot tokens (xoxb-)')
|
|
9
|
+
.version(pkg.version)
|
|
10
|
+
.option('--pretty', 'Pretty-print JSON output')
|
|
11
|
+
.option('--bot <id>', 'Use specific bot (default: current)');
|
|
12
|
+
program.addCommand(authCommand);
|
|
13
|
+
program.addCommand(messageCommand);
|
|
14
|
+
program.addCommand(channelCommand);
|
|
15
|
+
program.addCommand(userCommand);
|
|
16
|
+
program.addCommand(reactionCommand);
|
|
17
|
+
program.parse(process.argv);
|
|
18
|
+
export default program;
|
|
19
|
+
//# sourceMappingURL=cli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../../../src/platforms/slackbot/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,GAAG,MAAM,uBAAuB,CAAA;AACvC,OAAO,EACL,WAAW,EACX,cAAc,EACd,cAAc,EACd,eAAe,EACf,WAAW,GACZ,MAAM,kBAAkB,CAAA;AAEzB,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAA;AAE7B,OAAO;KACJ,IAAI,CAAC,gBAAgB,CAAC;KACtB,WAAW,CAAC,6DAA6D,CAAC;KAC1E,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC;KACpB,MAAM,CAAC,UAAU,EAAE,0BAA0B,CAAC;KAC9C,MAAM,CAAC,YAAY,EAAE,qCAAqC,CAAC,CAAA;AAE9D,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAA;AAC/B,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC,CAAA;AAClC,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC,CAAA;AAClC,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAA;AAC/B,OAAO,CAAC,UAAU,CAAC,eAAe,CAAC,CAAA;AAEnC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;AAE3B,eAAe,OAAO,CAAA"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type SlackChannel, type SlackMessage, type SlackUser } from './types';
|
|
2
|
+
export declare class SlackBotClient {
|
|
3
|
+
private client;
|
|
4
|
+
constructor(token: string);
|
|
5
|
+
private withRetry;
|
|
6
|
+
private sleep;
|
|
7
|
+
private checkResponse;
|
|
8
|
+
testAuth(): Promise<{
|
|
9
|
+
user_id: string;
|
|
10
|
+
team_id: string;
|
|
11
|
+
bot_id?: string;
|
|
12
|
+
user?: string;
|
|
13
|
+
team?: string;
|
|
14
|
+
}>;
|
|
15
|
+
postMessage(channel: string, text: string, options?: {
|
|
16
|
+
thread_ts?: string;
|
|
17
|
+
}): Promise<SlackMessage>;
|
|
18
|
+
getConversationHistory(channel: string, options?: {
|
|
19
|
+
limit?: number;
|
|
20
|
+
cursor?: string;
|
|
21
|
+
}): Promise<SlackMessage[]>;
|
|
22
|
+
getMessage(channel: string, ts: string): Promise<SlackMessage | null>;
|
|
23
|
+
addReaction(channel: string, timestamp: string, emoji: string): Promise<void>;
|
|
24
|
+
removeReaction(channel: string, timestamp: string, emoji: string): Promise<void>;
|
|
25
|
+
listChannels(options?: {
|
|
26
|
+
limit?: number;
|
|
27
|
+
cursor?: string;
|
|
28
|
+
}): Promise<SlackChannel[]>;
|
|
29
|
+
getChannelInfo(channel: string): Promise<SlackChannel>;
|
|
30
|
+
listUsers(options?: {
|
|
31
|
+
limit?: number;
|
|
32
|
+
cursor?: string;
|
|
33
|
+
}): Promise<SlackUser[]>;
|
|
34
|
+
getUserInfo(userId: string): Promise<SlackUser>;
|
|
35
|
+
updateMessage(channel: string, ts: string, text: string): Promise<SlackMessage>;
|
|
36
|
+
getThreadReplies(channel: string, ts: string, options?: {
|
|
37
|
+
limit?: number;
|
|
38
|
+
cursor?: string;
|
|
39
|
+
}): Promise<SlackMessage[]>;
|
|
40
|
+
joinChannel(channel: string): Promise<void>;
|
|
41
|
+
deleteMessage(channel: string, ts: string): Promise<void>;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/platforms/slackbot/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,KAAK,SAAS,EAAE,MAAM,SAAS,CAAA;AAK7F,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAAW;gBAEb,KAAK,EAAE,MAAM;YAWX,SAAS;IAqBvB,OAAO,CAAC,KAAK;IAIb,OAAO,CAAC,aAAa;IAMf,QAAQ,IAAI,OAAO,CAAC;QACxB,OAAO,EAAE,MAAM,CAAA;QACf,OAAO,EAAE,MAAM,CAAA;QACf,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,IAAI,CAAC,EAAE,MAAM,CAAA;KACd,CAAC;IAcI,WAAW,CACf,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAC/B,OAAO,CAAC,YAAY,CAA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A;KAAE,GAC5C,OAAO,CAAC,YAAY,EAAE,CAAC;IA4BpB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAO3C,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAMhE"}
|
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
import { WebClient } from '@slack/web-api';
|
|
2
|
+
import { SlackBotError } from './types';
|
|
3
|
+
const MAX_RETRIES = 3;
|
|
4
|
+
const RATE_LIMIT_ERROR_CODE = 'slack_webapi_rate_limited_error';
|
|
5
|
+
export class SlackBotClient {
|
|
6
|
+
client;
|
|
7
|
+
constructor(token) {
|
|
8
|
+
if (!token) {
|
|
9
|
+
throw new SlackBotError('Token is required', 'missing_token');
|
|
10
|
+
}
|
|
11
|
+
if (!token.startsWith('xoxb-')) {
|
|
12
|
+
throw new SlackBotError('Token must be a bot token (xoxb-)', 'invalid_token_type');
|
|
13
|
+
}
|
|
14
|
+
this.client = new WebClient(token);
|
|
15
|
+
}
|
|
16
|
+
async withRetry(operation) {
|
|
17
|
+
let lastError;
|
|
18
|
+
for (let attempt = 0; attempt <= MAX_RETRIES; attempt++) {
|
|
19
|
+
try {
|
|
20
|
+
return await operation();
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
lastError = error;
|
|
24
|
+
if (error.code === RATE_LIMIT_ERROR_CODE && attempt < MAX_RETRIES) {
|
|
25
|
+
const retryAfter = error.retryAfter || 1;
|
|
26
|
+
await this.sleep(retryAfter * 1000 * (attempt + 1));
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
break;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
throw new SlackBotError(lastError?.message || 'Unknown error', lastError?.code || 'unknown_error');
|
|
33
|
+
}
|
|
34
|
+
sleep(ms) {
|
|
35
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
36
|
+
}
|
|
37
|
+
checkResponse(response) {
|
|
38
|
+
if (!response.ok) {
|
|
39
|
+
throw new SlackBotError(response.error || 'API call failed', response.error || 'api_error');
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
async testAuth() {
|
|
43
|
+
return this.withRetry(async () => {
|
|
44
|
+
const response = await this.client.auth.test();
|
|
45
|
+
this.checkResponse(response);
|
|
46
|
+
return {
|
|
47
|
+
user_id: response.user_id,
|
|
48
|
+
team_id: response.team_id,
|
|
49
|
+
bot_id: response.bot_id,
|
|
50
|
+
user: response.user,
|
|
51
|
+
team: response.team,
|
|
52
|
+
};
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
async postMessage(channel, text, options) {
|
|
56
|
+
return this.withRetry(async () => {
|
|
57
|
+
const response = await this.client.chat.postMessage({
|
|
58
|
+
channel,
|
|
59
|
+
text,
|
|
60
|
+
thread_ts: options?.thread_ts,
|
|
61
|
+
});
|
|
62
|
+
this.checkResponse(response);
|
|
63
|
+
const msg = response.message;
|
|
64
|
+
return {
|
|
65
|
+
ts: response.ts,
|
|
66
|
+
text: msg.text || text,
|
|
67
|
+
type: msg.type || 'message',
|
|
68
|
+
user: msg.user,
|
|
69
|
+
thread_ts: msg.thread_ts,
|
|
70
|
+
};
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
async getConversationHistory(channel, options) {
|
|
74
|
+
return this.withRetry(async () => {
|
|
75
|
+
const response = await this.client.conversations.history({
|
|
76
|
+
channel,
|
|
77
|
+
limit: options?.limit || 20,
|
|
78
|
+
cursor: options?.cursor,
|
|
79
|
+
});
|
|
80
|
+
this.checkResponse(response);
|
|
81
|
+
return (response.messages || []).map((msg) => ({
|
|
82
|
+
ts: msg.ts,
|
|
83
|
+
text: msg.text || '',
|
|
84
|
+
type: msg.type || 'message',
|
|
85
|
+
user: msg.user,
|
|
86
|
+
username: msg.username,
|
|
87
|
+
thread_ts: msg.thread_ts,
|
|
88
|
+
reply_count: msg.reply_count,
|
|
89
|
+
replies: msg.replies,
|
|
90
|
+
edited: msg.edited
|
|
91
|
+
? {
|
|
92
|
+
user: msg.edited.user || '',
|
|
93
|
+
ts: msg.edited.ts || '',
|
|
94
|
+
}
|
|
95
|
+
: undefined,
|
|
96
|
+
}));
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
async getMessage(channel, ts) {
|
|
100
|
+
return this.withRetry(async () => {
|
|
101
|
+
const response = await this.client.conversations.history({
|
|
102
|
+
channel,
|
|
103
|
+
oldest: ts,
|
|
104
|
+
inclusive: true,
|
|
105
|
+
limit: 1,
|
|
106
|
+
});
|
|
107
|
+
this.checkResponse(response);
|
|
108
|
+
const msg = response.messages?.[0];
|
|
109
|
+
if (!msg || msg.ts !== ts) {
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
return {
|
|
113
|
+
ts: msg.ts,
|
|
114
|
+
text: msg.text || '',
|
|
115
|
+
type: msg.type || 'message',
|
|
116
|
+
user: msg.user,
|
|
117
|
+
username: msg.username,
|
|
118
|
+
thread_ts: msg.thread_ts,
|
|
119
|
+
reply_count: msg.reply_count,
|
|
120
|
+
replies: msg.replies,
|
|
121
|
+
edited: msg.edited
|
|
122
|
+
? {
|
|
123
|
+
user: msg.edited.user || '',
|
|
124
|
+
ts: msg.edited.ts || '',
|
|
125
|
+
}
|
|
126
|
+
: undefined,
|
|
127
|
+
};
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
async addReaction(channel, timestamp, emoji) {
|
|
131
|
+
// Normalize emoji (remove colons if present)
|
|
132
|
+
const normalizedEmoji = emoji.replace(/^:|:$/g, '');
|
|
133
|
+
return this.withRetry(async () => {
|
|
134
|
+
const response = await this.client.reactions.add({
|
|
135
|
+
channel,
|
|
136
|
+
timestamp,
|
|
137
|
+
name: normalizedEmoji,
|
|
138
|
+
});
|
|
139
|
+
this.checkResponse(response);
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
async removeReaction(channel, timestamp, emoji) {
|
|
143
|
+
// Normalize emoji (remove colons if present)
|
|
144
|
+
const normalizedEmoji = emoji.replace(/^:|:$/g, '');
|
|
145
|
+
return this.withRetry(async () => {
|
|
146
|
+
const response = await this.client.reactions.remove({
|
|
147
|
+
channel,
|
|
148
|
+
timestamp,
|
|
149
|
+
name: normalizedEmoji,
|
|
150
|
+
});
|
|
151
|
+
this.checkResponse(response);
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
async listChannels(options) {
|
|
155
|
+
const channels = [];
|
|
156
|
+
let cursor = options?.cursor;
|
|
157
|
+
do {
|
|
158
|
+
// Only wrap individual API call in withRetry, not the entire loop
|
|
159
|
+
const response = await this.withRetry(async () => {
|
|
160
|
+
const res = await this.client.conversations.list({
|
|
161
|
+
cursor,
|
|
162
|
+
limit: options?.limit || 200,
|
|
163
|
+
types: 'public_channel,private_channel',
|
|
164
|
+
});
|
|
165
|
+
this.checkResponse(res);
|
|
166
|
+
return res;
|
|
167
|
+
});
|
|
168
|
+
if (response.channels) {
|
|
169
|
+
for (const ch of response.channels) {
|
|
170
|
+
channels.push({
|
|
171
|
+
id: ch.id,
|
|
172
|
+
name: ch.name,
|
|
173
|
+
is_private: ch.is_private || false,
|
|
174
|
+
is_archived: ch.is_archived || false,
|
|
175
|
+
created: ch.created || 0,
|
|
176
|
+
creator: ch.creator || '',
|
|
177
|
+
topic: ch.topic
|
|
178
|
+
? {
|
|
179
|
+
value: ch.topic.value || '',
|
|
180
|
+
creator: ch.topic.creator || '',
|
|
181
|
+
last_set: ch.topic.last_set || 0,
|
|
182
|
+
}
|
|
183
|
+
: undefined,
|
|
184
|
+
purpose: ch.purpose
|
|
185
|
+
? {
|
|
186
|
+
value: ch.purpose.value || '',
|
|
187
|
+
creator: ch.purpose.creator || '',
|
|
188
|
+
last_set: ch.purpose.last_set || 0,
|
|
189
|
+
}
|
|
190
|
+
: undefined,
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
cursor = response.response_metadata?.next_cursor;
|
|
195
|
+
// Only paginate if no specific limit was requested
|
|
196
|
+
if (options?.limit)
|
|
197
|
+
break;
|
|
198
|
+
} while (cursor);
|
|
199
|
+
return channels;
|
|
200
|
+
}
|
|
201
|
+
async getChannelInfo(channel) {
|
|
202
|
+
return this.withRetry(async () => {
|
|
203
|
+
const response = await this.client.conversations.info({ channel });
|
|
204
|
+
this.checkResponse(response);
|
|
205
|
+
const ch = response.channel;
|
|
206
|
+
return {
|
|
207
|
+
id: ch.id,
|
|
208
|
+
name: ch.name,
|
|
209
|
+
is_private: ch.is_private || false,
|
|
210
|
+
is_archived: ch.is_archived || false,
|
|
211
|
+
created: ch.created || 0,
|
|
212
|
+
creator: ch.creator || '',
|
|
213
|
+
topic: ch.topic
|
|
214
|
+
? {
|
|
215
|
+
value: ch.topic.value || '',
|
|
216
|
+
creator: ch.topic.creator || '',
|
|
217
|
+
last_set: ch.topic.last_set || 0,
|
|
218
|
+
}
|
|
219
|
+
: undefined,
|
|
220
|
+
purpose: ch.purpose
|
|
221
|
+
? {
|
|
222
|
+
value: ch.purpose.value || '',
|
|
223
|
+
creator: ch.purpose.creator || '',
|
|
224
|
+
last_set: ch.purpose.last_set || 0,
|
|
225
|
+
}
|
|
226
|
+
: undefined,
|
|
227
|
+
};
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
async listUsers(options) {
|
|
231
|
+
const users = [];
|
|
232
|
+
let cursor = options?.cursor;
|
|
233
|
+
do {
|
|
234
|
+
// Only wrap individual API call in withRetry, not the entire loop
|
|
235
|
+
const response = await this.withRetry(async () => {
|
|
236
|
+
const res = await this.client.users.list({
|
|
237
|
+
cursor,
|
|
238
|
+
limit: options?.limit || 200,
|
|
239
|
+
});
|
|
240
|
+
this.checkResponse(res);
|
|
241
|
+
return res;
|
|
242
|
+
});
|
|
243
|
+
if (response.members) {
|
|
244
|
+
for (const member of response.members) {
|
|
245
|
+
users.push({
|
|
246
|
+
id: member.id,
|
|
247
|
+
name: member.name,
|
|
248
|
+
real_name: member.real_name || member.name || '',
|
|
249
|
+
is_admin: member.is_admin || false,
|
|
250
|
+
is_owner: member.is_owner || false,
|
|
251
|
+
is_bot: member.is_bot || false,
|
|
252
|
+
is_app_user: member.is_app_user || false,
|
|
253
|
+
profile: member.profile
|
|
254
|
+
? {
|
|
255
|
+
email: member.profile.email,
|
|
256
|
+
phone: member.profile.phone,
|
|
257
|
+
title: member.profile.title,
|
|
258
|
+
status_text: member.profile.status_text,
|
|
259
|
+
}
|
|
260
|
+
: undefined,
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
cursor = response.response_metadata?.next_cursor;
|
|
265
|
+
// Only paginate if no specific limit was requested
|
|
266
|
+
if (options?.limit)
|
|
267
|
+
break;
|
|
268
|
+
} while (cursor);
|
|
269
|
+
return users;
|
|
270
|
+
}
|
|
271
|
+
async getUserInfo(userId) {
|
|
272
|
+
return this.withRetry(async () => {
|
|
273
|
+
const response = await this.client.users.info({ user: userId });
|
|
274
|
+
this.checkResponse(response);
|
|
275
|
+
const member = response.user;
|
|
276
|
+
return {
|
|
277
|
+
id: member.id,
|
|
278
|
+
name: member.name,
|
|
279
|
+
real_name: member.real_name || member.name || '',
|
|
280
|
+
is_admin: member.is_admin || false,
|
|
281
|
+
is_owner: member.is_owner || false,
|
|
282
|
+
is_bot: member.is_bot || false,
|
|
283
|
+
is_app_user: member.is_app_user || false,
|
|
284
|
+
profile: member.profile
|
|
285
|
+
? {
|
|
286
|
+
email: member.profile.email,
|
|
287
|
+
phone: member.profile.phone,
|
|
288
|
+
title: member.profile.title,
|
|
289
|
+
status_text: member.profile.status_text,
|
|
290
|
+
}
|
|
291
|
+
: undefined,
|
|
292
|
+
};
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
async updateMessage(channel, ts, text) {
|
|
296
|
+
return this.withRetry(async () => {
|
|
297
|
+
const response = await this.client.chat.update({ channel, ts, text });
|
|
298
|
+
this.checkResponse(response);
|
|
299
|
+
const msg = response.message;
|
|
300
|
+
return {
|
|
301
|
+
ts: response.ts,
|
|
302
|
+
text: msg?.text || response.text || text,
|
|
303
|
+
type: msg?.type || 'message',
|
|
304
|
+
user: msg?.user,
|
|
305
|
+
};
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
async getThreadReplies(channel, ts, options) {
|
|
309
|
+
return this.withRetry(async () => {
|
|
310
|
+
const response = await this.client.conversations.replies({
|
|
311
|
+
channel,
|
|
312
|
+
ts,
|
|
313
|
+
limit: options?.limit || 100,
|
|
314
|
+
cursor: options?.cursor,
|
|
315
|
+
});
|
|
316
|
+
this.checkResponse(response);
|
|
317
|
+
return (response.messages || []).map((msg) => ({
|
|
318
|
+
ts: msg.ts,
|
|
319
|
+
text: msg.text || '',
|
|
320
|
+
type: msg.type || 'message',
|
|
321
|
+
user: msg.user,
|
|
322
|
+
username: msg.username,
|
|
323
|
+
thread_ts: msg.thread_ts,
|
|
324
|
+
reply_count: msg.reply_count,
|
|
325
|
+
edited: msg.edited
|
|
326
|
+
? {
|
|
327
|
+
user: msg.edited.user || '',
|
|
328
|
+
ts: msg.edited.ts || '',
|
|
329
|
+
}
|
|
330
|
+
: undefined,
|
|
331
|
+
}));
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
async joinChannel(channel) {
|
|
335
|
+
return this.withRetry(async () => {
|
|
336
|
+
const response = await this.client.conversations.join({ channel });
|
|
337
|
+
this.checkResponse(response);
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
async deleteMessage(channel, ts) {
|
|
341
|
+
return this.withRetry(async () => {
|
|
342
|
+
const response = await this.client.chat.delete({ channel, ts });
|
|
343
|
+
this.checkResponse(response);
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../src/platforms/slackbot/client.ts"],"names":[],"mappings":"AAAA,O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+
interface ActionOptions {
|
|
4
|
+
pretty?: boolean;
|
|
5
|
+
bot?: string;
|
|
6
|
+
name?: string;
|
|
7
|
+
_credManager?: SlackBotCredentialManager;
|
|
8
|
+
}
|
|
9
|
+
interface ActionResult {
|
|
10
|
+
success?: boolean;
|
|
11
|
+
error?: string;
|
|
12
|
+
workspace_id?: string;
|
|
13
|
+
workspace_name?: string;
|
|
14
|
+
bot_id?: string;
|
|
15
|
+
bot_name?: string;
|
|
16
|
+
user?: string;
|
|
17
|
+
team?: string;
|
|
18
|
+
valid?: boolean;
|
|
19
|
+
bots?: Array<{
|
|
20
|
+
workspace_id: string;
|
|
21
|
+
workspace_name: string;
|
|
22
|
+
bot_id: string;
|
|
23
|
+
bot_name: string;
|
|
24
|
+
is_current: boolean;
|
|
25
|
+
}>;
|
|
26
|
+
}
|
|
27
|
+
export declare function setAction(token: string, options: ActionOptions): Promise<ActionResult>;
|
|
28
|
+
export declare function clearAction(options: ActionOptions): Promise<ActionResult>;
|
|
29
|
+
export declare function statusAction(options: ActionOptions): Promise<ActionResult>;
|
|
30
|
+
export declare function listAction(options: ActionOptions): Promise<ActionResult>;
|
|
31
|
+
export declare function useAction(botId: string, options: ActionOptions): Promise<ActionResult>;
|
|
32
|
+
export declare function removeAction(botId: string, options: ActionOptions): Promise<ActionResult>;
|
|
33
|
+
export declare const authCommand: Command;
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../../../src/platforms/slackbot/commands/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAGnC,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAA;AAEjE,UAAU,aAAa;IACrB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,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