Slack 传入 Webhook 作为我的用户发送 [英] Slack Incoming Webhook sends as my user

查看:39
本文介绍了Slack 传入 Webhook 作为我的用户发送的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Slack 工作区中创建了一个传入 Webhook.我正在使用第三方工具将 JSON 对象发布到钩子 url.我想向@user_1 发送通知

I've created an Incoming Webhook within my Slack workspace. I'm using it from a third party tool to post a JSON object to the hook url. I want to send a notification to @user_1

我的问题是通知发送到我和那个用户@user_1 之间的私人频道,而不是直接发送到@user_1,比如通过 Slackbot 或只有该用户的频道.

My issue is that the notification sends to a private channel between myself and that user @user_1, rather than sending to @user_1 directly, say via Slackbot or a channel with only that user in.

如何确保通知是从 Slackbot 或 @user_1 发送的,而不是我自己发送的?

How do I ensure that the notification is sent from either Slackbot or @user_1, rather than myself?

我的设置方式是创建一个带有传入 Webhook 的新应用程序.对于频道,我选择@user_1,并使用第三方提供的url发送slack通知.

The way that I set up is by creating a New App with an Incoming Webhook. For the channel, I select @user_1, and use the provided url by the third party to send the slack notification.

推荐答案

当通过 Slack 应用设置 webhook 时,这似乎是标准行为.

This seams to be standard behavior when setting up a webhook through a Slack app.

但是还有一种替代方法:您还可以将传入的 webhook 设置为自定义集成.然后您就可以向用户的 slackbot 频道发送消息.

But there is an alternative approach: You can also set up incoming webhooks as custom integration. Then you are then able to send messages to the slackbot channel of a user.

要将网络钩子设置为自定义集成,请转到 Slack 应用程序目录并添加应用程序传入网络钩子".然后创建一个新的网络钩子.您可以在初始配置中直接使用目标用户的 ID 作为频道,也可以通过在消息中包含频道属性来使用频道覆盖功能.

To setup a webhook as a custom integration go to Slack App Directory and add the app "Incoming Webhook". Then create a new webhook. You can either directly use the ID of the destination user as channel in the initial configuration, or use the channel override feature by including a channel property in the message.

示例:

{ 
   "text": "This is a line of text in a channel.",
   "channel": "U12345678"
}

这篇关于Slack 传入 Webhook 作为我的用户发送的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆