Create Hyperlink in Slack
SlackSlack Problem Overview
Is there a way to create a hyperlink without it auto resolving? I simply want some text I type to be clickable to some url when I post in slack. I don't see a way to do this yet.
Slack Solutions
Solution 1 - Slack
At some point in 2020 or 2021, Slack added the ability to hyperlink text using either the formatting toolbar or markup, which most of us would call Markdown. According to the documentation for formatting messages and setting your message formatting preference, if you want to use markup, you have to first set your preference to Format messages with markup, and then you can link text in the usual Markdown way:
Here comes a link: [a link to Stack Overflow](https://www.stackoverflow.com)
This answer has changed a couple of times over the years as Slack has updated its capabilities. Obsolete versions of this answer can be viewed in this answer's revisions.
Solution 2 - Slack
In addition to the ⌘ShiftU/CtrlShiftU solution, you can also add a link quickly by doing the following:
- Copy a URL to the clipboard
- Select the text in a slack message you are writing that you want to be a link
- Press ⌘V on Mac or CtrlV
I couldn't find it documented anywhere, but it works, and seems very handy.
Solution 3 - Slack
I am not sure if this is still bothering you but take a look at this page for slack text formatting:
https://api.slack.com/docs/message-formatting#linking_to_urls
For example using Python and the slack API:
from slackclient import SlackClient
slack_client = SlackClient(your_slack_token)
link_as_text_example = '<http://www.hyperlinkcode.com/|Hyperlink Code>'
slack_client.api_call("chat.postMessage", channel=channel_to_post, text=link_as_text_example , as_user=True)
You can also send a more advance JSON following the link: https://api.slack.com/docs/message-attachments
Solution 4 - Slack
Slack now supports hyperlinks natively in the message composer using the Link
button or shortcuts:
- Mac:
cmd
+shift
+U
- Windows/Linux:
ctrl
+shift
+U
https://slack.com/help/articles/202288908-Format-your-messages-Format-your-messages
Solution 5 - Slack
you can try quoting it which will keep the link as text. see the code blocks section: https://get.slack.help/hc/en-us/articles/202288908-Format-your-messages#code-blocks
Solution 6 - Slack
UPDATED ANSWER:
As per the documentation:
>- Select text, then click the link icon in the formatting toolbar >- Select text, then press ⌘ShiftU on Mac or CtrlShiftU on Windows/Linux. > >Copy the link you'd like to share and paste it in the empty field under Link, then click Save.
Juts for fun: how we did it at times when Slack allowed rich formatting but did not allow user hyperlinks (previous version of the answer):
To do this you must first create text with the desired hyperlink in an editor that supports rich text formatting. This can be an advanced text editor, web browser, email client, web-development IDE, etc.). Then copypaste the text from the editor or rendered HTML from browser (or other). E.g. in the example below I copypasted the head of this StackOverflow page. As you may see, the hyperlink have been copied correctly and is clickable in the message (checked on Mac Desktop, browser, and iOS apps).
On Mac
I was able to compose the desired link in the native Pages app as shown below. When you are done, copypaste your text into Slack app. This is the probably easiest way on Mac OS.
On Windows
I have a strong suspicion that MS Word will do the same trick, but unfortunately I don't have an installed instance to check.
Universal
Create text in an online editor, such as Google Documents. Use Insert -> Link, modify the text and web URL, then copypaste into Slack.
Solution 7 - Slack
python
x = "http://xxxxxx"
y = "text title"
text_link = '<{}|{}>'.format(x,y)
post text_link in using python slack client
Solution 8 - Slack
I feel like none of these messages quite answer the question still. See - https://api.slack.com/docs/message-attachments.
It requires you to put the link in an attachment. Hyperlinking is still not allowed in the body of the message.
> { > "attachments": [ > { > ..., > "text": " <https://honeybadger.io/path/to/event/|ReferenceError> - UI is not > defined", > ... > ] }
ReferenceError
will be a hyperlink.
Solution 9 - Slack
I know you wanted only a hypertext link, but if you copy & paste a link address into Slack that does work very nicely. i.e. if referring to VersionOne ticket number (V1 mouseover the ticket window to open the mouseover window, then right click on the ticket number for the option to "copy link address", then in Slack paste. It'll paste the full ticket URL but then it shows a nice summary of the ticket number and name and you can click it to go right into the ticket.)