RamblingCookieMonster / PSSlack

PowerShell module for simple Slack integration
http://ramblingcookiemonster.github.io/PSSlack/
MIT License
274 stars 74 forks source link

Get-Slackuser only getting first 1000 users. Results are paged, can we get all pages please? #88

Open robl95405 opened 5 years ago

robl95405 commented 5 years ago

Calling Get-Slackuser is only returning the first page of users. Would it be possible for you to do the paging in this routine and return the final, complete set? Please, please? :)

RamblingCookieMonster commented 5 years ago

I don't know who wrote this silliness, but they didn't plan very well. Ideally, Send-SlackApi should handle paging, instead of nonsense like including it in individual functions. Although, looking at it, seems like it's context specific (See $PageDirection fun.

Totally open to a pull request that supports this! I have no use for it at $work or $home, so probably won't pop up on my todo list, unfortunately.

Even if there's a better way, feel free to borrow from the code linked above to just get something working, I'm not too picky.

Cheers!

robl95405 commented 5 years ago

Agreed and thanks! I have the paging wrappers in my perl scripts. I've asked Keith for help in generating a pull request, not sure my powershell abilities are up to production standards. :)

kilasuit commented 5 years ago

This impacts this issue in PoshBot https://github.com/poshbotio/PoshBot/issues/184

kilasuit commented 5 years ago

details on the API is at https://api.slack.com/methods/users.list

devblackops commented 5 years ago

Short of adding global paging support, this could probably be implemented similarly to https://github.com/RamblingCookieMonster/PSSlack/pull/90

RamblingCookieMonster commented 5 years ago

Yeah, that would help as a short-term solution. The PR linked above would help long-term (some sort of global pagination) - #91

Cheers!

lia-cha-avalara commented 5 years ago

@RamblingCookieMonster - is this going to be merged soon? we have a weird setup in our environment where slack users names don't always match their AD samaccountname value. When we try to use this module to send users messages via slack, it errors out for those users with non-matching slack usernames and AD samaccountname.

I tried using the get-slackuser function to return a list of usernames so that i can use that to compare against the AD name but im not able to retrieve all usernames that start with "za*". I'm thinking it's because of the pagination thing.

RamblingCookieMonster commented 5 years ago

Which! #91 is a WIP I think, @rkeithhill might know more about the current state.

If you want to implement a quick bandaid, we could get that in as well (like Brandon mentioned, #90 seems similar and may help)

Cheers!

lia-cha-avalara commented 5 years ago

ahh yeah i'll wait for #91. For now I'm manually hardcoding one off issues in my script.

Jaykul commented 3 years ago

Ping!