Set icon_url and username when calling Slack's chat.postMessage API
What does this MR do and why?
Describe in detail what your merge request does and why.
The as_user: true
parameter seems to be ignored when
reply_broadcast
is set to true
, resulting in messages that have no icon and username as bot
.
With reply_broadcast: true
|
Without reply_broadcast
|
With icon_url and username set |
---|---|---|
So instead, in this MR, we set as_user: false
and explicitly set the username
and icon_url
parameters to be the
bot's username and icon. as_user
needs to be set to false
because otherwise the username
and icon_url
parameters are ignored.
You can see examples of what the message looks like with as_user: false, username: 'GitLab Chatops', icon_url: 'https://avatars.slack-edge.com/2018-05-01/355645466080_4202bbc846089f270a4e_512.png'
here: https://gitlab.slack.com/archives/C02U04A8VU4/p1649330479422739?thread_ts=1649046183.030769&cid=C02U04A8VU4.
Reference: https://api.slack.com/methods/chat.postMessage#authorship
gitlab-com/gl-infra/delivery#2225 (closed)
Author Check-list
- [-] Has documentation been updated?