Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

About support for unfurling all links posted by bot #531

Closed
4 of 9 tasks
kevinnio opened this issue Sep 23, 2018 · 2 comments
Closed
4 of 9 tasks

About support for unfurling all links posted by bot #531

kevinnio opened this issue Sep 23, 2018 · 2 comments
Labels
needs info An issue that is claimed to be a bug and hasn't been reproduced, or otherwise needs more info question M-T: User needs support to use the project

Comments

@kevinnio
Copy link

kevinnio commented Sep 23, 2018

Description

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.

What type of issue is this? (place an x in one of the [ ])

  • bug
  • enhancement (feature request)
  • question
  • documentation related
  • testing related
  • discussion

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

  • I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've searched for any related issues and avoided creating a duplicate issue.
@aoberoi
Copy link
Contributor

aoberoi commented Oct 1, 2018

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 }

@aoberoi aoberoi added question M-T: User needs support to use the project needs info An issue that is claimed to be a bug and hasn't been reproduced, or otherwise needs more info labels Oct 1, 2018
@kevinnio
Copy link
Author

To anyone that might be wondering, that indeed worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs info An issue that is claimed to be a bug and hasn't been reproduced, or otherwise needs more info question M-T: User needs support to use the project
Projects
None yet
Development

No branches or pull requests

2 participants