Remove User from Group
This service task removes a user from a specific group.
Benefit: Processes can automate organizational cleanup — remove departing employees from their teams, revoke project access when a phase ends, or manage temporary group memberships with automatic expiry.
How it works
Given a user ID (userSub) and a group ID (groupId), this service task deletes the group assignment from the database.
If the user is not a member of the group, the operation completes without error (idempotent).
Input Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
userSub |
String | Yes | The Cognito user sub (unique user ID) of the user to remove. |
groupId |
String | Yes | The ID of the group to remove the user from. |
Example Input
{
"userSub": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"groupId": "sales"
}
Output
| Field | Type | Description |
|---|---|---|
success |
Boolean | true if the operation completed. |
userSub |
String | The user ID. |
groupId |
String | The group ID. |
Example Output
{
"success": true,
"userSub": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"groupId": "sales"
}
Use Cases
- Employee offboarding: Automatically remove departing users from all their groups.
- Project completion: Remove all project members from the project group when a project ends.
- Temporary access: Grant time-limited group membership and remove it via a scheduled process.
- Role changes: When an employee changes departments, remove them from the old group (and add to the new one).
Notes
- If the user is not a member of the group, the operation succeeds without error (idempotent).
- This does not delete the group itself — only the user's membership.
- Combine with Add User to Group for complete group membership management within processes.
- Combine with Get User Groups to first check which groups a user belongs to before removing.