Newer Version Available
ChatterMessages Class
Namespace
Usage
Use Chatter in Apex to get, send, search, and reply to messages. You can also get and search conversations, mark conversations as read, and get a count of unread messages.
ChatterMessages Methods
The following are methods for ChatterMessages. All methods are static.
getConversation(conversationId)
API Version
29.0
Requires Chatter
Yes
Signature
public static ConnectApi.ChatterConversation getConversation(String conversationId)
Parameters
- conversationId
- Type: String
- Specify the ID for the conversation.
Return Value
getConversation(conversationId, pageParam, pageSize)
API Version
29.0
Requires Chatter
Yes
Signature
public static ConnectApi.ChatterConversation getConversation(String conversationId, String pageParam, Integer pageSize)
Parameters
- conversationId
- Type: String
- Specify the ID for the conversation.
- pageParam
- Type: String
- Specifies the page token to be used 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
getConversation(communityId, conversationId)
API Version
30.0
Requires Chatter
Yes
Signature
public static ConnectApi.ChatterConversation getConversation(String communityId, String conversationId)
Parameters
Return Value
getConversation(communityId, conversationId, pageParam, pageSize)
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
- Use either the ID for a community, internal, or null.
- conversationId
- Type: String
- Specify the ID for the conversation.
- pageParam
- Type:String
- Specifies the page token to be used 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
getConversations()
API Version
29.0
Requires Chatter
Yes
Signature
public static ConnectApi.ChatterConversationPage getConversations()
Return Value
getConversations(pageParam, pageSize)
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 be used 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
getConversations(communityId)
API Version
30.0
Requires Chatter
Yes
Signature
public static ConnectApi.ChatterConversationPage getConversations(String communityId)
Parameters
- communityId
- Type:String
- Use either the ID for a community, internal, or null.
Return Value
getConversations(communityId, pageParam, pageSize)
API Version
30.0
Requires Chatter
Yes
Signature
public static ConnectApi.ChatterConversationPage getConversations(String communityId, String pageParam, Integer pageSize)
Parameters
- communityId
- Type:String
- Use either the ID for a community, internal, or null.
- pageParam
- Type:String
- Specifies the page token to be used 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
getMessage(messageId)
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
getMessage(communityId, messageId)
API Version
30.0
Requires Chatter
Yes
Signature
public static ConnectApi.ChatterMessage getMessage(String communityId, String messageId)
Parameters
Return Value
getMessages()
API Version
29.0
Requires Chatter
Yes
Signature
public static ConnectApi.ChatterMessagePage getMessages()
Return Value
getMessages(pageParam, pageSize)
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 be used 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
getMessages(communityId)
API Version
30.0
Requires Chatter
Yes
Signature
public static ConnectApi.ChatterMessagePage getMessages(String communityId)
Parameters
- communityId
- Type:String
- Use either the ID for a community, internal, or null.
Return Value
getMessages(communityId, pageParam, pageSize)
API Version
30.0
Requires Chatter
Yes
Signature
public static ConnectApi.ChatterMessagePage getMessages(String communityId, String pageParam, Integer pageSize)
Parameters
- communityId
- Type:String
- Use either the ID for a community, internal, or null.
- pageParam
- Type: String
- Specifies the page token to be used 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
getUnreadCount()
API Version
29.0
Requires Chatter
Yes
Signature
public static ConnectApi.UnreadConversationCount getUnreadCount()
Return Value
Type: ConnectApi.UnreadConversationCount
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
getUnreadCount(communityId)
API Version
30.0
Requires Chatter
Yes
Signature
public static ConnectApi.UnreadConversationCount getUnreadCount(String communityId)
Parameters
- communityId
- Type:String
- Use either the ID for a community, internal, or null.
Return Value
Type: ConnectApi.UnreadConversationCount
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)
API Version
29.0
Requires Chatter
Yes
Signature
public static ConnectApi.ChatterConversationSummary markConversationRead(String conversationId, Boolean read)
Parameters
Return Value
markConversationRead(communityId, conversationID, read)
API Version
30.0
Requires Chatter
Yes
Signature
public static ConnectApi.ChatterConversationSummary markConversationRead(String communityId, String conversationID, Boolean read)
Parameters
Return Value
replyToMessage(text, inReplyTo)
API Version
29.0
Requires Chatter
Yes
Signature
public static ConnectApi.ChatterMessage replyToMessage(String text, String inReplyTo)
Parameters
Return Value
replyToMessage(communityId, text, inReplyTo)
API Version
30.0
Requires Chatter
Yes
Signature
public static ConnectApi.ChatterMessage replyToMessage(String communityId, String text, String inReplyTo)
Parameters
Return Value
searchConversation(conversationId, q)
API Version
29.0
Requires Chatter
Yes
Signature
public static ConnectApi.ChatterConversation searchConversation(String conversationId, String q)
Parameters
Return Value
searchConversation(conversationId, pageParam, pageSize, q)
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
- Specify the ID for the conversation.
- pageParam
- Type: String
- Specifies the page token to be used 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 cannot be null. Specifies the string to search. The search string must contain at least two characters, not including wildcards. See Wildcards.
Return Value
searchConversation(communityId, conversationId, q)
API Version
30.0
Requires Chatter
Yes
Signature
public static ConnectApi.ChatterConversation searchConversation(String communityId, String conversationId, String q)
Parameters
- communityId
- Type:String
- Use either the ID for a community, internal, or null.
- conversationId
- Type: String
- Specify the ID for the conversation.
- q
- Type: String
- Required and cannot be null. Specifies the string to search. The search string must contain at least two characters, not including wildcards. See Wildcards.
Return Value
searchConversation(communityId, conversationId, pageParam, pageSize, q)
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
- Use either the ID for a community, internal, or null.
- conversationId
- Type: String
- Specify the ID for the conversation.
- pageParam
- Type: String
- Specifies the page token to be used 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 cannot be null. Specifies the string to search. The search string must contain at least two characters, not including wildcards. See Wildcards.
Return Value
searchConversations(q)
API Version
29.0
Requires Chatter
Yes
Signature
public static ConnectApi.ChatterConversationPage searchConversations(String q)
Parameters
Return Value
searchConversations(pageParam, pageSize, q)
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 be used 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 cannot be null. Specifies the string to search. The search string must contain at least two characters, not including wildcards. See Wildcards.
Return Value
searchConversations(communityId, q)
API Version
30.0
Requires Chatter
Yes
Signature
public static ConnectApi.ChatterConversationPage searchConversations(String communityId, String q)
Parameters
Return Value
searchConversations(communityId, pageParam, pageSize, q)
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
- Use either the ID for a community, internal, or null.
- pageParam
- Type: String
- Specifies the page token to be used 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 cannot be null. Specifies the string to search. The search string must contain at least two characters, not including wildcards. See Wildcards.
Return Value
searchMessages(q)
API Version
29.0
Requires Chatter
Yes
Signature
public static ConnectApi.ChatterMessagePage searchMessages(String q)
Parameters
Return Value
searchMessages(pageParam, pageSize, q)
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 be used 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 cannot be null. Specifies the string to search. The search string must contain at least two characters, not including wildcards. See Wildcards.
Return Value
searchMessages(communityId, q)
API Version
30.0
Requires Chatter
Yes
Signature
public static ConnectApi.ChatterMessagePage searchMessages(String communityId, String q)
Parameters
Return Value
searchMessages(communityId, pageParam, pageSize, q)
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
- Use either the ID for a community, internal, or null.
- pageParam
- Type: String
- Specifies the page token to be used 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 cannot be null. Specifies the string to search. The search string must contain at least two characters, not including wildcards. See Wildcards.
Return Value
sendMessage(text, recipients)
API Version
29.0
Requires Chatter
Yes
Signature
public static ConnectApi.ChatterMessage sendMessage(String text, String recipients)