3 minute read

I recently released a PowerShell module called MeetupPS. This module is a wrapper around the Rest API offered by Meetup.com. The commands available at the moment allow you to:

  • Get a Meetup group information,
  • Get Meetup events for a specific group (past and upcoming)
  • Create events

Meetup logo: the word Meetup in white script on a red circle

The initial reason behind the creation of this module is that I needed to gather the list of all the meetings from the last year (Title, link, attendees) and needed to submit them to the MVP Portal using the MVP Module. A long process if you do this manually.

The second reason is that I want to automate the creation of an event using something like a Plaster template (Blog post, Meetup Event, Announce to Meetup members, Skype meeting, Tweet, Slack…). This whole process is not done yet, but that would save me some times on the long term.

Install the module

Install the module from the PowerShell Gallery.

Install-Module -Name MeetupPS

Configure your connection

Follow the following steps to request a Oauth Key/Secret. Fortunately you only need to do this once.

Register a new Oauth Consumer on the Meetup API Oauth Consumer portal

  • Consumer Name Provide a name for your Oauth Consumer
  • Application Website Can be pretty much anything, here i used https://github.com/lazywinadmin/MeetupPS
  • Redirect URI Can be pretty much anything, here i used https://github.com/lazywinadmin/MeetupPS
  • Agree with terms

Meetup Register OAuth Consumer form

Once the Oauth Consumer is created, copy the Key and the Secret. This will be used to authenticate against the API

Meetup Your OAuth Consumers page showing the PowerShell consumer with its key, secret, website and redirect URI

Connecting to the Meetup.com API

# Connect against Meetup.com API
$Key = '<Your Oauth Consumer Key>'
$Secret = '<Your Oauth Consumer Secret>'
Set-MeetupConfiguration -ClientID $Key -Secret $Secret

PowerShell window setting $Key and $Secret, then running Set-MeetupConfiguration -ClientID $Key -Secret $Secret

Note: This will leverage two private functions of the module:

  • Get-OauthCode
  • Get-OauthAccessToken

This will then prompt you to connect to Meetup.

Meetup log-in page asking to log in and grant access

Get Group information

Retrieve a Meetup group information

Get-MeetupGroup -Groupname FrenchPSUG

Get-MeetupGroup -GroupName FrenchPSUG output in PowerShell: the French PowerShell User Group id, name, status, link and description

Get Events information

Upcoming events

Retrieve upcoming event(s) for a Meetup group

Get-MeetupEvent -Groupname FrenchPSUG -status upcoming

Past events

Retrieve past event(s) for a Meetup group

Get-MeetupEvent -GroupName FrenchPSUG -status past -page 2

Get-MeetupEvent -GroupName FrenchPSUG -Status past -page 2 output in PowerShell, showing the properties of a past event

Get-MeetupEvent -GroupName FrenchPSUG -status past |
Format-List -property Name,local_date,link, yes_rsvp_count

Get-MeetupEvent output piped to Format-List in PowerShell, showing the name, local_date, link and yes_rsvp_count of past events

Create Event

New-MeetupEvent `
    -GroupName FrenchPSUG `
    -Title 'New Event from MeetupPS' `
    -Time '2018/06/01 3:00pm' `
    -Description "PowerShell WorkShop<br><br>In this session we'll talk about ..." `
    -PublishStatus draft

New-MeetupEvent running in PowerShell to create a draft event, followed by the properties of the created event

Here is the event created in Meetup

Meetup group page, Drafts tab, showing the draft event New Event from MeetupPS

API permission scopes

The API permission scopes are set when the authentication occur in Get-OAuthAccessToken.

Currently it is requesting the following permission scopes: basic,reporting, event_management

More permission scopes are available here: https://www.meetup.com/meetup_api/auth/#oauth2-scopes

scope permission
ageless Replaces the one hour expiry time from oauth2 tokens with a limit of up to two weeks
basic Access to basic Meetup group info and creating and editing Events and RSVP’s, posting photos in version 2 API’s and below
event_management Allows the authorized application to create and make modifications to events in your Meetup groups on your behalf
group_edit Allows the authorized application to edit the settings of groups you organize on your behalf
group_content_edit Allows the authorized application to create, modify and delete group content on your behalf
group_join Allows the authorized application to join new Meetup groups on your behalf
messaging Enables Member to Member messaging (this is now deprecated)
profile_edit Allows the authorized application to edit your profile information on your behalf
reporting Allows the authorized application to block and unblock other members and submit abuse reports on your behalf
rsvp Allows the authorized application to RSVP you to events on your behalf

You can take a look a the header passed to the API here:

$Headers = @{
    'X-OAuth-Scopes'          = "basic", "reporting", "event_management"
    'X-Accepted-OAuth-Scopes' = "basic", "reporting", "event_management"
}

See this line: Header of Get-OauthAccessToken

Resources

Leave a comment