Meetup API Event List
Questions answered by this recipe
How can I embed an event list from the Meetup API into PmWiki pages and format it with PmWiki markup?
The Meetup API provides a simple interface for accessing the Meetup platform from your own apps. With this recipe, you can include a list of upcoming Meetup events into your PmWiki pages (e.g. for a selected group), using the events method of Meetup API. See examples below for usage.
How to Install
- Download MeetupAPIEventList.zipΔ and unpack it in your PmWiki directory.
- In your local config, write the usual include code:
- Generate a signed URL for your Meetup API request (see below) and include it into your local config using the following code:
$MeetupURL = "Your_Signed_URL";
- Configure caching functionality
How to Obtain a Signed Meetup URL
- Visit http://www.meetup.com/meetup_api/console/?path=/2/events and sign in with your account
- Enter your data (usually group_urlname should be sufficient, e.g.
"nylug-meetings", but other criteria is possible too) and click "Show Response"
- Copy and paste signed URL (should be displayed right below the input form) into your local config as described above
Meetup API Troubleshooting
- Meetup user account required
- Check whether all required data is displayed below the input form
- Make sure that
format=jsonis part of the signed URL
- URL should look something like
If this looks too complicated, please check out the examples below! Most of them should work out of the box using copy and paste.
Meetup data is included with the markup
(:meetupinc Custom Variables and Formatting:)
Plain text and some basic PmWiki markup (like ''' for bold, [[<<]] for linebreaks and [[http://example.com/]] for hyperlinks) can be used.
To display Meetup data, use the following custom variables:
Limiting the Number of Results
(:meetupinc:) lists all events that were returned by the Meetup API query. You can limit the number of results with the
(:meetupparams:) directive which needs to be included before
(:meetupparams max=Maximum Number of Events Displayed:)
If you want to display only the next upcoming event, use:
Reset the maximum to unlimited with:
If you want to skip a certain number of events at the beginning of the list, use:
(:meetupparams min=Number of the First Event to be Displayed:)
In order to speed up the website and to avoid exceeding Meetup's API limit, this recipe writes Meetup data to cache (if possible). By default, cache is being updated every 10 minutes.
For caching to work properly, you need to create a folder named "meetupcache" in your main PmWiki directory which needs to be writable by www-data (or whatever user it is as which your web server runs).
You can change the location of the cache file by changing
$CacheFile = "meetupcache/meetup-cache.json"; to something else in meetupinc/meetuplib.php.
Cache duration can be modified in your local config file. If you want it to be 5 minutes instead of 10, simply add the line
$MeetupCacheLifetime = 300; to your config. This line needs to be included before
require_once " to work properly.
How to Include Multiple Groups
The events method of Meetup API allows you to include multiple groups with a single query. This can be done by using the field group_id in http://www.meetup.com/meetup_api/console/?path=/2/events.
If you know a certain group's URL name, you can determine its group id with http://www.meetup.com/meetup_api/console/?path=/2/groups (Meetup login required). Simply enter your group's urlname in the corresponding field (e.g.
"id" to the field named "only", hit "Show Response", and copy the id (e.g.
"2659922") from the gray area below.
In the field group_id in http://www.meetup.com/meetup_api/console/?path=/2/events, you can now combine multiple group ids separated by commas (e.g.
"2659922,1556336"). Then hit "Show Response" and obtain your signed Meetup URL. This can be included in your local config as described above.
List events of selected groups
(:meetupinc:) lists all events of all groups from the original API query in chronological order. You can use the (:meetupparams:) directive to limit the results to a selected group. It needs to be included before
List only events of the group with the id
2659922 (the option
groupflag=true could be omitted because it is default behavior):
(:meetupparams groupid=2659922 groupflag=true:)
Exclude events of the group with the id
2659922 while displaying all other events:
(:meetupparams groupid=2659922 groupflag=false:)
Display all events of all groups (reset to default) with:
Other Advanced Options
Display Events at Selected Venues
(:meetupinc:) lists all events at all the venues from the original API query. You can use the (:meetupparams:) directive to limit the results to a selected venue. It needs to be included before
List only events at the venue with the venue id
4957192 (the option
venueflag=true could be omitted because it is default behavior):
(:meetupparams venueid=4957192 venueflag=true:)
Exclude events at the venue with the id
(:meetupparams venueid=4957192 venueflag=false:)
Display all events at all venues (reset to default) with:
The following markup:
yields something like the following output:
List some more events with this markup:
Use the following markup to list all remaining events (e.g. in a separate Wiki page):
- Recipe now compatible with PHP 5.5
- Multiple groups functionality added
- Some refactoring of
meetupinc.php; faciliating the use of
meetuplib.phpoutside of PmWiki
- All PmWiki markup from v0.1 should work fine with this version
v0.1 (2013-06-15): Initial release