slack-go/slack

unfurl_links does not work again

gringus opened this issue · 0 comments

What happened

When creating message parameters and setting UnfurlMedia to false attribute is actually not set as it's equal to the default value. According to Slack documentation:

By default, we unfurl all links in any messages posted by users and Slack apps. This applies to messages posted via incoming webhooks, chat.postMessage and chat.postEphemeral.

Expected behaviour

No user profile should be attached to a posted message.

Steps to reproduce

  1. Create a new Slack channel
  2. Post a message (PostMessage) with a link to a user profile (eg. <https://example.slack.com/team/XXXXXXXXXX|Some user>) to that channel with UnfurlLinks set to false
  3. In the debug log entry we can observe that unfurl_links was not sent to Slack eg.
slack-go/slack2023/09/26 16:21:17 chat.go:228: Sending request: channel=%23test&mrkdwn=false&text=%3Chttps%3A%2F%2Fexample.slack.com%2Fteam%2FXXXXXXXXXX%7CSome+user%3E&token=xoxb-REDACTED&unfurl_media=false&username=User

This is related to #20 when the default value was changed to false. Forcing to send UnfurlLinks (by using MsgOptionDisableLinkUnfurl()) solves the problem.

Versions

  • Go: 1.21.0
  • slack-go/slack: 0.12.3