ChatsService lets you interact with iMessage chats at every level — from creating new conversations and managing group membership to controlling read state and presence indicators. Many operations that modify chat state (such as creating a chat, updating its name, or adding participants) require the Private API to be enabled on your BlueBubbles Server.
Access the service via your initialized client:
Chat metadata
getChatCount()
Get the total number of chats stored in your iMessage account on the server device.
get()
Fetch a chat’s database record and icon by its GUID. For group chats, this also returns the group icon if one has been set since the macOS host was first set up.
The GUID of the chat to fetch, e.g.
"iMessage;+;+15550001234".list()
Query chats from the database with optional filtering, related data, pagination, and sorting.
Maximum number of chats to return. Defaults to
1000.Number of records to skip for pagination. Defaults to
0.Related data to include in results. Accepted values:
"participants", "lastMessage", "sms", "archived", "message.attributed-body", "message.message-info-summary", "message.payload-data".Sort results by last message time. Must be
"lastmessage". Requires "lastMessage" to also be included in with.Creating and modifying chats
create()
Create a new iMessage chat. Requires the Private API and a minimum BlueBubbles Server version of 0.3.0.
A list of participant addresses (phone numbers or email addresses) to include in the new chat.
An optional initial message to send into the newly created chat.
updateAChat()
Update an existing group chat’s display name. Requires the Private API.
The GUID of the chat to update.
A new display name for the group chat.
deleteChat()
Delete a chat from the iMessage client on the macOS server. This change only affects the macOS server’s iMessage client — it does not propagate to other Apple devices on the account.
The GUID of the chat to delete.
Group icon
setGroupIcon()
Set a group chat’s icon or photo. Requires the Private API.
The GUID of the group chat to update the icon for.
Multipart form data containing the image file to set as the group icon.
removeGroupIcon()
Remove or unset the icon for a group chat. Requires the Private API.
The GUID of the group chat to remove the icon from.
Participants
addParticipantToChat()
Add a participant to an existing group chat. Include the country code in the address where possible. Requires the Private API.
The GUID of the chat to add the participant to.
The phone number or email address of the participant to add. Include the country code prefix (e.g.
"+15550001234" for a US number).removeParticipantFromChat()
Remove a participant from an existing group chat. Requires the Private API.
The GUID of the chat to remove a participant from.
The participant address to remove is specified in the request body as
address. Requires the Private API (minimum server version 0.3.0).leaveChat()
Leave a group chat you are currently a member of. Throws an error if the target chat is not a group chat. Requires the Private API.
The GUID of the group chat to leave.
Messages in a chat
listMessages()
Fetch all messages associated with a specific chat.
The GUID of the chat whose messages you want to retrieve.
Read state
markRead()
Mark a chat as read on the server. Dispatches a read event to all connected BlueBubbles clients. Requires the Private API.
The GUID of the chat to mark as read.
markChatAsUnread()
Mark a chat as unread and dispatch an unread event to all connected BlueBubbles clients. On macOS Ventura, this also officially marks the chat as unread for other iOS devices. Requires the Private API and macOS Ventura.
The GUID of the chat to mark as unread.
If you are not running macOS Ventura, the event is still dispatched to BlueBubbles clients but the chat will not be marked as unread for other iOS devices. Requires the Private API and a minimum server version of 1.4.0.
Typing indicators
startSendTypingIndicator()
Start broadcasting a typing indicator to the participants of a chat. Requires the Private API.
The GUID of the chat to send the typing indicator to.
Typing indicators stop automatically when you send a message to the chat. Requires the Private API.
stopSendTypingIndicator()
Stop broadcasting a typing indicator to a chat. Requires the Private API.
The GUID of the chat to stop sending the typing indicator to.
Typing indicators also stop automatically when you send any message to the chat. Requires the Private API.
Contact sharing
shareContactInfo()
Share your iCloud Contact Card with a chat. This sends your own contact information to the other participants.
The GUID of the chat to share your contact info with.
getContactShareStatus()
Check the current contact-sharing status for a chat.
The GUID of the chat to check contact share status for.