Adding and Removing Members Automatically
Add each new customer to your App the moment they buy or enroll, and remove their access when they cancel, from your checkout, CRM or automation tool.
Let Your Other Tools Add Members for You
If you sell or enroll people outside ThoughtFlow, your checkout, CRM or automation tool can add each new customer to your App on its own. When something happens there, such as a purchase, a tag or a form submission, it sends a short request to your App, and your App adds that person to the Access Groups you chose. When someone cancels or is refunded, a second request takes a group away. Nobody has to remember to add or remove anyone, and access starts right away.
This page walks through the setup. For every field, response and error, see the Member Management API Reference.
For step-by-step setup in a specific tool, see Adding Members Automatically With Seamlessly or Adding Members Automatically With Zapier.
Before You Start
- Your other tool can send a custom web request. Look for an action called something like Webhook, Custom Webhook or Custom Request, where you can set the method, URL, headers and body.
- You're an App Admin. Only App Admins can create API keys.
- Your Access Groups exist. Each request names the groups to add or remove. See Access Groups.
Create an API Key
Generate a key
Go to App Settings > API Keys and click Generate Key. Give it a name that says where it's used, such as the name of your checkout. Leave Access Management checked and click Generate Key.
Copy it now
Click Copy Key and paste the key somewhere safe. It's shown only once. Check "I have copied this key. I understand it will not be shown again." and click Done.
Anyone with your key can add and remove people in your App. Use one key for each tool that connects, so you can revoke one without breaking the others. See API Keys.
Set Up the Add
Start the automation
In your other tool, create an automation that starts when someone should get access, such as a purchase, a tag added or a form submitted. Add its custom web request action.
Build the request in the Snippet Generator
On the API Keys page, scroll to Snippet Generator. Choose Add to Access Group in Action, and the tool you'll paste into in Platform. Leave Role on Member. Leave Reference By on Group ID, then check the groups the person should get under Access Groups.
Copy each value into your other tool
Each card has its own Copy buttons. Paste them into the matching settings of your request:
Method: POST
URL: https://app.thoughtflow.ai/api/v1/access/grant
Header 1: Authorization: Bearer YOUR_API_KEY
Header 2: Content-Type: application/json
The body names the person and the group:
{
"email": "PERSON_EMAIL",
"access_group_id": "GROUP_ID"
}
In your snippet, the group ID is already filled in.
Replace the placeholders
Replace These Before You Paste lists the highlighted values to change:
- YOUR_API_KEY: paste the key you copied. Keep the word Bearer and the space before it.
- PERSON_EMAIL: insert the buyer's email from your other tool's trigger. For some platforms, the snippet already uses the platform's own email field instead, and there's nothing to replace.
Follow any note shown under a card. For one platform it names a setting to change, or the request fails.
Save and turn it on
Save the action and turn the automation on.
New people get an invitation email from your App, and people who already have an account are added without one. If your other tool sends its own welcome, add "send_invitation": false to the body so your App doesn't send one too.
Set Up the Removal
Build a second automation the same way, with two changes:
- The trigger is whatever ends access, such as a cancellation, a refund or a tag removed.
- The action in the Snippet Generator is Remove from Access Group. It makes one card for each group you check, because each request removes one group.
The removal request goes to https://app.thoughtflow.ai/api/v1/access/revoke with the same headers and the same kind of body.
Removing a group doesn't remove the person from your App. They can still sign in, but they lose what that group gave them. Open tools stay available, and other groups they belong to still give them access. Everything they created stays, and they can still find it in Activity.
Test It
Run the add
Trigger the add automation with your own email and a test Access Group.
Check the Members page
Click Members in the top navigation. Find yourself and click your name to see your Access Groups in View Details.
Run the removal
Trigger the removal automation, then check that the group is gone.
On the API Keys page, Last Used shows when each key last made a call. If an automation stops working, check there first.
Good to Know
- Changes take effect right away.
- Sending the same request twice is safe. Nothing doubles up, and a person already in your App doesn't get a second invitation.
- New people join as Members unless the request sends a role. A role never changes the role of someone already in your App.
- Former Members come back. Adding someone who was deactivated restores them with the role they had before. Their old groups aren't restored, so the request should name every group they need.
- Group IDs keep working after a rename. You can name groups by Group Name instead, but an automation that uses a name stops working if you rename the group.
- Your App can't receive webhooks. Your other tool calls your App's API; there's no address in ThoughtFlow for other tools to post to.
The same API can also look up Members, list them, change roles and groups, deactivate Members, and handle up to 100 people in one request. See the Member Management API Reference.
Troubleshooting
| Problem | What to check |
|---|---|
401 unauthorized | The key is missing, wrong or revoked. The Authorization header must read Bearer, a space, then your key. |
404 access_group_not_found | No group matches that ID or name. Copy the ID again, or check whether the group was renamed. |
404 user_not_found | On a removal: no one with that email is in your App. |
400 bad_request | A field is missing or not valid. The message names it, such as "email is required." |
| 429 | Too many requests or invitations, or the email service is busy. Wait the number of seconds the response gives, or a few minutes if it gives none, then send it again. |
| Someone didn't get an invitation. | Ask them to check spam. Then check whether the request sent "send_invitation": false. |
| Someone was added but can't use anything. | Check their Access Groups on the Members page. Their access may also have expired. |