I was able to add users to specific spaces based on bubble data conditions by utilizing the circle API.
Here is the API doc: https://api.circle.so/
Here are the steps I took:
-
Create an API key in circle. Create a new API in the bubble API connector plugin and add this as a Shared Header for all Calls parameter titled “Authorization” and paste your key as [Token “your key”]
-
Run the Community Index call to get your community ID (needed for all other calls) write this ID down.
It is a GET call with the following url: {{host}}/api/v1/communities
Note that {{host}} should be your circle return URI. For my it is https://community.”my domain”.com since I set up a custom domain.
- Run the API Space Index call to get the IDs for all of your spaces.
It is a GET call with the following url: {{host}}/api/v1/spaces?community_id={{REPLACE THIS WITH YOUR COMMUNINTY ID FROM STEP 2}} (don’t keep the {{}} either)
For the closed spaces, write down the IDs and you will use them later to add members. I find it best to click the “Show raw data” button at the bottom of the results when you first initialize the call to have a nice text to copy and save in Word.
Set any spaces that you want to be open to all users as automatically joined in your Circle settings. No need to add members to these spaces via the API.
- Set up the Add Member to Space call as an “action”
This is a POST call with the following URL: {{host}}/api/v1/space_members
add the following parameters:
email (use any Circle member email for initializing) UNCHECK private.
space_id (pick any of your spaces IDs for initializing) UNCHECK private.
community_id (set to your community ID from step 2 and leave it as private)
This is the action you will use to add members to specific spaces. It will appear in your Bubble workflows since it is an “action” and you can set the email and space_id dynamically because you unchecked the “private” button.
There are a few other useful calls. I am setting members tags via the API. I am also inviting members upon sign up via the API so that I automatically have their names and emails (no need for another Circle sign up). I thought this was done automatically via SSO, but it isn’t.
I hope this helps!
1 Like