Skip to content

Instantly share code, notes, and snippets.

@mrchrisadams
Last active December 17, 2015 13:49
Show Gist options
  • Save mrchrisadams/5619892 to your computer and use it in GitHub Desktop.
Save mrchrisadams/5619892 to your computer and use it in GitHub Desktop.
How to get a spreadsheet/csv friendly list of 'yes' RSVPs using meetup.com
MEETUP_API_KEY=ICOULDTELLYOUBUTIWOULDHAVETOKILLYOU
EVENT_ID=SOMELONGNUMBER
# last night, I had to print out a CSV list 'yes' RSVPs for meetup.com.
# It turned out this wasn't a feature, and yet it's extremely handy.
# So here's a quick and dirty script to get a csv file in future
# ENV variables are assumed, to make it easy to turn into a hosted app
# just create a file called `.env`, and declare the ENV vars like the accompanying file for this gist
require 'pry'
require 'rest-client'
require 'json'
require 'csv'
require 'dotenv'
Dotenv.load
req = RestClient.get "https://api.meetup.com/2/rsvps", { params: {
key: ENV['MEETUP_API_KEY'],
event_id: ENV['EVENT_ID'],
format: "json",
rsvp: 'yes'
}
}
rsvps = JSON.parse req
# Not essential, but handy
csv_opts = { write_headers: true, headers: ['Name', 'Guests'] }
# Now, what we've been waiting for
CSV.open("confirmed_rsvps.csv", "wb", csv_opts) do |csv|
rsvps['results'].each do |r|
name = r['member']['name']
guests = r['guests']
csv << [name, guests]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment