Create a gist now

Instantly share code, notes, and snippets.

Gets a list of meetup RSVPs using the meetup API.
function Get-MeetupRsvps([string]$eventId, [string]$apiKey) {
$nameWord = "[\w-']{2,}"
$regex = "^(?'first'$nameWord) ((\w\.?|($nameWord )+) )?(?'last'$nameWord)|(?'last'$nameWord), ?(?'first'$nameWord)( \w\.|( $nameWord)+)?$"
function Get-AttendeeInfo {
process {
$matches = $null
$answer = $_.answers.answers_item
if(-not ($_.name -match $regex)) { $answer -match $regex | Out-Null }
return New-Object PSObject -Property @{
'FirstName' = $matches.first
'LastName' = $matches.last
'RSVPName' = $_.name
'RSVPAnswer' = $answer
'RSVPGuests' = $_.guests
}
}
}
$xml = [Xml](New-Object Net.WebClient).DownloadString("https://api.meetup.com/rsvps.xml?event_id=$eventId`&key=$apiKey")
$xml.SelectNodes('/results/items/item[response="yes"]') | Get-AttendeeInfo | select FirstName, LastName, RSVPName, RSVPAnswer, RSVPGuests
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment