@pipedream/slack_v2 1.1.0 → 1.1.1
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.
|
@@ -11,7 +11,7 @@ export default {
|
|
|
11
11
|
+ " Requires the message timestamp (`ts`) from **Get Channel History** or **Post Message**."
|
|
12
12
|
+ " You can only edit messages posted by the same token/user."
|
|
13
13
|
+ " [See the documentation](https://api.slack.com/methods/chat.update)",
|
|
14
|
-
version: "0.0.
|
|
14
|
+
version: "0.0.6",
|
|
15
15
|
type: "action",
|
|
16
16
|
annotations: {
|
|
17
17
|
destructiveHint: false,
|
|
@@ -57,25 +57,7 @@ export default {
|
|
|
57
57
|
throw new ConfigurationError("Invalid JSON string: " + error.message);
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
|
|
61
|
-
// post-message tries the bot identity first, falling back to the user identity when
|
|
62
|
-
// the bot can't deliver — so the message being edited may have been posted as
|
|
63
|
-
// either one. Try both here too, mirroring the fallback already used in
|
|
64
|
-
// delete-message, rather than guessing which identity posted it.
|
|
65
|
-
const attempt = (asUser) => this.slack.updateMessage({
|
|
66
|
-
...args,
|
|
67
|
-
as_user: asUser,
|
|
68
|
-
});
|
|
69
|
-
const hasBotToken = Boolean(this.slack.getBotToken());
|
|
70
|
-
|
|
71
|
-
let response;
|
|
72
|
-
try {
|
|
73
|
-
response = await attempt(false);
|
|
74
|
-
} catch (error) {
|
|
75
|
-
if (!hasBotToken || !`${error}`.includes("cant_update_message")) throw error;
|
|
76
|
-
response = await attempt(true);
|
|
77
|
-
}
|
|
78
|
-
|
|
60
|
+
const response = await this.slack.updateMessage(args);
|
|
79
61
|
$.export("$summary", `Message updated in ${channelId}`);
|
|
80
62
|
return response;
|
|
81
63
|
},
|
|
@@ -12,7 +12,7 @@ export default {
|
|
|
12
12
|
+ " To reply to a thread, provide `threadTs` (Slack calls this `thread_ts`) from **Get Channel History**."
|
|
13
13
|
+ " Supports plain text with Slack mrkdwn formatting and Block Kit blocks."
|
|
14
14
|
+ " [See the documentation](https://api.slack.com/methods/chat.postMessage)",
|
|
15
|
-
version: "0.0.
|
|
15
|
+
version: "0.0.6",
|
|
16
16
|
type: "action",
|
|
17
17
|
annotations: {
|
|
18
18
|
destructiveHint: false,
|
|
@@ -93,32 +93,7 @@ export default {
|
|
|
93
93
|
args.thread_ts = this.threadTs;
|
|
94
94
|
args.reply_broadcast = this.replyBroadcast;
|
|
95
95
|
}
|
|
96
|
-
|
|
97
|
-
// Prefer the bot token (as_user: false) — it works for channels the bot has joined
|
|
98
|
-
// and needs no extra scope. But a bot can't message a user unless that user has
|
|
99
|
-
// enabled its Messages tab, and can't post in a channel it hasn't joined, so those
|
|
100
|
-
// specific failures fall back to the authenticated user's token instead of failing
|
|
101
|
-
// the whole call. Mirrors the identity fallback already used in delete-message.
|
|
102
|
-
const hasBotToken = Boolean(this.slack.getBotToken());
|
|
103
|
-
let response;
|
|
104
|
-
try {
|
|
105
|
-
response = await this.slack.postChatMessage({
|
|
106
|
-
...args,
|
|
107
|
-
as_user: false,
|
|
108
|
-
});
|
|
109
|
-
} catch (error) {
|
|
110
|
-
const botCannotDeliver = hasBotToken
|
|
111
|
-
&& [
|
|
112
|
-
"messages_tab_disabled",
|
|
113
|
-
"channel_not_found",
|
|
114
|
-
"not_in_channel",
|
|
115
|
-
].some((code) => `${error}`.includes(code));
|
|
116
|
-
if (!botCannotDeliver) throw error;
|
|
117
|
-
response = await this.slack.postChatMessage({
|
|
118
|
-
...args,
|
|
119
|
-
as_user: true,
|
|
120
|
-
});
|
|
121
|
-
}
|
|
96
|
+
const response = await this.slack.postChatMessage(args);
|
|
122
97
|
let permalink;
|
|
123
98
|
try {
|
|
124
99
|
const permalinkResponse = await this.slack.makeRequest({
|