Slack:有没有办法禁用所有@channel通知

时间:2015-09-04 15:05:00

标签: notifications channel slack

Slack聊天工具默认发送电子邮件通知,说“你被提及......”实际上它是 @channel ,而不是你。我可以找到关闭它们的唯一方法是进入每个频道设置。

4 个答案:

答案 0 :(得分:1)

我一直在寻找同样的东西而且我看到没有人回答,所以这就是我发现的:你不能而你却永远无法做到。

@channel :频道中的每个人,与用户签订的合同,频道内的所有人都应收到通知。

关键是Slack有网络礼仪,用户必须知道它。 @channel关键字的替代方案是 @everyone @here ,第一个仅在" big"渠道,第二个仅适用于目前活跃的人群。您可以停用这些关键字的通知。

https://get.slack.help/hc/en-us/articles/202009646-Make-an-announcement

enter image description here

答案 1 :(得分:1)

您可以使用此: 您可以选择“通知”>“通知首选项”>“无”。

当用户选择Nothing时,表示用户禁用了所有通知。

enter image description here

答案 2 :(得分:1)

一段时间以来,我遇到了同样的问题,手动调整首选项非常耗时。 我已经写了一个脚本来为我自动化。

有关更深入的说明,请访问我的博客文章:
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.");
});

步骤

  1. 访问React Web应用程序,该应用程序可通过以下网址为React本机Slack客户端提供支持: http://app.slack.com/client
  2. 登录并切换到感兴趣的工作区,然后等待页面完全加载。
  3. 打开浏览器开发者控制台
  4. 执行以下行:JSON.parse(localStorage.localConfig_v2).teams
  5. 用步骤4中的ID替换Javascript脚本中的slackTeamId
  6. 将已编辑的Javascript脚本复制并粘贴到开发人员控制台中并执行它。 该脚本可能需要几分钟才能运行,具体取决于您加入的频道数量。

就是这样!

您现在应该在 @channel @here 通知偏好设置中关闭所有频道。

slack_user_noti_pref_bulk_update.js script execution

答案 3 :(得分:0)

如果找不到取消选中“还包括@channel和@here”的选项,则可能首先需要取消静音该频道,然后在特定于频道的选项中,您可以取消选中“也包括@channel和@here”。

我不确定通道静音时复选框是否会生效,但是设置会通过静音和取消静音来保留。