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

Sending formatted links doesn't work #114

Closed
jdowning opened this issue Dec 12, 2014 · 130 comments
Closed

Sending formatted links doesn't work #114

jdowning opened this issue Dec 12, 2014 · 130 comments
Labels
bug M-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documented

Comments

@jdowning
Copy link

We switched to using hubot-slack 3.0 and am seeing weird formatting with messages that include URLs.

For example, I have a script with msg.send "[#{url}|details]". The output is as follows (if url ==https://google.com):

v2: [details] << where details is a hyperlink in the channel
v3: [https://google.com%7Cdetails]

I've tried <https://google.com|details> too, but that input is printed literally in the channel.

@paulhammond paulhammond added the bug M-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documented label Dec 16, 2014
@paulhammond
Copy link
Contributor

Thanks for opening the bug here - sorry we couldn't resolve the issue on twitter.

I've reproduced this. You're right that this worked in v2, but it was one of those things where it worked by accident, which makes a fix harder.

To understand what's going on here, it helps to know how Slack formats links internally. The summary is that a link in slack is represented by <url|label>, for example: <http://www.example.com|example.com>.

Hubot v2 converted URLS into links inside the adapter, and did so naively. It converted [http://www.example.com|details] into [<http://www.example.com|details]>. Note: the brackets are unbalanced, so the closing bracket shows up as part of the link.

With Hubot v3 our servers convert URLs into links, it converts [http://www.example.com|details] into [<http://www.example.com>|details]. Which is technically correct, but not what you want.

I think the answer here is for us to work out a way for hubot to send formatted text to slack (so you can send [<http://www.example.com|details>] which is what you really want. I am working on a plan to make this possible...

@jdowning
Copy link
Author

Thanks for responding here @paulhammond !

I wrote up a quick script to test this and the URLs are still not parsing as documented:

Hubot Script:

module.exports = (robot) ->
  robot.hear /^test msg$/i, (msg) ->
    msg.send "You can go to <https://www.google.com|google> and search."

Slack Output:

[8:55 AM] Justin: test msg
[8:55 AM] Hubot: You can go to <https://www.google.com|google> and search.

Any ideas?

@jdowning
Copy link
Author

FYI, I updated hubot-slack and am still experiencing this issue:

$ npm list | grep slack
├─┬ hubot-slack@3.2.1
│ └─┬ slack-client@1.2.2

@siygle
Copy link

siygle commented Dec 17, 2014

+1
I also found that user email (e.g. test@example.com) would parse become test@example.com mailto:test@example.com. Why not just keep the old format?

@paulhammond
Copy link
Contributor

@ferrari that's a slightly different issue, which is fixed by #125. The old version of hubot worked with different APIs on the Slack side. The new APIs work differently, but add a lot of new functionality. Unfortunately we're still shaking out some edge cases, sorry about the problems this is causing you.

@justindowning: Unfortunately the fix for this needs some more work on our servers, so didn't make the cut for 3.2. We're still working on it...

@siygle
Copy link

siygle commented Dec 17, 2014

Thanks!
We did some modify on regex match to get correct format for now,
hope can see new version come out soon.

@paulhammond
Copy link
Contributor

@ferrari We just merged the pull request, but it's not yet made it into a release. Until then you could put something like this in your package.json and I think it'll pull in the new code:

"hubot-slack": "slackhq/hubot-slack#64d7c572",

Don't forget to change it back after the next release!

@lilyball
Copy link
Contributor

I just submitted a pull request (#129) that (among other things) tweaks the formatting so it stops using both the label and the link together. It's just weird to get results like "apple.com http://apple.com".

@paulhammond
Copy link
Contributor

@kballard that's a different issue. This is about sending formatted links to Slack, not receiving formatted links from Slack.

@paulhammond paulhammond changed the title Messages with URLs not parsed correctly Sending formatted links doesn't work Dec 18, 2014
@ianfixes
Copy link

If I understand this correctly, the issue is currently server-side? Or to say it another way, there is currently nothing I can do in this or the node-slack-client repository to make links work?

@omega
Copy link

omega commented Jan 13, 2015

Any progress or updates on this issue? We rely on a lot of formatted links in our messages, and I can't find any ways to get the 3.0 adapter to send links in a format that gets formatted correctly

@ianfixes
Copy link

Seconded.

@jdowning
Copy link
Author

Unfortunately the fix for this needs some more work on our servers

@paulhammond How are things looking server-side?

@jdanlewis
Copy link

It would be nice if the link text allowed whitespace as well, e.g.:

msg.send "<http://www.slack.com|Check it out!>"

Is there a workaround to achieve this type of formatting?

@gabriel403
Copy link

Is this getting fixed sometimes soon peeps?

@glortho
Copy link

glortho commented Mar 18, 2015

+1

5 similar comments
@gampleman
Copy link

+1

@justmiles
Copy link

+1

@adambuckland
Copy link

+1

@tonglil
Copy link

tonglil commented Mar 21, 2015

+1

@alexslade
Copy link

+1

pdai1y added a commit to pdai1y/DC837Bot that referenced this issue Apr 2, 2015
@Soulfire86
Copy link

+1 Any closer to this?

@evanwolf
Copy link

evanwolf commented May 1, 2015

+1 This also inhibits Slack's own custom slackbot responses from serving html.

I wonder if there are security issues. Skype started analyzing all IM for evil links because of bots using Skype APIs to send phishing and malware links. Their tradeoff was "go back on our promise of end-to-end privacy" or "save our network".

@omega
Copy link

omega commented May 1, 2015

But how would evil bots get access to slack? Isn't it all private?

On 1. mai 2015, at 23.08, Phil Wolff notifications@github.com wrote:

+1 This also inhibits Slack's own custom slackbot responses from serving html.

I wonder if there are security issues. Skype started analyzing all IM for evil links because of bots using Skype APIs to send phishing and malware links. Their tradeoff was "go back on our promise of end-to-end privacy" or "save our network".


Reply to this email directly or view it on GitHub.

@DEGoodmanWilson
Copy link

Howdy y'all, new project maintainer here. I am looking into this this week! Hold tight, we'll get this sorted.

@DEGoodmanWilson DEGoodmanWilson self-assigned this Jun 20, 2016
@JoeMattleman
Copy link

I ran into this issue trying to shorten our squad's channel topic into descriptive links. I want: "Appear.in | JIRA Board | Confluence Page" or similar links all visible without hovering over the topic. Thanks!

@aklinkert
Copy link

Any progress @DEGoodmanWilson? 😟

@DEGoodmanWilson
Copy link

Yes, we will have something for you soon!

@markaschneider
Copy link

Setting parse='none' (as @mrcarriere mentioned above) worked for me.

@meetravi
Copy link

+1

@korneel
Copy link

korneel commented Jul 25, 2016

Will hyperlinking words and terms in a Slack message be supported when this ticket is closed? Because now it's not supported. This would be very useful for formatting Hubot messages.

@DEGoodmanWilson
Copy link

Sorry, a bit behind on closing tickets. This should be fixed in v4. To use the feature, just follow the guide here: https://api.slack.com/docs/message-formatting

@tedsteen
Copy link

Omg. Thank you!

GabLeRoux added a commit to GabLeRoux/hubot-bitbucket that referenced this issue Sep 9, 2016
GabLeRoux added a commit to GabLeRoux/hubot-bitbucket that referenced this issue Sep 9, 2016
@rucsi
Copy link

rucsi commented Dec 18, 2017

image

@Roach
Copy link
Contributor

Roach commented Dec 18, 2017

@rucsi is the mrkdwn_in param being passed to specify which fields to parse as markdown?

https://api.slack.com/docs/message-formatting#message_formatting

@viveksinha
Copy link

@Roach
This is not working for me, when the URL is sent in text outside the attachments for chat.update command. FYI, it works for chat.postMessage command and mrkdwn is set to true for both commands. I guess I'm missing something here.

@kynnjo
Copy link

kynnjo commented Feb 8, 2018

FWIW, this remains broken, as of 2018-02-08.

@imTachu
Copy link

imTachu commented Feb 28, 2018

+1 @kynnjo

@viveksinha
Copy link

For me, it is working now.

@larshb
Copy link

larshb commented Aug 21, 2018

+1

@webcat12345
Copy link

Hello everyone.
I have an issue for slack notification on Win 10.
I used slack bot and sending formatted message, https://app.shipez.us|link
it looks like link on the bot channel but display like &lt;link&gt; on notification.
Also it works on Mac and Ubuntu, Win 8 properly but not working on only Win 10.
11

12

If anyone has a solution, please let me know.
thanks.

@Wimmmmm
Copy link

Wimmmmm commented Jan 5, 2021

Why is this ticket being closed? The issue is still there - I cannot write manually nor via API a link with a label, to sow only the label.

@novicedev7291
Copy link

This is not working for me as well in slack client on macos x

@recursionbane
Copy link

Can confirm this is still broken. @DEGoodmanWilson, please reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug M-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documented
Projects
None yet
Development

No branches or pull requests