The API is included on the Business plan. See plans.
Role members are the members of a group who hold one role. Updating role members through the API keeps role membership in step with your own system, without an admin doing it by hand. Role members are identified by Heylo user ID, the same IDs that key an event attendance response.
Operations
- Fetch role members:
POST https://api.heylo.com/apiv1-fetchwithtypeset to"roleMembers" - Update role members:
POST https://api.heylo.com/apiv1-updatewithtypeset to"roleMembers"
Fetch role members
Returns the members who hold one role.
POST https://api.heylo.com/apiv1-fetch
Parameters
communityId(string, required): the group ID.type(string, required):"roleMembers".
Returns
memberUserIds(array): the Heylo user IDs of the members who hold the role. A role nobody holds returns an empty list.
curl -X POST https://api.heylo.com/apiv1-fetch \
-H "Authorization: Bearer HEYLO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"communityId": "HEYLO_GROUP_ID",
"roleId": "HEYLO_ROLE_ID",
"type": "roleMembers"
}'
{"memberUserIds": ["HEYLO_USER_ID_1", "HEYLO_USER_ID_2"]}
Update role members
Adds and removes members from a role in one request. Role member updates do not need write access on the key.
POST https://api.heylo.com/apiv1-update
Parameters
communityId(string, required): the group ID.roleId(string, required): the role'sid.type(string, required):"roleMembers".addedUserIds(array, optional): the Heylo user IDs to give the role, up to 100 per request.removedUserIds(array, optional): the Heylo user IDs to take the role from, up to 100 per request.
Send at least one of addedUserIds or removedUserIds. IDs that do not belong to a current member of the group are skipped without an error. An ID in both lists is removed from the role.
Returns
addedUserIds(array): the IDs that were given the role.removedUserIds(array): the IDs the role was taken from.
An ID missing from the response was skipped because it is not a current member. A member who already had the role, or never had it, still appears in the response.
curl -X POST https://api.heylo.com/apiv1-update \
-H "Authorization: Bearer HEYLO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"addedUserIds": ["HEYLO_USER_ID_1"],
"communityId": "HEYLO_GROUP_ID",
"removedUserIds": ["HEYLO_USER_ID_2"],
"roleId": "HEYLO_ROLE_ID",
"type": "roleMembers"
}'
{"addedUserIds": ["HEYLO_USER_ID_1"], "removedUserIds": ["HEYLO_USER_ID_2"]}
Errors for role members
Role member operations return the standard errors, with these cases:
404: the role does not exist in this group.400:addedUserIdsorremovedUserIdsholds more than 100 IDs, or both are empty.403: the role belongs to an organization, and this group is not part of that organization.