ian
ian

Reputation: 12251

Is there a published format for Slack user_id and username?

I'm scouring the docs for this info but I haven't found anything much. I've found this note on a hubot-slack issue:

From the slack ui when changing username:

Usernames must be all lowercase. They cannot be longer than 21 characters and can only contain letters, numbers, periods, hyphens, and underscores.

I can come up with a regex to parse out an expanded entity based on the few examples they've given, but my pedantic side was hoping for things like a minimum length, an official word on what the maximum length is, allowed characters etc.

I might try getting a username of ..................... in the meantime :)

Upvotes: 4

Views: 4154

Answers (2)

ian
ian

Reputation: 12251

I emailed Slack support and they came back to me with an answer:

at the moment the only format we have for the team_id is that it begins with a T as you've seen. There's no other constraints in place (e.g. number of characters) that you could use as a check. I've pushed a request over to our product managers though as something you'd like to see in future!

And they followed up with:

I had a look over some example Team IDs to see can I find some patterns or anything but outside of the starting character, I can't see much concrete in regards to the rest of the characters.

Which is fair enough.

Upvotes: 2

keba
keba

Reputation: 2127

I'm not sure on user ID, but for Username I found the details are only listed on the user profile page within the website (not a http link for a reason that should be obvious) in the Username field on that page:

https://<yourSlackAccountNameHere>.slack.com/account/settings#username

It states (as of 11 May 2018):

Usernames are not part of your profile, and are only required by Slack for technical reasons. Your username is mostly invisible to others, but you can change it if you want to.

Usernames must be all lowercase. They cannot be longer than 21 characters and can only contain letters, numbers, periods, hyphens, and underscores.

Note that you cannot change your username more than twice per hour. Choose wisely.

Personally I use the following regex:

([a-z0-9._-]{1,21})

Upvotes: 3

Related Questions