Class MessageService
java.lang.Object
com.symphony.bdk.core.service.message.MessageService
- All Implemented Interfaces:
OboMessageService
,OboService<OboMessageService>
@API(status=STABLE)
public class MessageService
extends Object
implements OboMessageService, OboService<OboMessageService>
Service class for managing messages.
- See Also:
-
Constructor Summary
ConstructorDescriptionMessageService
(MessagesApi messagesApi, MessageApi messageApi, MessageSuppressionApi messageSuppressionApi, StreamsApi streamsApi, PodApi podApi, AttachmentsApi attachmentsApi, DefaultApi defaultApi, BotAuthSession authSession, com.symphony.bdk.template.api.TemplateEngine templateEngine, RetryWithRecoveryBuilder<?> retryBuilder) MessageService
(MessagesApi messagesApi, MessageApi messageApi, MessageSuppressionApi messageSuppressionApi, StreamsApi streamsApi, PodApi podApi, AttachmentsApi attachmentsApi, DefaultApi defaultApi, com.symphony.bdk.template.api.TemplateEngine templateEngine, RetryWithRecoveryBuilder<?> retryBuilder) -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
getAttachment
(String streamId, String messageId, String attachmentId) Downloads the attachment body by the stream ID, message ID and attachment ID.Retrieves a list of supported file extensions for attachments.getMessage
(String messageId) Retrieves the details of a message given its message ID.getMessageRelationships
(String messageId) Gets the message metadata relationship.getMessageStatus
(String messageId) Get the status of a particular message, i.e the list of users who the message was sent to, delivered to and the list of users who read the message.importMessages
(List<V4ImportedMessage> messages) Imports a list of messages to SymphonylistAttachments
(String streamId, Instant since, Instant to, Integer limit, AttachmentSort sort) List attachments in a particular stream.listMessageReceipts
(String messageId) Fetches receipts details from a specific message.listMessages
(V4Stream stream, Instant since) Get messages from an existing stream with default limit equals 50.listMessages
(V4Stream stream, Instant since, PaginationAttribute pagination) Get messages from an existing stream.listMessages
(String streamId, Instant since) Get messages from an existing stream with default limit equals 50.listMessages
(String streamId, Instant since, PaginationAttribute pagination) Get messages from an existing stream.obo
(BotAuthSession oboSession) Returns a new service instance with OBO-enabled endpoints from a given OBO session.searchMessages
(MessageSearchQuery query) Searches for messages in the context of a specified user, given an argument-based query.searchMessages
(MessageSearchQuery query, PaginationAttribute pagination) Searches for messages in the context of a specified user, given an argument-based query.searchMessages
(MessageSearchQuery query, PaginationAttribute pagination, SortDir sortDir) Searches for messages in the context of a specified user, given an argument-based query.Sends a message to the stream ID passed in parameter.Sends a message to the stream ID of the passedV4Stream
object.Sends a message to the stream ID passed in parameter.Sends a message to the stream ID passed in parameter.Sends a message to multiple existing streams.suppressMessage
(String messageId) Suppresses a users message based on the messageID pass in parameter.com.symphony.bdk.template.api.TemplateEngine
Returns theTemplateEngine
that can be used to load templates from classpath or file system.Update an existing message.Update an existing message.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.symphony.bdk.core.service.OboService
checkAuthSession
-
Constructor Details
-
MessageService
public MessageService(MessagesApi messagesApi, MessageApi messageApi, MessageSuppressionApi messageSuppressionApi, StreamsApi streamsApi, PodApi podApi, AttachmentsApi attachmentsApi, DefaultApi defaultApi, BotAuthSession authSession, com.symphony.bdk.template.api.TemplateEngine templateEngine, RetryWithRecoveryBuilder<?> retryBuilder) -
MessageService
public MessageService(MessagesApi messagesApi, MessageApi messageApi, MessageSuppressionApi messageSuppressionApi, StreamsApi streamsApi, PodApi podApi, AttachmentsApi attachmentsApi, DefaultApi defaultApi, com.symphony.bdk.template.api.TemplateEngine templateEngine, RetryWithRecoveryBuilder<?> retryBuilder)
-
-
Method Details
-
obo
Description copied from interface:OboService
Returns a new service instance with OBO-enabled endpoints from a given OBO session.- Specified by:
obo
in interfaceOboService<OboMessageService>
- Parameters:
oboSession
- the OBO session- Returns:
- the instance of the service class with OBO-enabled endpoints
-
templates
public com.symphony.bdk.template.api.TemplateEngine templates()Returns theTemplateEngine
that can be used to load templates from classpath or file system.- Specified by:
templates
in interfaceOboMessageService
- Returns:
- the template engine
-
listMessages
public List<V4Message> listMessages(@Nonnull V4Stream stream, @Nonnull Instant since, @Nonnull PaginationAttribute pagination) Get messages from an existing stream. Additionally returns any attachments associated with the message.- Parameters:
stream
- the stream where to look for messagessince
- instant of the earliest possible date of the first message returned.pagination
- The skip and limit for pagination.- Returns:
- the list of matching messages in the stream.
- See Also:
-
listMessages
Get messages from an existing stream with default limit equals 50. Additionally returns any attachments associated with the message.- Parameters:
stream
- the stream where to look for messagessince
- instant of the earliest possible date of the first message returned.- Returns:
- the list of matching messages in the stream.
- See Also:
-
listMessages
public List<V4Message> listMessages(@Nonnull String streamId, @Nonnull Instant since, @Nonnull PaginationAttribute pagination) Get messages from an existing stream. Additionally returns any attachments associated with the message.- Parameters:
streamId
- the streamID where to look for messagessince
- instant of the earliest possible date of the first message returned.pagination
- The skip and limit for pagination.- Returns:
- the list of matching messages in the stream.
- See Also:
-
listMessages
Get messages from an existing stream with default limit equals 50. Additionally returns any attachments associated with the message.- Parameters:
streamId
- the streamID where to look for messagessince
- instant of the earliest possible date of the first message returned.- Returns:
- the list of matching messages in the stream.
- See Also:
-
searchMessages
Searches for messages in the context of a specified user, given an argument-based query.- Parameters:
query
- the search query arguments- Returns:
- the list of matching messages
- See Also:
-
searchMessages
public List<V4Message> searchMessages(@Nonnull MessageSearchQuery query, @Nullable PaginationAttribute pagination) Searches for messages in the context of a specified user, given an argument-based query.- Parameters:
query
- The search query argumentspagination
- The skip and limit for pagination. The maximum limit value is 1000;- Returns:
- the list of matching messages
- See Also:
-
searchMessages
public List<V4Message> searchMessages(@Nonnull MessageSearchQuery query, @Nullable PaginationAttribute pagination, @Nullable SortDir sortDir) Searches for messages in the context of a specified user, given an argument-based query.- Parameters:
query
- The search query argumentspagination
- The skip and limit for pagination. The maximum limit value is 1000.sortDir
- Sorting direction for response. Possible values are desc (default) and asc.- Returns:
- the list of matching messages
- See Also:
-
send
Sends a message to the stream ID of the passedV4Stream
object.- Specified by:
send
in interfaceOboMessageService
- Parameters:
stream
- the stream to send the message tomessage
- the MessageML content. Note:<messageML></messageML>
is automatically appended if not set.- Returns:
- a
V4Message
object containing the details of the sent message - See Also:
-
send
Sends a message to the stream ID passed in parameter.- Specified by:
send
in interfaceOboMessageService
- Parameters:
streamId
- the ID of the stream to send the message tomessage
- the MessageML content. Note:<messageML></messageML>
is automatically appended if not set.- Returns:
- a
V4Message
object containing the details of the sent message - See Also:
-
send
Sends a message to the stream ID passed in parameter.- Specified by:
send
in interfaceOboMessageService
- Parameters:
stream
- the stream to send the message tomessage
- the message to send to the stream- Returns:
- a
V4Message
object containing the details of the sent message - See Also:
-
send
Sends a message to the stream ID passed in parameter.- Specified by:
send
in interfaceOboMessageService
- Parameters:
streamId
- the ID of the stream to send the message tomessage
- the message to send to the stream- Returns:
- a
V4Message
object containing the details of the sent message - See Also:
-
getAttachmentTypes
Retrieves a list of supported file extensions for attachments.- Specified by:
getAttachmentTypes
in interfaceOboMessageService
- Returns:
- a list of String containing all allowed file extensions for attachments
- See Also:
-
update
@API(status=EXPERIMENTAL) public V4Message update(@Nonnull V4Message messageToUpdate, @Nonnull Message content) Update an existing message. The existing message must be a valid social message, that has not been deleted.- Parameters:
messageToUpdate
- the message to be updatedcontent
- the update content (attachments are not supported yet)- Returns:
- a
V4Message
object containing the details of the sent message - See Also:
-
update
@API(status=EXPERIMENTAL) public V4Message update(@Nonnull String streamId, @Nonnull String messageId, @Nonnull Message content) Update an existing message. The existing message must be a valid social message, that has not been deleted.- Parameters:
streamId
- the ID of the stream where the message to be updated comes frommessageId
- the ID of the message to be updatedcontent
- the update content (attachments are not supported yet)- Returns:
- a
V4Message
object containing the details of the sent message - See Also:
-
send
Sends a message to multiple existing streams.- Parameters:
streamIds
- the list of stream IDs to send the message tomessage
- the message to be sent- Returns:
- a
V4MessageBlastResponse
object containing the details of the sent messages - See Also:
-
getAttachment
public byte[] getAttachment(@Nonnull String streamId, @Nonnull String messageId, @Nonnull String attachmentId) Downloads the attachment body by the stream ID, message ID and attachment ID.- Parameters:
streamId
- the stream ID where to look for the attachmentmessageId
- the ID of the message containing the attachmentattachmentId
- the ID of the attachment- Returns:
- a byte array of attachment encoded in base 64
- See Also:
-
importMessages
Imports a list of messages to Symphony- Parameters:
messages
- the list of messages to be imported- Returns:
- the list of imported messages
- See Also:
-
suppressMessage
Suppresses a users message based on the messageID pass in parameter.- Specified by:
suppressMessage
in interfaceOboMessageService
- Parameters:
messageId
- the ID of the message to suppress- Returns:
- a
MessageSuppressionResponse
object containing the details of the suppressed message - See Also:
-
getMessageStatus
Get the status of a particular message, i.e the list of users who the message was sent to, delivered to and the list of users who read the message.- Parameters:
messageId
- the ID of the message to be checked- Returns:
- a
MessageStatus
instance - See Also:
-
getMessage
Retrieves the details of a message given its message ID.- Parameters:
messageId
- the ID of the message to be retrieved- Returns:
- a
V4Message
containing the message's details, null if the message was not found - See Also:
-
listAttachments
public List<StreamAttachmentItem> listAttachments(@Nonnull String streamId, @Nullable Instant since, @Nullable Instant to, @Nullable Integer limit, @Nullable AttachmentSort sort) List attachments in a particular stream.- Parameters:
streamId
- the stream ID where to look for the attachmentssince
- optional instant of the first required attachment.to
- optional instant of the last required attachment.limit
- maximum number of attachments to return. This optional value defaults to 50 and should be between 0 and 100.sort
- Attachment date sort direction : ASC or DESC (default to ASC)- Returns:
- the list of attachments in the stream.
- See Also:
-
listMessageReceipts
Fetches receipts details from a specific message.- Parameters:
messageId
- the ID of the message to get receipt details from.- Returns:
- a
MessageReceiptDetailResponse
object holding all receipt information. - See Also:
-
getMessageRelationships
Gets the message metadata relationship. This API allows users to track the relationship between a message and all the forwards and replies of that message.- Parameters:
messageId
- the ID of the message to get relationships from.- Returns:
- a
MessageMetadataResponse
object holding information about the current message relationships (parent, replies, forwards and form replies). - See Also:
-