groupme-js / GroupMeCommunityDocs

21 stars 8 forks source link

Document `/groups/:group_id/members` endpoint #9

Open not-so-smart opened 2 years ago

not-so-smart commented 2 years ago

There's an endpoint for getting members which isn't covered in the official docs.

This endpoint can be used for fetching active or former members.

There's a required filter parameter used to specify what type of members to fetch.

More details in the comments as they become available.

not-so-smart commented 2 years ago

GET /v3/groups/27317261/members?filter=active (fetches current members) GET /v3/groups/27317261/members?filter=inactive (fetches former members)

the filter parameter is required, and I haven't been able to find any valid values for it besides active and inactive

the response includes an array of members similar to Group.members from the /groups endpoint, except that each member has a state property describing the status of their membership

when filter=active, each member's state is always active when filter=inactive, each member's state is either exited, removed, or exited_removed

here's an example response where filter=inactive:

"memberships": [
  {
    "id": "645845814",          // member.ID
    "user_id": "442913",        // user.ID
    "name": "Bryan Warman",     // user.name
    "nickname": "Bryan Warman", // member.nickname
    "image_url": "https://i.groupme.com/1024x1024.jpeg.6c163c9f58614f9686d0bdbf33846469", // user.avatar? (optional)
    "autokicked": true,         // member.autokicked? (optional)
    "muted": true,              // member.muted? (optional) 
    "roles": [                  // member.roles
      "user" // (For former users, this is always "user")
    ],
    "state": "exited" // (For current users, this is always "active")
  },
  // ... more members ...
]
not-so-smart commented 2 years ago

note: if a current member has the muted and/or autokicked properties set, they will be carried over when the user leaves or is removed.

not-so-smart commented 2 years ago

for some reason, there's some level of permission required for using the /members endpoint

In a closed group, you can't call /members at all without admin (neither active nor inactive can be fetched this way) but you can still get a list of active members from the /groups endpoint