nashvillefcc / discord-bot

3 stars 0 forks source link

When an announcement is made on Meetup, the Discord bot sends an announcement to the appropriate channel with a link to the event #1

Closed tylermwatts closed 5 years ago

tylermwatts commented 5 years ago

There are (probably?) a few ways to go about this but I've found a way that works, though it's not the most streamlined solution.

First of all, here are the Meetup API Docs. The docs include a "Try it in the console" link for each type of request so that you can see what the structure of the returned payload will be.

When sending a GET request for upcoming events to Meetup's API, only event hosts/organizers within the freeCodeCamp-Nashville Meetup group have access to the "announced" property. However, when an event is announced, all members of the group will receive a notification of type event_announce so we can use the GET Meetup Notifications endpoint to check for event announcements.

const notifications = await fetch('https://api.meetup.com/notifications', {
      method: 'GET',
      headers: {
        Authorization: `Bearer ${YOUR_ACCESS_TOKEN}`
      }
    })
      .then(response => response.json())
      .catch(err => console.log(err));
tylermwatts commented 5 years ago

closed by #7