@pipedream/slack 0.10.3 → 0.11.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.
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import slack from "../../slack.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "slack-list-messages",
|
|
5
|
+
name: "List Messages",
|
|
6
|
+
description:
|
|
7
|
+
"Retrieve messages from a Slack conversation, including reactions. [See the documentation](https://api.slack.com/methods/conversations.history)",
|
|
8
|
+
version: "0.0.1",
|
|
9
|
+
annotations: {
|
|
10
|
+
destructiveHint: false,
|
|
11
|
+
openWorldHint: true,
|
|
12
|
+
readOnlyHint: true,
|
|
13
|
+
},
|
|
14
|
+
type: "action",
|
|
15
|
+
props: {
|
|
16
|
+
slack,
|
|
17
|
+
conversation: {
|
|
18
|
+
propDefinition: [
|
|
19
|
+
slack,
|
|
20
|
+
"conversation",
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
pageSize: {
|
|
24
|
+
propDefinition: [
|
|
25
|
+
slack,
|
|
26
|
+
"pageSize",
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
numPages: {
|
|
30
|
+
propDefinition: [
|
|
31
|
+
slack,
|
|
32
|
+
"numPages",
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
async run({ $ }) {
|
|
37
|
+
const messages = [];
|
|
38
|
+
const params = {
|
|
39
|
+
channel: this.conversation,
|
|
40
|
+
limit: this.pageSize,
|
|
41
|
+
};
|
|
42
|
+
let page = 0;
|
|
43
|
+
|
|
44
|
+
do {
|
|
45
|
+
const response = await this.slack.conversationsHistory(params);
|
|
46
|
+
const messagesPage = response.messages || [];
|
|
47
|
+
const nextCursor = response.response_metadata?.next_cursor;
|
|
48
|
+
messages.push(...messagesPage);
|
|
49
|
+
params.cursor = nextCursor;
|
|
50
|
+
page++;
|
|
51
|
+
} while (params.cursor && page < this.numPages);
|
|
52
|
+
|
|
53
|
+
$.export(
|
|
54
|
+
"$summary",
|
|
55
|
+
`Successfully retrieved ${messages.length} message${
|
|
56
|
+
messages.length === 1
|
|
57
|
+
? ""
|
|
58
|
+
: "s"
|
|
59
|
+
}`,
|
|
60
|
+
);
|
|
61
|
+
return {
|
|
62
|
+
messages,
|
|
63
|
+
};
|
|
64
|
+
},
|
|
65
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pipedream/slack",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "Pipedream Slack Components",
|
|
5
5
|
"main": "slack.app.mjs",
|
|
6
6
|
"keywords": [
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
"access": "public"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@pipedream/platform": "^3.1.
|
|
17
|
+
"@pipedream/platform": "^3.1.1",
|
|
18
18
|
"@slack/web-api": "^7.9.0",
|
|
19
19
|
"async-retry": "^1.3.3",
|
|
20
|
-
"lodash": "^4.17.
|
|
20
|
+
"lodash": "^4.17.23"
|
|
21
21
|
}
|
|
22
22
|
}
|