Search code examples
slack

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 :)


Solution

  • 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.