Slack URL to open a channel from browser - url

This iTunes URL will open The Hitchhiker's Guide to the Galaxy in your iTunes:
itmss://itunes.apple.com/us/audiobook/hitchhikers-guide-to-galaxy/id315596797
This Spotify URL will open ALL by the Descendents in Spotify:
spotify:track:22feF2sbtGydtvx1OeLSih
Does Slack have a URL scheme to open a #channel in the Slack app from a link?
I want to put a link on my team's site that can link to the Slack #channel we use, for use by other people in the company.

Referencing a channel within a conversation
To create a clickable reference to a channel in a Slack conversation, just type # followed by the channel name. For example: #general.
To grab a link to a channel through the Slack UI
To share the channel URL externally, you can grab its link by control-clicking (Mac) or right-clicking (Windows) on the channel name:
The link would look like this:
https://yourteam.slack.com/messages/C69S1L3SS
Note that this link doesn't change even if you change the name of the channel. So, it is better to use this link rather than the one based on channel's name.
To compose a URL for a channel based on channel name
https://yourteam.slack.com/channels/<channel_name>
Opening the above URL from a browser would launch the Slack client (if available) or open the slack channel on the browser itself.
To compose a URL for a direct message (DM) channel to a user
https://yourteam.slack.com/channels/<username>

Sure you can:
https://<organization>.slack.com/messages/<channel>/
for example:
https://tikal.slack.com/messages/general/ (of course that for accessing it, you must be part of the team)

The URI to open a specific channel in Slack app is:
slack://channel?id=<CHANNEL-ID>&team=<TEAM-ID>
You will probably need these resources of the Slack API to get IDs of your team and channel:
GET https://slack.com/api/team.info
GET https://slack.com/api/channels.list?exclude_archived=1
Here's the full documentation from Slack

This link opens the channel in the browser
https://<org-name>.slack.com/channels/<channel-name>
This link opens up the slack channel in the App
https://<org-name>.slack.com/archives/<channel-name>

You can use
slack://
in order to open the Slack desktop application.
For example, on mac, I've run:
open slack://
from the terminal and it opens the Mac desktop Slack application.
Still, I didn't figure out the URL that should be used for opening a certain team, channel or message.

When I tried yorammi's solution I was taken to Slack, but not the channel I specified.
I had better luck with:
https://<organization>.slack.com/messages/#<channel>/
and
https://<organization>.slack.com/messages/<channel>/details/
Although, they were both still displayed in a browser window and not the app.

Related

Post a message to a specific MS Teams Channel using deep link

I am able to go to a specific channel using :
msteams://teams.microsoft.com/l/channel/channelid/General?groupId=groupid&tenantId=tenantid
but how do i send a message to the channel using deep linking URI?
I tried
msteams://teams.microsoft.com/l/channel/channelid/General?groupId=groupid&tenantId=tenantid&message=hello
but it just opens the channel in MSTeams
You can use share-to-teams button for posting message to teams channel withtout using api.
It really looks like MS doesn't support doing this via a simple URL (as of October 2021). As noted, the graph API should provide a way to do it but is complex to setup and get started with.
The best option I've found is to use an HTML mailto: link (see https://www.w3docs.com/snippets/html/how-to-create-mailto-links.html) and set the mail's "To" to the address from the team's "..." > "Get email address" dialog.
This pops up a compose window in your mail client (e.g. Outlook) and all you have to do is click Send to post it to your team channel. It supports passing through formatted text, and the email's subject is displayed prominently as the title of a new MS Teams Conversation.

Redirect command requests to another service

I have a not yet published app change in Slack which modifies the command service endpoint to another domain.
I tested that, it is possible to send back a 307 with a redirect URL and Slack API will follow that redirect.
I would like to be sure that redirect to another domain is also possible for live apps. So what works for an in-development app it will work for a live app.
Could any of you confirm that or send me a link to the documentation? I searched the documentation already, but did not find any entry about it.
Thanks!
We contacted Slack on their partner channel and they verified that:
"Our docs explicitly say we respect 301 and 302."
But we made a test and it accepts 307 as well.
(I can't share a link to their response as it was written inside Slack slack-platform workspace)

Slack api conversations.history returns error: not_in_channel

I'm starting out with the Slack API and trying to just get a list of messages.
Here are my steps:
Created a Slack app and gave it channels:read and channels:history scope (also re-installed it)
Queried the list of channels with conversations.list (this worked fine)
From the output of conversations.list, I found a channel that I use and copied the id
Used the conversations.history api with the channelid from step 3
Result:
{ "ok": false, "error": "not_in_channel" }
I'm not at all sure what is happening here. I definitely have messages in the channel, and the documentation page for that api does not say anything about this "not_in_channel" error code.
What am I doing wrong?
After a long time of investigations (~2 hours), I found an easy approach. For Caleb's answer, I didn't understand how to invite a Bot to the channel. Hence, I am posting this answer.
Go to your Slack Channel and type the following as a message.
/invite #BOT_NAME
Eg: If your Bot name is SRE Incident Manager the command would be as follows.
/invite #sre_incident_manager
As soon as you start typing #, Slack will automatically suggest. So it becomes easy. For this, the Bot needs to be added to your Slack Workspace.
PS: Original answer.
The error not_in_channel has the exact meaning, your custom Slack app should be added to the channel.
Exact solution 1
To resolve the error, in the Web Slack interface:
Open channel settings
Click on the Integrations tab
Click Add apps and find your custom app.
Slack app might have different interface, see Iryna Vernik's answer.
Alternative solution 2
Give access to the bot to all channels by adding workspace wide scope, for example, chat:write.public. Depends on your needs and security requirements.
Alternative solution 3
To access the channel chat from API specify Incoming webhook. Slack will generate a unique URL with the token per each channel. Only convenient for a few channels.
This error arises when you are using the bot oauth token and the bot is not invited to the channel. To solve this you need to
Invite the bot(slack app) to join the channel.
Use the OAuth Access Token instead
To add Bot to your channel you need to write /invite #Bot_name in the slack channel
I also didn't understand how to invite a Bot to the channel. Way that was proposed by Caleb and Keet was not clear for me or not working. From my side, 'invite' work after
open channel
in Details tab, choose a 'More'clause
in dropdown menu, chouse an 'add app'
in pop-up look for you app (bot)
Also i was use Bot User OAuth Access Token, because i need this functionality in private channel (additionaly, you should add for bot groups:history scope)
FOr me, instead of invite a user/bot, I invite the app.
I'm getting started with the Slack API as well, and I've come to realize that not_in_channel simply means that the user/bot you are using the token for hasn't joined that particular channel you're trying to perform an action on.
Think of it this way: if you're using Slack on the web-browser or web-app, you wouldn't be able to post a message on a channel you haven't either joined or was invited to.
☝️ You'll also never run into this issue through the Slack UI/UX because you're not even able to access the channels UNTIL you are invited or join it.
Click to see png example of a slack message stating my bot being added to a channel
However, because we're using the API we can essentially skip some steps, and in this case we skipped the step where a user/bot has joined the channel before doing the action we're trying to perform (writing a message, grabbing information, etc).
💪 How to address this
There's probably plenty of ways to do it that I'm not versed in, but if you're just concerned about a specific channel or two without the concern of scaling to x channels I'll list the way that worked for me.
📇 /invite Slash Command
As others have mentioned, putting /invite in the message box lets you use Slack's slash command shortcut to add users. What's important is this way also allows us to invite bots to the channel.
Putting "#" triggers Slack to start auto-suggesting, which is why it then becomes easy to find your bot name in the list.
Click here to see screenshot example of the /invite command with #bot_name_here
Hope this helps answer people's question on why it's happening, and thank you to the original posts that got me out of my initial mess. 🙏
As all others said, you need to join each channel.
The bot can join channel programmatically by using API below:
https://api.slack.com/methods/conversations.join
Don't forget to add permission of conversations.join

Using the Slack web API when deep linking to direct message/IM, I get "#deleted-channel"

When responding to a slash command with a string that includes a channel ID like <#C3989289>, the response in Slack shows a deep link to that channel "#general.
When I do the same for a direct message or IM, the response in Slack shows "#deleted-channel" and it's not a link.
I don't see anything in the docs about why this: https://api.slack.com/docs/message-formatting#linking_to_channels_and_users
Slack has confirmed that their system is designed in this way to protect private channels/direct messages from being made aware to users, even if the recipient of the message containing the deep link does belong to that particular channel/DM.

Lauching Lotus Notes with mailto:

I have a mailto url in a web page. The target system contains both Microsoft Outlook and Lotus Notes. Microsoft Outlook is the default Mail Client. So when i click on mailto link it opens up Microsoft Outlook.
I want it to open Lotus Notes when i click on the link and i do NOT want change the default mail client settings in Internet Options as well. Please suggest a solution or work around to achive this.
You can use a notes:// style URL, which will work for users with recent versions of the Notes client installed. This URL format can be used to launch a database (or open a known document in a database) whose file path is known. Unfortunately, for creating an email document in the current user's mailbox, the NSF path will be different for each user. But there is a technique you can use, if you have a Notes server in your environment. You can have the link on your page actually link to a static Notes database, which has an "OnDatabaseOpen" event handler set up to look up the user's mailbox path, and then redirect the user there. It's a few steps - not as simple as a mailto: URL - but if you are desperate, it can be made to work.
You can use this URL to open Notes and a new memo: Notes:///0000000000000E00/Memo?OpenForm
source: http://www-10.lotus.com/ldd/dominowiki.nsf/dx/notes-urls
This however does not solve the problem of filling out the To address, Subject, etc.
A mailto link is always going to use the default mail app. You may be able to use a lotus notes shortcut and pass the email address as arguments.

Resources