Slack Incoming Webhook sends as my user

后端 未结 2 2050
無奈伤痛
無奈伤痛 2020-12-21 04:39

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

2条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-21 05:07

    For webhook-based direct messages, prefix the Slack user's ID with an '@' in the payload:

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

    Note that such messages will appear to have been posted by Slackbot. Also note that you can actually use any active webhook for direct messaging regardless of the channel that the webhook was defined for.

提交回复
热议问题