---
schema_version: "1"
id: 02091fd649945341ec5863a4ca6f98e93eb993bf49be0e7dbd7b5a1e6f552821
title: ChatterMessages Class
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexref/apex_ConnectAPI_ChatterMessages_static_methods.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_ChatterMessages_static_methods.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: fe7d7a235a6a276a973dfac307f1d05f8acb5bffff2455219bdd8ea5b7f9fd81
description: Get, send, search, and reply to private messages. You can also get and search private conversations, mark conversations as read, and get a count of unread private messages.These methods are for ChatterMessages. All methods are static.Get a conversation. Get a page of a conversation. Get a conversation from an Experience Cloud site.Get a page of a conversation from an Experience Cloud site.Get the most recent conversations.Get a page of conversations. Get the most recent conversations from an Experience Cloud site.Get a page of conversations from an Experience Cloud site.Get a message. Get a message from an Experience Cloud site.Get the most recent messages.Get a page of messages.Get the most recent messages from an Experience Cloud site.Get a page of messages from an Experience Cloud site.Get the number of conversations that are marked unread.Get the number of conversations that are marked unread in an Experience Cloud site.Mark a conversation as read or unread. Mark a conversation as read or unread in an Experience Cloud site.Reply to a message. Reply to a message in an Experience Cloud site.Get a conversation that matches the search criteria. Get a conversation with a page of messages that match the search criteria. Get a conversation with messages that match the search criteria in an Experience Cloud site.Get a conversation with a page of messages that match the search criteria in an Experience Cloud site.Get conversations in which member names and messages match the search criteria. Get a page of conversations in which member names and messages match the search criteria. Get conversations in which member names and messages match the search criteria in an Experience Cloud site.Get a page of conversations in which member names and messages match the search criteria in an Experience Cloud site.Get messages that match the search criteria. Get a page of messages that match the search criteria. Get messages that match the search criteria in an Experience Cloud site.Get a page of messages that match the search criteria in an Experience Cloud site.Send a message to a list of recipients. Send a message to a list of recipients in an Experience Cloud site.
---
# ChatterMessages Class

Get, send, search, and reply to private messages. You can also get and search private conversations, mark conversations as read, and get a count of unread private messages.

## Namespace

[ConnectApi](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_classes_connect_api.htm "The ConnectApi namespace (also called Connect in Apex) provides classes for accessing the same data available in Connect REST API. Use Connect in Apex to create custom experiences in Salesforce.")

## Usage

Private messages and direct messages are different features. Direct messages are newer and offer a richer feature set for private communication in Experience Cloud sites. Direct messages are a capability within Chatter feeds. To work with direct messages, use the [ChatterFeeds Class](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_ChatterFeeds_static_methods.htm#apex_ConnectAPI_ChatterFeeds_static_methods "Get, post, and delete feed elements, likes, comments, and bookmarks. You can also search feed elements, share feed elements, and vote on polls.").

## ChatterMessages Methods

These methods are for ChatterMessages. All methods are static.

All methods in this class require Chatter and are subject to the per user, per namespace, per hour rate limit.

- **[getConversation(conversationId)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_ChatterMessages_static_methods.htm#apex_ConnectAPI_ChatterMessages_getConversation)**  
    Get a conversation.
- **[getConversation(conversationId, pageParam, pageSize)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_ChatterMessages_static_methods.htm#apex_ConnectAPI_ChatterMessages_getConversation_2)**  
    Get a page of a conversation.
- **[getConversation(communityId, conversationId)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_ChatterMessages_static_methods.htm#apex_ConnectAPI_ChatterMessages_getConversation_3)**  
    Get a conversation from an Experience Cloud site.
- **[getConversation(communityId, conversationId, pageParam, pageSize)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_ChatterMessages_static_methods.htm#apex_ConnectAPI_ChatterMessages_getConversation_4)**  
    Get a page of a conversation from an Experience Cloud site.
- **[getConversations()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_ChatterMessages_static_methods.htm#apex_ConnectAPI_ChatterMessages_getConversations)**  
    Get the most recent conversations.
- **[getConversations(pageParam, pageSize)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_ChatterMessages_static_methods.htm#apex_ConnectAPI_ChatterMessages_getConversations_2)**  
    Get a page of conversations.
- **[getConversations(communityId)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_ChatterMessages_static_methods.htm#apex_ConnectAPI_ChatterMessages_getConversations_3)**  
    Get the most recent conversations from an Experience Cloud site.
- **[getConversations(communityId, pageParam, pageSize)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_ChatterMessages_static_methods.htm#apex_ConnectAPI_ChatterMessages_getConversations_4)**  
    Get a page of conversations from an Experience Cloud site.
- **[getMessage(messageId)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_ChatterMessages_static_methods.htm#apex_ConnectAPI_ChatterMessages_getMessage)**  
    Get a message.
- **[getMessage(communityId, messageId)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_ChatterMessages_static_methods.htm#apex_ConnectAPI_ChatterMessages_getMessage_2)**  
    Get a message from an Experience Cloud site.
- **[getMessages()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_ChatterMessages_static_methods.htm#apex_ConnectAPI_ChatterMessages_getMessages)**  
    Get the most recent messages.
- **[getMessages(pageParam, pageSize)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_ChatterMessages_static_methods.htm#apex_ConnectAPI_ChatterMessages_getMessages_2)**  
    Get a page of messages.
- **[getMessages(communityId)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_ChatterMessages_static_methods.htm#apex_ConnectAPI_ChatterMessages_getMessages_3)**  
    Get the most recent messages from an Experience Cloud site.
- **[getMessages(communityId, pageParam, pageSize)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_ChatterMessages_static_methods.htm#apex_ConnectAPI_ChatterMessages_getMessages_4)**  
    Get a page of messages from an Experience Cloud site.
- **[getUnreadCount()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_ChatterMessages_static_methods.htm#apex_ConnectAPI_ChatterMessages_getUnreadCount)**  
    Get the number of conversations that are marked unread.
- **[getUnreadCount(communityId)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_ChatterMessages_static_methods.htm#apex_ConnectAPI_ChatterMessages_getUnreadCount_2)**  
    Get the number of conversations that are marked unread in an Experience Cloud site.
- **[markConversationRead(conversationId, read)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_ChatterMessages_static_methods.htm#apex_ConnectAPI_ChatterMessages_markConversationRead)**  
    Mark a conversation as read or unread.
- **[markConversationRead(communityId, conversationID, read)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_ChatterMessages_static_methods.htm#apex_ConnectAPI_ChatterMessages_markConversationRead_2)**  
    Mark a conversation as read or unread in an Experience Cloud site.
- **[replyToMessage(text, inReplyTo)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_ChatterMessages_static_methods.htm#apex_ConnectAPI_ChatterMessages_replyToMessage)**  
    Reply to a message.
- **[replyToMessage(communityId, text, inReplyTo)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_ChatterMessages_static_methods.htm#apex_ConnectAPI_ChatterMessages_replyToMessage_2)**  
    Reply to a message in an Experience Cloud site.
- **[searchConversation(conversationId, q)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_ChatterMessages_static_methods.htm#apex_ConnectAPI_ChatterMessages_searchConversation)**  
    Get a conversation that matches the search criteria.
- **[searchConversation(conversationId, pageParam, pageSize, q)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_ChatterMessages_static_methods.htm#apex_ConnectAPI_ChatterMessages_searchConversation_2)**  
    Get a conversation with a page of messages that match the search criteria.
- **[searchConversation(communityId, conversationId, q)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_ChatterMessages_static_methods.htm#apex_ConnectAPI_ChatterMessages_searchConversation_3)**  
    Get a conversation with messages that match the search criteria in an Experience Cloud site.
- **[searchConversation(communityId, conversationId, pageParam, pageSize, q)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_ChatterMessages_static_methods.htm#apex_ConnectAPI_ChatterMessages_searchConversation_4)**  
    Get a conversation with a page of messages that match the search criteria in an Experience Cloud site.
- **[searchConversations(q)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_ChatterMessages_static_methods.htm#apex_ConnectAPI_ChatterMessages_searchConversations)**  
    Get conversations in which member names and messages match the search criteria.
- **[searchConversations(pageParam, pageSize, q)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_ChatterMessages_static_methods.htm#apex_ConnectAPI_ChatterMessages_searchConversations_2)**  
    Get a page of conversations in which member names and messages match the search criteria.
- **[searchConversations(communityId, q)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_ChatterMessages_static_methods.htm#apex_ConnectAPI_ChatterMessages_searchConversations_3)**  
    Get conversations in which member names and messages match the search criteria in an Experience Cloud site.
- **[searchConversations(communityId, pageParam, pageSize, q)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_ChatterMessages_static_methods.htm#apex_ConnectAPI_ChatterMessages_searchConversations_4)**  
    Get a page of conversations in which member names and messages match the search criteria in an Experience Cloud site.
- **[searchMessages(q)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_ChatterMessages_static_methods.htm#apex_ConnectAPI_ChatterMessages_searchMessages)**  
    Get messages that match the search criteria.
- **[searchMessages(pageParam, pageSize, q)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_ChatterMessages_static_methods.htm#apex_ConnectAPI_ChatterMessages_searchMessages_2)**  
    Get a page of messages that match the search criteria.
- **[searchMessages(communityId, q)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_ChatterMessages_static_methods.htm#apex_ConnectAPI_ChatterMessages_searchMessages_3)**  
    Get messages that match the search criteria in an Experience Cloud site.
- **[searchMessages(communityId, pageParam, pageSize, q)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_ChatterMessages_static_methods.htm#apex_ConnectAPI_ChatterMessages_searchMessages_4)**  
    Get a page of messages that match the search criteria in an Experience Cloud site.
- **[sendMessage(text, recipients)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_ChatterMessages_static_methods.htm#apex_ConnectAPI_ChatterMessages_sendMessage)**  
    Send a message to a list of recipients.
- **[sendMessage(communityId, text, recipients)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_ChatterMessages_static_methods.htm#apex_ConnectAPI_ChatterMessages_sendMessage_2)**  
    Send a message to a list of recipients in an Experience Cloud site.

### getConversation(conversationId)

Get a conversation.

#### API Version

29.0

#### Requires Chatter

Yes

#### Signature

public static ConnectApi.ChatterConversation getConversation(String conversationId)

#### Parameters

conversationId

Type: String

ID for the conversation.

#### Return Value

Type: [ConnectApi.​Chatter​Conversation](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_ChatterConversation.htm "Chatter conversation.")

### getConversation(conversationId, pageParam, pageSize)

Get a page of a conversation.

#### API Version

29.0

#### Requires Chatter

Yes

#### Signature

public static ConnectApi.ChatterConversation getConversation(String conversationId, String pageParam, Integer pageSize)

#### Parameters

conversationId

Type: String

ID for the conversation.

pageParam

Type: String

Specifies the page token to use to view a page of information. Page tokens are returned as part of the response class, such as currentPageToken or nextPageToken. If you pass in null, the first page is returned.

pageSize

Type: Integer

Specifies the number of items per page. Valid values are from 1 through 100. If you pass in null, the default size is 25.

#### Return Value

Type: [ConnectApi.​Chatter​Conversation](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_ChatterConversation.htm "Chatter conversation.")

### getConversation(communityId, conversationId)

Get a conversation from an Experience Cloud site.

#### API Version

30.0

#### Requires Chatter

Yes

#### Signature

public static ConnectApi.ChatterConversation getConversation(String communityId, String conversationId)

#### Parameters

communityId

Type:String

ID for an Experience Cloud site, internal, or null.

conversationId

Type: String

ID for the conversation.

#### Return Value

Type: [ConnectApi.​Chatter​Conversation](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_ChatterConversation.htm "Chatter conversation.")

### getConversation(communityId, conversationId, pageParam, pageSize)

Get a page of a conversation from an Experience Cloud site.

#### API Version

30.0

#### Requires Chatter

Yes

#### Signature

public static ConnectApi.ChatterConversation getConversation(String communityId, String conversationId, String pageParam, String pageSize)

#### Parameters

communityId

Type:String

ID for an Experience Cloud site, internal, or null.

conversationId

Type: String

ID for the conversation.

pageParam

Type:String

Specifies the page token to use to view a page of information. Page tokens are returned as part of the response class, such as currentPageToken or nextPageToken. If you pass in null, the first page is returned.

pageSize

Type: Integer

Specifies the number of items per page. Valid values are from 1 through 100. If you pass in null, the default size is 25.

#### Return Value

Type: [ConnectApi.​Chatter​Conversation](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_ChatterConversation.htm "Chatter conversation.")

### getConversations()

Get the most recent conversations.

#### API Version

29.0

#### Requires Chatter

Yes

#### Signature

public static ConnectApi.ChatterConversationPage getConversations()

#### Return Value

Type: [ConnectApi.​Chatter​ConversationPage](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_ChatterConversationPage.htm "Chatter conversation page.")

### getConversations(pageParam, pageSize)

Get a page of conversations.

#### API Version

29.0

#### Requires Chatter

Yes

#### Signature

public static ConnectApi.ChatterConversationPage getConversations(String pageParam, Integer pageSize)

#### Parameters

pageParam

Type: String

Specifies the page token to use to view a page of information. Page tokens are returned as part of the response class, such as currentPageToken or nextPageToken. If you pass in null, the first page is returned.

pageSize

Type: Integer

Specifies the number of items per page. Valid values are from 1 through 100. If you pass in null, the default size is 25.

#### Return Value

Type: [ConnectApi.​Chatter​ConversationPage](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_ChatterConversationPage.htm "Chatter conversation page.")

### getConversations(communityId)

Get the most recent conversations from an Experience Cloud site.

#### API Version

30.0

#### Requires Chatter

Yes

#### Signature

public static ConnectApi.ChatterConversationPage getConversations(String communityId)

#### Parameters

communityId

Type:String

ID for an Experience Cloud site, internal, or null.

#### Return Value

Type: [ConnectApi.​Chatter​ConversationPage](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_ChatterConversationPage.htm "Chatter conversation page.")

### getConversations(communityId, pageParam, pageSize)

Get a page of conversations from an Experience Cloud site.

#### API Version

30.0

#### Requires Chatter

Yes

#### Signature

public static ConnectApi.ChatterConversationPage getConversations(String communityId, String pageParam, Integer pageSize)

#### Parameters

communityId

Type:String

ID for an Experience Cloud site, internal, or null.

pageParam

Type:String

Specifies the page token to use to view a page of information. Page tokens are returned as part of the response class, such as currentPageToken or nextPageToken. If you pass in null, the first page is returned.

pageSize

Type: Integer

Specifies the number of items per page. Valid values are from 1 through 100. If you pass in null, the default size is 25.

#### Return Value

Type: [ConnectApi.​Chatter​ConversationPage](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_ChatterConversationPage.htm "Chatter conversation page.")

### getMessage(messageId)

Get a message.

#### API Version

29.0

#### Requires Chatter

Yes

#### Signature

public static ConnectApi.ChatterMessage getMessage(String messageId)

#### Parameters

messageId

Type: String

ID for the message.

#### Return Value

Type: [ConnectApi.​Chatter​Message](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_ChatterMessage.htm "Chatter message.")

### getMessage(communityId, messageId)

Get a message from an Experience Cloud site.

#### API Version

30.0

#### Requires Chatter

Yes

#### Signature

public static ConnectApi.ChatterMessage getMessage(String communityId, String messageId)

#### Parameters

communityId

Type:String

ID for an Experience Cloud site, internal, or null.

messageId

Type: String

ID for the message.

#### Return Value

Type:[ConnectApi.​Chatter​Message](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_ChatterMessage.htm "Chatter message.")

### getMessages()

Get the most recent messages.

#### API Version

29.0

#### Requires Chatter

Yes

#### Signature

public static ConnectApi.ChatterMessagePage getMessages()

#### Return Value

Type: [ConnectApi.​Chatter​MessagePage](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_ChatterMessagePage.htm "Chatter message page.")

### getMessages(pageParam, pageSize)

Get a page of messages.

#### API Version

29.0

#### Requires Chatter

Yes

#### Signature

public static ConnectApi.ChatterMessagePage getMessages(String pageParam, Integer pageSize)

#### Parameters

pageParam

Type: String

Specifies the page token to use to view a page of information. Page tokens are returned as part of the response class, such as currentPageToken or nextPageToken. If you pass in null, the first page is returned.

pageSize

Type: Integer

Specifies the number of items per page. Valid values are from 1 through 100. If you pass in null, the default size is 25.

#### Return Value

Type: [ConnectApi.​Chatter​MessagePage](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_ChatterMessagePage.htm "Chatter message page.")

### getMessages(communityId)

Get the most recent messages from an Experience Cloud site.

#### API Version

30.0

#### Requires Chatter

Yes

#### Signature

public static ConnectApi.ChatterMessagePage getMessages(String communityId)

#### Parameters

communityId

Type:String

ID for an Experience Cloud site, internal, or null.

#### Return Value

Type: [ConnectApi.​Chatter​MessagePage](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_ChatterMessagePage.htm "Chatter message page.")

### getMessages(communityId, pageParam, pageSize)

Get a page of messages from an Experience Cloud site.

#### API Version

30.0

#### Requires Chatter

Yes

#### Signature

public static ConnectApi.ChatterMessagePage getMessages(String communityId, String pageParam, Integer pageSize)

#### Parameters

communityId

Type:String

ID for an Experience Cloud site, internal, or null.

pageParam

Type: String

Specifies the page token to use to view a page of information. Page tokens are returned as part of the response class, such as currentPageToken or nextPageToken. If you pass in null, the first page is returned.

pageSize

Type: Integer

Specifies the number of items per page. Valid values are from 1 through 100. If you pass in null, the default size is 25.

#### Return Value

Type: [ConnectApi.​Chatter​MessagePage](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_ChatterMessagePage.htm "Chatter message page.")

### getUnreadCount()

Get the number of conversations that are marked unread.

#### API Version

29.0

#### Requires Chatter

Yes

#### Signature

public static ConnectApi.UnreadConversationCount getUnreadCount()

#### Return Value

Type: [ConnectApi.​​UnreadConversationCount](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_UnreadMessageCount.htm "Unread count for a conversation.")

If there are fewer than 50 unread conversations, ConnectApi.UreadConversationCount returns the exact number of unread conversations and the hasMore property is false. If there are more than 50 unread conversations, ConnectApi.UreadConversationCount returns 50 unread conversations and the hasMore property is true.

#### Example

ConnectApi.UnreadConversationCount unread = ConnectApi.ChatterMessages.getUnreadCount();

### getUnreadCount(communityId)

Get the number of conversations that are marked unread in an Experience Cloud site.

#### API Version

30.0

#### Requires Chatter

Yes

#### Signature

public static ConnectApi.UnreadConversationCount getUnreadCount(String communityId)

#### Parameters

communityId

Type:String

ID for an Experience Cloud site, internal, or null.

#### Return Value

Type: [ConnectApi.​​UnreadConversationCount](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_UnreadMessageCount.htm "Unread count for a conversation.")

If there are fewer than 50 unread conversations, ConnectApi.UreadConversationCount returns the exact number of unread conversations and the hasMore property is false. If there are more than 50 unread conversations, ConnectApi.UreadConversationCount returns 50 unread conversations and the hasMore property is true.

### markConversationRead(conversationId, read)

Mark a conversation as read or unread.

#### API Version

29.0

#### Requires Chatter

Yes

#### Signature

public static ConnectApi.ChatterConversationSummary markConversationRead(String conversationId, Boolean read)

#### Parameters

conversationId

Type: String

ID for the conversation.

read

Type: Boolean

Specify whether the conversation is read (true) or not (false).

#### Return Value

Type: [ConnectApi.​Chatter​ConversationSummary](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_ChatterConversationSummary.htm "Chatter conversation summary.")

### markConversationRead(communityId, conversationID, read)

Mark a conversation as read or unread in an Experience Cloud site.

#### API Version

30.0

#### Requires Chatter

Yes

#### Signature

public static ConnectApi.ChatterConversationSummary markConversationRead(String communityId, String conversationID, Boolean read)

#### Parameters

communityId

Type:String

ID for an Experience Cloud site, internal, or null.

conversationId

Type: String

ID for the conversation.

read

Type: Boolean

Specify whether the conversation is read (true) or not (false).

#### Return Value

Type: [ConnectApi.​Chatter​ConversationSummary](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_ChatterConversationSummary.htm "Chatter conversation summary.")

### replyToMessage(text, inReplyTo)

Reply to a message.

#### API Version

29.0

#### Requires Chatter

Yes

#### Signature

public static ConnectApi.ChatterMessage replyToMessage(String text, String inReplyTo)

#### Parameters

text

Type: String

Text of the message. Can’t be empty or over 10,000 characters.

inReplyTo

Type: String

ID of the message that is being responded to.

#### Return Value

Type: [ConnectApi.​Chatter​Message](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_ChatterMessage.htm "Chatter message.")

### replyToMessage(communityId, text, inReplyTo)

Reply to a message in an Experience Cloud site.

#### API Version

30.0

#### Requires Chatter

Yes

#### Signature

public static ConnectApi.ChatterMessage replyToMessage(String communityId, String text, String inReplyTo)

#### Parameters

communityId

Type:String

ID for an Experience Cloud site, internal, or null.

text

Type: String

Text of the message. Can’t be empty or over 10,000 characters.

inReplyTo

Type: String

ID of the message that is being responded to.

#### Return Value

Type: [ConnectApi.​Chatter​Message](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_ChatterMessage.htm "Chatter message.")

### searchConversation(conversationId, q)

Get a conversation that matches the search criteria.

#### API Version

29.0

#### Requires Chatter

Yes

#### Signature

public static ConnectApi.ChatterConversation searchConversation(String conversationId, String q)

#### Parameters

conversationId

Type: String

ID for the conversation.

q

Type: String

Required and can’t be null. Specifies the string to search. The search string must contain at least two characters, not including wildcards. See [Wildcards](https://developer.salesforce.com/docs/atlas.en-us.264.0.chatterapi.meta/chatterapi/intro_wildcards.htm).

#### Return Value

Type: [ConnectApi.​Chatter​Conversation](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_ChatterConversation.htm "Chatter conversation.")

### searchConversation(conversationId, pageParam, pageSize, q)

Get a conversation with a page of messages that match the search criteria.

#### API Version

29.0

#### Requires Chatter

Yes

#### Signature

public static ConnectApi.ChatterConversation searchConversation(String conversationId, String pageParam, Integer pageSize, String q)

#### Parameters

conversationId

Type: String

ID for the conversation.

pageParam

Type: String

Specifies the page token to use to view a page of information. Page tokens are returned as part of the response class, such as currentPageToken or nextPageToken. If you pass in null, the first page is returned.

pageSize

Type: Integer

Specifies the number of items per page. Valid values are from 1 through 100. If you pass in null, the default size is 25.

q

Type: String

Required and can’t be null. Specifies the string to search. The search string must contain at least two characters, not including wildcards. See [Wildcards](https://developer.salesforce.com/docs/atlas.en-us.264.0.chatterapi.meta/chatterapi/intro_wildcards.htm).

#### Return Value

Type: [ConnectApi.​Chatter​Conversation](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_ChatterConversation.htm "Chatter conversation.")

### searchConversation(communityId, conversationId, q)

Get a conversation with messages that match the search criteria in an Experience Cloud site.

#### API Version

30.0

#### Requires Chatter

Yes

#### Signature

public static ConnectApi.ChatterConversation searchConversation(String communityId, String conversationId, String q)

#### Parameters

communityId

Type:String

ID for an Experience Cloud site, internal, or null.

conversationId

Type: String

ID for the conversation.

q

Type: String

Required and can’t be null. Specifies the string to search. The search string must contain at least two characters, not including wildcards. See [Wildcards](https://developer.salesforce.com/docs/atlas.en-us.264.0.chatterapi.meta/chatterapi/intro_wildcards.htm).

#### Return Value

Type: [ConnectApi.​Chatter​Conversation](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_ChatterConversation.htm "Chatter conversation.")

### searchConversation(communityId, conversationId, pageParam, pageSize, q)

Get a conversation with a page of messages that match the search criteria in an Experience Cloud site.

#### API Version

30.0

#### Requires Chatter

Yes

#### Signature

public static ConnectApi.ChatterConversation searchConversation(String communityId, String conversationId, String pageParam, Integer pageSize, String q)

#### Parameters

communityId

Type:String

ID for an Experience Cloud site, internal, or null.

conversationId

Type: String

ID for the conversation.

pageParam

Type: String

Specifies the page token to use to view a page of information. Page tokens are returned as part of the response class, such as currentPageToken or nextPageToken. If you pass in null, the first page is returned.

pageSize

Type: Integer

Specifies the number of items per page. Valid values are from 1 through 100. If you pass in null, the default size is 25.

q

Type: String

Required and can’t be null. Specifies the string to search. The search string must contain at least two characters, not including wildcards. See [Wildcards](https://developer.salesforce.com/docs/atlas.en-us.264.0.chatterapi.meta/chatterapi/intro_wildcards.htm).

#### Return Value

Type: [ConnectApi.​Chatter​Conversation](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_ChatterConversation.htm "Chatter conversation.")

### searchConversations(q)

Get conversations in which member names and messages match the search criteria.

#### API Version

29.0

#### Requires Chatter

Yes

#### Signature

public static ConnectApi.ChatterConversationPage searchConversations(String q)

#### Parameters

q

Type: String

Required and can’t be null. Specifies the string to search. The search string must contain at least two characters, not including wildcards. See [Wildcards](https://developer.salesforce.com/docs/atlas.en-us.264.0.chatterapi.meta/chatterapi/intro_wildcards.htm).

#### Return Value

Type: [ConnectApi.​Chatter​ConversationPage](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_ChatterConversationPage.htm "Chatter conversation page.")

### searchConversations(pageParam, pageSize, q)

Get a page of conversations in which member names and messages match the search criteria.

#### API Version

29.0

#### Requires Chatter

Yes

#### Signature

public static ConnectApi.ChatterConversationPage searchConversations(String pageParam, Integer pageSize, String q)

#### Parameters

pageParam

Type: String

Specifies the page token to use to view a page of information. Page tokens are returned as part of the response class, such as currentPageToken or nextPageToken. If you pass in null, the first page is returned.

pageSize

Type: Integer

Specifies the number of items per page. Valid values are from 1 through 100. If you pass in null, the default size is 25.

q

Type: String

Required and can’t be null. Specifies the string to search. The search string must contain at least two characters, not including wildcards. See [Wildcards](https://developer.salesforce.com/docs/atlas.en-us.264.0.chatterapi.meta/chatterapi/intro_wildcards.htm).

#### Return Value

Type: [ConnectApi.​Chatter​ConversationPage](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_ChatterConversationPage.htm "Chatter conversation page.")

### searchConversations(communityId, q)

Get conversations in which member names and messages match the search criteria in an Experience Cloud site.

#### API Version

30.0

#### Requires Chatter

Yes

#### Signature

public static ConnectApi.ChatterConversationPage searchConversations(String communityId, String q)

#### Parameters

communityId

Type:String

ID for an Experience Cloud site, internal, or null.

q

Type: String

Required and can’t be null. Specifies the string to search. The search string must contain at least two characters, not including wildcards. See [Wildcards](https://developer.salesforce.com/docs/atlas.en-us.264.0.chatterapi.meta/chatterapi/intro_wildcards.htm).

#### Return Value

Type: [ConnectApi.​Chatter​ConversationPage](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_ChatterConversationPage.htm "Chatter conversation page.")

### searchConversations(communityId, pageParam, pageSize, q)

Get a page of conversations in which member names and messages match the search criteria in an Experience Cloud site.

#### API Version

30.0

#### Requires Chatter

Yes

#### Signature

public static ConnectApi.ChatterConversationPage searchConversations(String communityId, String pageParam, Integer pageSize, String q)

#### Parameters

communityId

Type:String

ID for an Experience Cloud site, internal, or null.

pageParam

Type: String

Specifies the page token to use to view a page of information. Page tokens are returned as part of the response class, such as currentPageToken or nextPageToken. If you pass in null, the first page is returned.

pageSize

Type: Integer

Specifies the number of items per page. Valid values are from 1 through 100. If you pass in null, the default size is 25.

q

Type: String

Required and can’t be null. Specifies the string to search. The search string must contain at least two characters, not including wildcards. See [Wildcards](https://developer.salesforce.com/docs/atlas.en-us.264.0.chatterapi.meta/chatterapi/intro_wildcards.htm).

#### Return Value

Type: [ConnectApi.​Chatter​ConversationPage](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_ChatterConversationPage.htm "Chatter conversation page.")

### searchMessages(q)

Get messages that match the search criteria.

#### API Version

29.0

#### Requires Chatter

Yes

#### Signature

public static ConnectApi.ChatterMessagePage searchMessages(String q)

#### Parameters

q

Type: String

Required and can’t be null. Specifies the string to search. The search string must contain at least two characters, not including wildcards. See [Wildcards](https://developer.salesforce.com/docs/atlas.en-us.264.0.chatterapi.meta/chatterapi/intro_wildcards.htm).

#### Return Value

Type: [ConnectApi.​Chatter​MessagePage](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_ChatterMessagePage.htm "Chatter message page.")

### searchMessages(pageParam, pageSize, q)

Get a page of messages that match the search criteria.

#### API Version

29.0

#### Requires Chatter

Yes

#### Signature

public static ConnectApi.ChatterMessagePage searchMessages(String pageParam, Integer pageSize, String q)

#### Parameters

pageParam

Type: String

Specifies the page token to use to view a page of information. Page tokens are returned as part of the response class, such as currentPageToken or nextPageToken. If you pass in null, the first page is returned.

pageSize

Type: Integer

Specifies the number of items per page. Valid values are from 1 through 100. If you pass in null, the default size is 25.

q

Type: String

Required and can’t be null. Specifies the string to search. The search string must contain at least two characters, not including wildcards. See [Wildcards](https://developer.salesforce.com/docs/atlas.en-us.264.0.chatterapi.meta/chatterapi/intro_wildcards.htm).

#### Return Value

Type: [ConnectApi.​Chatter​MessagePage](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_ChatterMessagePage.htm "Chatter message page.")

### searchMessages(communityId, q)

Get messages that match the search criteria in an Experience Cloud site.

#### API Version

30.0

#### Requires Chatter

Yes

#### Signature

public static ConnectApi.ChatterMessagePage searchMessages(String communityId, String q)

#### Parameters

communityId

Type:String

ID for an Experience Cloud site, internal, or null.

q

Type: String

Required and can’t be null. Specifies the string to search. The search string must contain at least two characters, not including wildcards. See [Wildcards](https://developer.salesforce.com/docs/atlas.en-us.264.0.chatterapi.meta/chatterapi/intro_wildcards.htm).

#### Return Value

Type: [ConnectApi.​Chatter​MessagePage](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_ChatterMessagePage.htm "Chatter message page.")

### searchMessages(communityId, pageParam, pageSize, q)

Get a page of messages that match the search criteria in an Experience Cloud site.

#### API Version

30.0

#### Requires Chatter

Yes

#### Signature

public static ConnectApi.ChatterMessagePage searchMessages(String communityId, String pageParam, Integer pageSize, String q)

#### Parameters

communityId

Type:String

ID for an Experience Cloud site, internal, or null.

pageParam

Type: String

Specifies the page token to use to view a page of information. Page tokens are returned as part of the response class, such as currentPageToken or nextPageToken. If you pass in null, the first page is returned.

pageSize

Type: Integer

Specifies the number of items per page. Valid values are from 1 through 100. If you pass in null, the default size is 25.

q

Type: String

Required and can’t be null. Specifies the string to search. The search string must contain at least two characters, not including wildcards. See [Wildcards](https://developer.salesforce.com/docs/atlas.en-us.264.0.chatterapi.meta/chatterapi/intro_wildcards.htm).

#### Return Value

Type: [ConnectApi.​Chatter​MessagePage](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_ChatterMessagePage.htm "Chatter message page.")

### sendMessage(text, recipients)

Send a message to a list of recipients.

#### API Version

29.0

#### Requires Chatter

Yes

#### Signature

public static ConnectApi.ChatterMessage sendMessage(String text, String recipients)

#### Parameters

text

Type: String

Text of the message. Can’t be empty or over 10,000 characters.

recipients

Type: String

Up to nine comma-separated IDs of the users receiving the message.

#### Return Value

Type: [ConnectApi.​Chatter​Message](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_ChatterMessage.htm "Chatter message.")

### sendMessage(communityId, text, recipients)

Send a message to a list of recipients in an Experience Cloud site.

#### API Version

30.0

#### Requires Chatter

Yes

#### Signature

public static ConnectApi.ChatterMessage sendMessage(String communityId, String text, String recipients)

#### Parameters

communityId

Type:String

ID for an Experience Cloud site, internal, or null.

text

Type: String

Text of the message. Can’t be empty or over 10,000 characters.

recipients

Type: String

Up to nine comma-separated IDs of users to receive the message.

#### Return Value

Type: [ConnectApi.​Chatter​Message](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_ChatterMessage.htm "Chatter message.")