Open tiagoshibata opened 5 years ago
Just for clarification: Slack uses its own formatting language instead of Markdown. Links are represented as <Links|Display text>
, such as <mailto:bob@example.com|Bob>
, and the horn bot doesn't convert the <>
link to proper markdown. The reference documentation explains it:
The
mrkdwn
attribute is missing vowels because our markup language is not quite markdown but something quite like it.
I'm working on a fix and will open a PR at https://github.com/integram-org/webhook . It might take me a while since I'm not familiar with Go.
FYI, I implemented this, which fixes the issue: https://play.golang.org/p/nj0YB1xkLsK
I'll add a few more checks (e.g. Slack doesn't convert links if there's a new line between the opening <
and >
), test on the bot and create a PR.
@tiagoshibata sorry for a long reply. Thanks for pointing out to this issue. Will you be able to create the PR?
Yes, I can create the PR :) I have the code ready, I'll polish it later today and open the PR.
I'll give it a bit more thought before opening the PR. I found out e.g. CircleCI sends the following request to Slack:
{
"attachments": [
{
"fallback": "Failed: tiagoshibata's workflow (<https://circleci.com/REDACTED|Build Error>) in <https://circleci.com/bb/REDACTED|tiagoshibata/REDACTED> (<https://circleci.com/bb/tiagoshibata/REDACTED>)\n- ...",
"text": "Failed: tiagoshibata's workflow (<https://circleci.com/REDACTED|Build Error>) in <https://circleci.com/bb/REDACTED|tiagoshibata/REDACTED> (<https://circleci.com/bb/tiagoshibata/REDACTED>)\n- ...",
"color": "#d10c20"
}
],
"text": "",
"channel": null
}
Which doesn't have the mrkdwn_in
attribute set for the attachment, but Slack still parses its links. After some testing it seems like Slack always parses the <link|text>
tags, even with markdown disabled. My current implementation only replaces these tags with the markdown equivalent, I'll look into making it work with the Telegram HTML parser too.
Opened at https://github.com/integram-org/webhook/pull/2 , please take a look whenever you can :)
Using Slack-formatted web links doesn't work in Horn. Examples:
In both cases, all text between
<
and>
is removed.