Guestlist in remote working spaces

Hello,

a while ago @mel and I were wondering how to set up Guestlists in remote working spaces ORIGINAL THREAD. Sadly, this has been so far not been answered from anyone. Therefore I kindly want to ask again how to properly use this function in remote working spaces. Is it even possible to set the Guestlist (e.g. via HTTP API) for Members and Guests in RW-Spaces?

Im looking forward to receive ANY answer.

Best wishes,

Kilian

Just to be specific, when you say “Guestslist”, you are also interested in setting a user as a member, and not just limiting access to the space.

That definition accepted, there is a way to set the members of a space. I am going to make a few assumptions:

  1. You have a list of emails of users.
  2. Each user has already signed up for a Gather account.
  3. You do not have access to the user UIDs.

With that in mind, you will need to make 2 API calls. Note that at least one of these API calls has a strict rate limit, which will largely prevent large-scale importing.

Step 1: Get the user uid.
API Call: GET https://api.gather.town/api/v2/user-id?email=example@email.com
Returns: {"userId": "ExAmPlEuSeRiD"}

Step 2: Setting user permissions.
API Call: PUT https://api.gather.town/api/v2/spaces/:spaceid/user/:userid/roles
Variables: spaceid: firsthalf%40secondhalf | userid: ExAmPlEuSeRiD
Headers: {apikey:YOURAPIHERE}
Body: {"roles":["GENERAL_MEMBER"]}
Returns: {"id": "ExAmPlEuSeRiD", "roles": [ "GENERAL_MEMBER" ], "name": "Example", "email": "example@email.com"}

With these completed, the user whose email was used (example@email.com) will have been added to the space app.gather.town/app/firsthalf/secondhalf as a Member. “OWNER” and “DEFAULT_BUILDER” are also valid roles to include in the body to add the Admin and Builder roles, respectively.

Note on rate limits: The user-ids endpoint is limited to something like 25 requests/5 minutes.

I’ve posted in the discord a method for using axios for these types of HTTP API endpoints in TS, and I will be adding examples of this to the gt-helper builder in the future.

2 Likes

thanks Bill! and sorry for the delay @KiliZ

I should say - this isn’t officially part of the API, so we aren’t as careful about avoiding breaking changes, but it’s been stable for the last few months at least. just don’t depend on it too heavily :see_no_evil:

1 Like

Hi everyone,

just checking in to learn if this is still available or if this has been changed somehow?

Im doing this:

Method: Put
URL: https://api.gather.town/api/v2/spaces/firstHalfe\secondHalfe/users/uSeRId-StRinG/roles
Body (raw): {“email":"example@email.com”,“role”:“GENERAL_MEMBER”}
Headers: apiKey
Returns (403): {
“error”: “AUTHORIZATION”,
“message”: “The role you are trying to set is invalid.”
}

I think its “MEMBER”, not “GENERAL_MEMBER”. This is since the last roles change.

1 Like