Slack Incoming Webhook sends as my user

Deadly 提交于 2019-11-28 09:17:26

问题


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

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.

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

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.


回答1:


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

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.

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.

Example:

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


来源:https://stackoverflow.com/questions/51878825/slack-incoming-webhook-sends-as-my-user

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!