slackapi/python-slack-sdk

Option to block link url preview

guigui8 opened this issue · 1 comments

When Slack Python client posts messages, urls are automatically assigned a preview.
However this is very inconvenient in some cases, e.g. when a lot of messages are posted in a short time scale the channel becomes unreadable from the very large space taken by the previews.
If such a message is posted by a human he/she can dismiss it but there is no such option in the Python client.

The requested feature which solves this issue is an optional parameter in the post_message which works like this : post_message(channel, message, url_previews = False) and defaults to True.

If such an option already exists, this ticket can be used as a tracker for a better way to document it.

Note : Several workarounds exists : putting url in quotes, block preview from specific domains in workspace settings, etc. however these can only be used in specific circumstances or remove ability to use text formatting.

Category (place an x in each of the [ ])

  • slack_sdk.web.WebClient (sync/async) (Web API client)
  • slack_sdk.webhook.WebhookClient (sync/async) (Incoming Webhook, response_url sender)
  • slack_sdk.models (UI component builders)
  • slack_sdk.oauth (OAuth Flow Utilities)
  • slack_sdk.socket_mode (Socket Mode client)
  • slack_sdk.audit_logs (Audit Logs API client)
  • slack_sdk.scim (SCIM API client)
  • slack_sdk.rtm (RTM client)
  • slack_sdk.signature (Request Signature Verifier)

Requirements

Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.

Hey @guigui8 👋 Link previews, or "unfurls", can currently be hidden with the unfurl_links option set to False:

client.chat_postMessage(channel="C0123456", text="https://example.com", unfurl_links=False)

These unfurls can certainly take up space when many links are posted together, so I hope you find this option helpful! And since this is already supported, just under a different name, I'll go ahead and close this issue but please feel free to follow up with anything else!