From the official Slack API documentation on classic unfurling:
By default we unfurl all links in any messages posted by users. For messages posted via incoming webhooks, the chat.postMessage API method or chat.postEphemeral, we will unfurl links to media, but not other links.
If you'd like to override these defaults on a per-message basis you can pass unfurl_links or unfurl_media while posting that message. unfurl_links applies to text-based content, unfurl_media applies to media based content. These flags are mutually exclusive, the unfurl_links flag has no effect on media content.
I want my hubot to post links to tweets in a Slack channel. Problem is these links won't unfurl because tweets are not considered media. Solving this issue is easy: just send the unfurl_links flag in the request to the chat.postMessage endpoint, but looks like currently there's no way to do that in the adapter.
Is there any known workaround for this or do we need to have this included as a feature in a PR? If I add this feature myself, would you guys be willing to review it? You have some olds PRs related to this, that's why I'm asking.
x in one of the [ ])x in each of the [ ])hi @kevinnio, i think the following code should work:
module.exports = (robot) ->
robot.hear /thanks/i, (res) ->
res.send { text: "Here's a fun tweet: https://twitter.com/photographerjon/status/1046174097762332672", unfurl_links: true }
To anyone that might be wondering, that indeed worked.
Most helpful comment
hi @kevinnio, i think the following code should work: