-
-
Save johnytiago/4c0ca110e48e9a2ffbe25add90edf737 to your computer and use it in GitHub Desktop.
Pick a random require-lx attendee for prize winner
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const request = require('request') | |
const MEETUP_API_KEY = require('./key') | |
let options = { | |
url: 'https://api.meetup.com/require-lx/events/236789439/rsvps', | |
qs: { | |
sign: "true", | |
key: MEETUP_API_KEY | |
} | |
} | |
request( options, (err, res, body ) => { | |
if (err) | |
throw err; | |
try { | |
let parsedData = JSON.parse(body) | |
let rand = Math.floor(Math.random() * parsedData.length) | |
let id = parsedData[rand].member.id | |
console.log(`https://www.meetup.com/require-lx/members/${id}`) | |
} catch (e) { | |
console.log(e.message) | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment