I want to dynamically create a link to a Slack user profile or DM, but literally all I know is the organization and username (not the user ID). I cannot use the Slack API, and I cannot rely on any manual process. For example…
Given an organization of “my_org” and a username of “my_username”, my canonical profile URL would be something like this: https://my_org.slack.com/archives/ABCD12345
. But unless that ID is some kind of hash, I have no way to get it.
Linking to a channel with the same constraints is easy. I can just plug in the channel name as-is, like this: https://my_org.slack.com/app_redirect?channel=my_channel
. That’s what I want to do with the user profile or DM.
To illustrate using PHP code, I would like to do this:
// This is EVERYTHING I know:
$org = 'my_org';
$username = 'my_username';
// This is what I want to do:
$profile = 'https://{$org}.slack.com/what_goes_here?{$username}';
I have searched the Slack documentation, and it seems like the feature would be here, if anywhere: https://api.slack.com/reference/deep-linking. But it doesn’t give any hint of the feature’s existence. I have a suspicion it just can’t be done, but maybe someone will prove me wrong.