Add User to Group
This service task assigns a user to an existing group.
Benefit: Processes can automate organizational changes — add new employees to their team during onboarding, assign users to project groups dynamically, or manage role-based access through group memberships.
How it works
Given a user ID (userSub) and a group ID (groupId), this service task creates the group assignment in the database. An optional display name can be provided for the membership entry.
If the user is already a member of the group, the assignment is overwritten (idempotent).
Input Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
userSub |
String | Yes | The Cognito user sub (unique user ID) of the user to assign. |
groupId |
String | Yes | The ID of the group to add the user to. |
displayName |
String | No | A display name for the membership entry (e.g. the user's full name). |
Example Input
{
"userSub": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"groupId": "sales",
"displayName": "Max Mustermann"
}
Output
| Field | Type | Description |
|---|---|---|
success |
Boolean | true if the assignment was created. |
userSub |
String | The user ID. |
groupId |
String | The group ID. |
displayName |
String | The display name stored with the assignment. |
Example Output
{
"success": true,
"userSub": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"groupId": "sales",
"displayName": "Max Mustermann"
}
Use Cases
- Employee onboarding: Automatically add new hires to their department and project groups.
- Project staffing: Assign users to project-specific groups when a project starts.
- Role rotation: Move users between groups based on scheduling or workflow logic.
- Self-service requests: Let users request group membership through a process with approval steps.
Notes
- The group must already exist. Use the administration UI to create groups, or List All Groups to verify availability.
- If the user is already in the group, the operation succeeds without error (idempotent overwrite).
- This task manages Pantarey user groups, not Cognito groups. The assignment is stored in DynamoDB.