-
Notifications
You must be signed in to change notification settings - Fork 640
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
Questions about html escape #43
Comments
👍, having this problem too. |
👍 having this problem too! Please fix |
👍 , but I'm a little confused. In Slack API Message Formatting, we need to escape when we want to use
It seems there's a way to fix escaping function, but I don't know it is possible. |
Just as a note, we just upgraded our hubot adapter to the new hubot-slack that uses the bot API (awesome btw!!). Unfortunately, this is still an issue :( I'll see if I can track down what's going on in the new code and post a patch, but I'm still a bit unclear how this is supposed to work. Any input from SlackHQ? |
Hi! Sorry for the problems, and sorry for not replying here sooner! As you might have noticed the new hubot adapter is built on an API that does link formatting slightly differently, so sending marked up links is now broken in a slightly different way. I think this is the same bug we're tracking in #114. To fix this we're going to need to make a few changes on the server so the API can accept sending pre-marked-up links. We're working actively on that now, and hope to have an update soon. |
Thanks for the update @paulhammond! Happy to help if possible, but sounds like we're waiting on server-side support at this point. Let me know if I can help test anything. |
@paulhammond Could you provide an update here? I'd be happy to work on the adapter code here if the API fixes you mentioned have taken place. |
Also experiencing this issue! When our hubot sends pull request related notices to Slack, the message should partly appear as This means that the msg is sent to Slack partly like this However, the pipe character is being url encoded so the entire message appears broken. Watching this issue closely! |
I was able to reproduce this pretty easily. I'm not sure why it's being escaped yet, as there doesn't to seem to be any obvious escaping code in the adapter. It might be in the node-slack, or maybe it's a parameter to the API that needs to be specified to parse it as mrkdwn. I found a workaround though. It's not obvious, but you can use slack attachments to do this: robot.emit 'slack.attachment', {text: "<https://github.com/link/to/a/PR|myrepo #42> fix some broken">} |
I did find a difference between So the difference comes down to
So it seems like this should work as is, which makes me think there is a bug in the RTM. I'm not sure if there's any advantage to using RTM for responses, or if we can always just use the web API instead. |
I got confirmation from Slack that the RTM API doesn't support link formatting:
So, sounds like we update to always use the chat.postMessage API. |
Closing this as fixed in 4.0. Please reopen if I am mistaken! |
Hi folks. I'm getting unexpected behavior when trying to send formatted links.
I'm attempting to send a response from hubot with a link label, like so:
What I'd expect to see in Slack is this, with
{{ … }}
representing hyperlinked text with the URL I passed.Instead, I see this, with literal brackets and the link in the wrong place:
Looking around, it's pretty evident that this is due to the
escapeHTML
call that occurs before the message is sent. In fact, removing that call gives me the result I'd expect, with the properly parsed link.I'm trying to understand how https://api.slack.com/docs/formatting works in the context of hubot, but I'm a bit confused. What is the best way to allow for what I want to do without screwing up everyone else's hubot? Should I create
msg.sendRaw
? Is it actually safe to removeescapeHTML
since slack handles most of it server-side?The text was updated successfully, but these errors were encountered: