Manage groups
Learn how to manage LinkedIn groups using Unipile API.
Provider limitationsGroup messaging features are not available on Recruiter, Sales navigator and Company pages.
Manage group members
List members
To list all members of a group chat, use the List all Chat Participants endpoint, specifying the chat ID.
const { data } = await messagingApi.getParticipantsList({
path: {
account_id: "acc_123456789",
chat_id: "chat_id",
},
query: {
limit: 20,
},
});participants = messaging_api.get_participants_list(
"chat_id",
"acc_123456789",
limit=20,
)curl --request GET \
--url https://api.unipile.com/v2/account_id/chats/chat_id/participants \
--header 'accept: application/json'Add a new member
To add a member to a group chat, use the Add a Chat Participant endpoint, specifying the chat ID and the ID of the user to be added.
await messagingApi.addParticipant({
path: {
account_id: "acc_123456789",
chat_id: "chat_id",
},
body: {
user_id: 'ACoA1B2C3D4E5F6g7Hi8J9K1L2m3NOpqRSTUvWxYZ',
},
});messaging_api.add_participant(
"chat_id",
"acc_123456789",
{"user_id": "ACoA1B2C3D4E5F6g7Hi8J9K1L2m3NOpqRSTUvWxYZ"},
)curl --request POST \
--url https://api.unipile.com/v2/account_id/chats/chat_id/participants \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"user_id": "[email protected]"
}
'Remove a member
To remove a member from a group, use the Remove a Chat Participant endpoint, specifying the chat ID and the ID of the user to be removed.
await messagingApi.removeParticipant({
path: {
account_id: "acc_123456789",
chat_id: "chat_id",
user_id: "ACoA1B2C3D4E5F6g7Hi8J9K1L2m3NOpqRSTUvWxYZ",
},
});messaging_api.remove_participant(
"chat_id",
"ACoA1B2C3D4E5F6g7Hi8J9K1L2m3NOpqRSTUvWxYZ",
"acc_123456789",
)curl --request DELETE \
--url https://api.unipile.com/v2/account_id/chats/chat_id/participants/334455667788%40s.whatsapp.net \
--header 'accept: application/json'Leave a group
To leave a group, use the Remove a Chat Participant endpoint, specifying the user ID of the account owner.
const account = await accountsApi.getAccount({
path: {
account_id: "acc_123456789",
},
});
const selfUserId = account.data?.user_id;
if (selfUserId) {
await messagingApi.removeParticipant({
path: {
account_id: "acc_123456789",
chat_id: "chat_id",
user_id: selfUserId,
},
});
}account = accounts_api.get_account("acc_123456789")
self_user_id = account.user_id
if self_user_id:
messaging_api.remove_participant(
"chat_id",
self_user_id,
"acc_123456789",
)
Note about groups you leftWhen the account owner leaves a group, the
read_onlyproperty is set totrueon the Chat object. The chat will remain in the chat list, and its messages can still be retrieved.If the owner selects Delete conversation from the LinkedIn app after leaving, the chat and its messages will be removed entirely and will no longer appear in API results.
Update group name
To change the name of a group, use the Update a Chat endpoint, specifying the ID of the chat and the updated name.
await messagingApi.updateChat({
path: {
account_id: "acc_123456789",
chat_id: "chat_id",
},
body: {
name: 'Updated Chat Name',
},
});messaging_api.update_chat(
"chat_id",
"acc_123456789",
{"name": "Updated Chat Name"},
)Updated 3 months ago