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 Details

  • Method Details

    • obo

      public OboMessageService obo(AuthSession oboSession)
      Description copied from interface: OboService
      Returns a new service instance with OBO-enabled endpoints from a given OBO session.
      Specified by:
      obo in interface OboService<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 the TemplateEngine that can be used to load templates from classpath or file system.
      Specified by:
      templates in interface OboMessageService
      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 messages
      since - 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

      public List<V4Message> listMessages(@Nonnull V4Stream stream, @Nonnull Instant since)
      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 messages
      since - 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 messages
      since - 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

      public List<V4Message> listMessages(@Nonnull String streamId, @Nonnull Instant since)
      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 messages
      since - instant of the earliest possible date of the first message returned.
      Returns:
      the list of matching messages in the stream.
      See Also:
    • searchMessages

      public List<V4Message> searchMessages(@Nonnull MessageSearchQuery query)
      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 arguments
      pagination - 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 arguments
      pagination - 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

      public V4Message send(@Nonnull V4Stream stream, @Nonnull String message)
      Sends a message to the stream ID of the passed V4Stream object.
      Specified by:
      send in interface OboMessageService
      Parameters:
      stream - the stream to send the message to
      message - 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

      public V4Message send(@Nonnull String streamId, @Nonnull String message)
      Sends a message to the stream ID passed in parameter.
      Specified by:
      send in interface OboMessageService
      Parameters:
      streamId - the ID of the stream to send the message to
      message - 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

      public V4Message send(@Nonnull V4Stream stream, @Nonnull Message message)
      Sends a message to the stream ID passed in parameter.
      Specified by:
      send in interface OboMessageService
      Parameters:
      stream - the stream to send the message to
      message - the message to send to the stream
      Returns:
      a V4Message object containing the details of the sent message
      See Also:
    • send

      public V4Message send(@Nonnull String streamId, @Nonnull Message message)
      Sends a message to the stream ID passed in parameter.
      Specified by:
      send in interface OboMessageService
      Parameters:
      streamId - the ID of the stream to send the message to
      message - the message to send to the stream
      Returns:
      a V4Message object containing the details of the sent message
      See Also:
    • getAttachmentTypes

      public List<String> getAttachmentTypes()
      Retrieves a list of supported file extensions for attachments.
      Specified by:
      getAttachmentTypes in interface OboMessageService
      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.
      Specified by:
      update in interface OboMessageService
      Parameters:
      messageToUpdate - the message to be updated
      content - 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.
      Specified by:
      update in interface OboMessageService
      Parameters:
      streamId - the ID of the stream where the message to be updated comes from
      messageId - the ID of the message to be updated
      content - the update content (attachments are not supported yet)
      Returns:
      a V4Message object containing the details of the sent message
      See Also:
    • send

      public V4MessageBlastResponse send(@Nonnull List<String> streamIds, @Nonnull Message message)
      Sends a message to multiple existing streams.
      Parameters:
      streamIds - the list of stream IDs to send the message to
      message - 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 attachment
      messageId - the ID of the message containing the attachment
      attachmentId - the ID of the attachment
      Returns:
      a byte array of attachment encoded in base 64
      See Also:
    • importMessages

      public List<V4ImportResponse> importMessages(@Nonnull List<V4ImportedMessage> messages)
      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

      public MessageSuppressionResponse suppressMessage(@Nonnull String messageId)
      Suppresses a users message based on the messageID pass in parameter.
      Specified by:
      suppressMessage in interface OboMessageService
      Parameters:
      messageId - the ID of the message to suppress
      Returns:
      a MessageSuppressionResponse object containing the details of the suppressed message
      See Also:
    • getMessageStatus

      public MessageStatus getMessageStatus(@Nonnull 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.
      Parameters:
      messageId - the ID of the message to be checked
      Returns:
      a MessageStatus instance
      See Also:
    • getMessage

      public V4Message getMessage(@Nonnull String messageId)
      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 attachments
      since - 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

      public MessageReceiptDetailResponse listMessageReceipts(@Nonnull String messageId)
      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

      public MessageMetadataResponse getMessageRelationships(@Nonnull String messageId)
      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: