Slack聊天工具默认发送电子邮件通知,说“你被提到了…”,而实际上是@channel,不是你。我找到的唯一关闭它们的方法是进入每个频道设置。
Slack聊天工具默认发送电子邮件通知,说“你被提到了…”,而实际上是@channel,不是你。我找到的唯一关闭它们的方法是进入每个频道设置。
我一直有这个问题,手动调整偏好设置需要花费太多时间。我写了一个脚本来自动化这个过程。
如需更详细的解释,请访问我的博客文章:
https://mobeigi.com/blog/programming/disable-slack-channel-and-here-notification-for-all-channels/
否则,以下是完整的解决方案。
首先下载此脚本:
https://gist.github.com/mobeigi/8e5372f1e14e2a302e186d1753f9a649
或从这里复制并粘贴:
// Slack User Notification Preference Bulk Update
// By Mo Beigi
const slackTeamId = "EXAMPLE17";
const localConfigJson = JSON.parse(localStorage.localConfig_v2);
const slackUrl = localConfigJson.teams[slackTeamId].url;
let channel_ids = [];
// client.boot contains list of channel ids user is subscribed to amongst other things
await fetch(slackUrl + "api/client.boot?" +
"_x_id=noversion-1598950616.732" +
"&_x_version_ts=noversion" +
"&_x_gantry=true",
{
method: 'post',
credentials: 'include',
headers: { "Content-type": "application/x-www-form-urlencoded; charset=UTF-8" },
body: "token=" + localConfigJson.teams[slackTeamId].token +
"&only_self_subteams=1" +
"&flannel_api_ver=4" +
"&include_min_version_bump_check=1" +
"&version_ts=1598934919" +
"&_x_reason=deferred-data" +
"&_x_sonic=true",
},
)
.then(result => result.json())
.then(result => channel_ids = result.channels);
// iterate channel id list and set notification prefs asynchronously
let fetchPromises = [];
for (i = 0; i < channel_ids.length; ++i) {
console.log("Setting user notification prefs for channel id: " + channel_ids[i].id + " ...");
fetchPromises.push(
fetch(slackUrl + "api/users.prefs.setNotifications?" +
"_x_id=c189c956-1598949859.880" +
"&_x_csid=7dP2GCgBJsY" +
"&slack_route=" + localConfigJson.teams[slackTeamId].enterprise_id + ":" + slackTeamId +
"&_x_version_ts=1598934919" +
"&_x_gantry=true",
{
method: 'post',
credentials: 'include',
headers: { "Content-type": "application/x-www-form-urlencoded; charset=UTF-8" },
body: "name=suppress_at_channel" +
"&value=true" +
"&channel_id=" + channel_ids[i].id +
"&global=false" +
"&sync=false" +
"&token=" + localConfigJson.teams[slackTeamId].token +
"&_x_reason=prefs-store/setChannelNotificationOverride" +
"&_x_mode=online" +
"&_x_sonic=true"
}
)
.then(result => result.json())
.then(console.log("Done (" + channel_ids[i].id + ")"))
);
// Generous delay to get around rate limit
await new Promise(r => setTimeout(r, 250));
}
Promise.all(fetchPromises).then(function() {
console.log("Successfully set user notification prefs for " + channel_ids.length + " channels.");
});
JSON.parse(localStorage.localConfig_v2).teams
slackTeamId
替换为Step 4中的您的ID。现在,您应该已经关闭了每个频道的@channel和@here通知偏好设置。
"&include_min_version_bump_check=1" + "&version_ts=1598934919" +
这些行,因为它已经过时了。 - joshwa