Interface MessagesService


public interface MessagesService
Messages Service
  • Method Details

    • list

      List messages (using default parameters)

      This operation lists all messages sent or received via particular [Processing Modes](https://developers.sinch.com/docs/conversation/processing-modes/). Setting the `messages_source` parameter to `CONVERSATION_SOURCE` allows for querying messages in `CONVERSATION` mode, and setting it to `DISPATCH_SOURCE` will allow for queries of messages in `DISPATCH` mode. Note that `conversation_id` and `contact_id` are only supported as query parameters if `messages_source` is set to `CONVERSATION_SOURCE`. Combining multiple parameters is supported for more detailed filtering of messages, but some of them are not supported depending on the value specified for `messages_source`. The description for each field will inform if that field may not be supported. The messages are ordered by their `accept_time` property in descending order, where `accept_time` is a timestamp of when the message was enqueued by the Conversation API. This means messages received most recently will be listed first.

      Returns:
      MessagesListResponse
      Throws:
      ApiException - if fails to make API call
    • list

      List messages

      This operation lists all messages sent or received via particular [Processing Modes](https://developers.sinch.com/docs/conversation/processing-modes/). Setting the `messages_source` parameter to `CONVERSATION_SOURCE` allows for querying messages in `CONVERSATION` mode, and setting it to `DISPATCH_SOURCE` will allow for queries of messages in `DISPATCH` mode. Note that `conversation_id` and `contact_id` are only supported as query parameters if `messages_source` is set to `CONVERSATION_SOURCE`. Combining multiple parameters is supported for more detailed filtering of messages, but some of them are not supported depending on the value specified for `messages_source`. The description for each field will inform if that field may not be supported. The messages are ordered by their `accept_time` property in descending order, where `accept_time` is a timestamp of when the message was enqueued by the Conversation API. This means messages received most recently will be listed first.

      Parameters:
      queryParameter - (optional)
      Returns:
      MessagesListResponse
      Throws:
      ApiException - if fails to make API call
    • delete

      void delete(String messageId) throws ApiException
      Delete a message (using default parameters)

      Delete a specific message by its ID. Note that this operation deletes the message from Conversation API storage; this operation does not affect messages already delivered to recipients' handsets. Also note that removing all messages of a conversation will not automatically delete the conversation.

      Parameters:
      messageId - The unique ID of the message. (required)
      Throws:
      ApiException - if fails to make API call
    • delete

      void delete(String messageId, MessagesDeleteQueryParameters queryParameter) throws ApiException
      Delete a message

      Delete a specific message by its ID. Note that this operation deletes the message from Conversation API storage; this operation does not affect messages already delivered to recipients' handsets. Also note that removing all messages of a conversation will not automatically delete the conversation.

      Parameters:
      messageId - The unique ID of the message. (required)
      queryParameter - (optional)
      Throws:
      ApiException - if fails to make API call
    • get

      ConversationMessage get(String messageId) throws ApiException
      Get a message (using default parameters)

      Retrieves a specific message by its ID.

      Parameters:
      messageId - The unique ID of the message. (required)
      Returns:
      ConversationMessage
      Throws:
      ApiException - if fails to make API call
    • get

      ConversationMessage get(String messageId, MessagesGetQueryParameters queryParameter) throws ApiException
      Get a message

      Retrieves a specific message by its ID.

      Parameters:
      messageId - The unique ID of the message. (required)
      queryParameter - (optional)
      Returns:
      ConversationMessage
      Throws:
      ApiException - if fails to make API call
    • listLastMessagesByChannelIdentity

      MessagesListResponse listLastMessagesByChannelIdentity() throws ApiException
      List messages by channel identity (using default parameters)

      Retrieves the last message sent to specified channel identities. In CONVERSATION_SOURCE mode, you can query either by channel_identities or by contact_ids. Note: Use either contact_ids OR channel_identities per request, not both. DISPATCH_SOURCE mode does not support contact_ids.

      Returns:
      MessagesListResponse
      Throws:
      ApiException - if fails to make API call
    • listLastMessagesByChannelIdentity

      MessagesListResponse listLastMessagesByChannelIdentity(LastMessagesByChannelIdentityListQueryParameters queryParameter) throws ApiException
      List messages by channel identity

      Retrieves the last message sent to specified channel identities. In CONVERSATION_SOURCE mode, you can query either by channel_identities or by contact_ids. Note: Use either contact_ids OR channel_identities per request, not both. DISPATCH_SOURCE mode does not support contact_ids.

      Parameters:
      queryParameter - Request body for listing messages by channel identity. NOTE: You can use either contact_ids OR channel_identities, but not both in the same request. (required)
      Returns:
      MessagesListResponse
      Throws:
      ApiException - if fails to make API call
    • sendMessage

      SendMessageResponse sendMessage(SendMessageRequest<? extends AppMessageBody> sendMessageRequest) throws ApiException
      Send a message

      You can send a message from a Conversation app to a contact associated with that app. If the recipient is not associated with an existing contact, a new contact will be created. The message is added to the active conversation with the contact if a conversation already exists. If no active conversation exists a new one is started automatically. You can find all of your IDs and authentication credentials on the [Sinch Customer Dashboard](https://dashboard.sinch.com/settings/access-keys).

      Parameters:
      sendMessageRequest - This is the request body for sending a message. `app_id`, `recipient`, and `message` are all required fields. (required)
      Returns:
      SendMessageResponse
      Throws:
      ApiException - if fails to make API call
    • sendCardMessage

      Send a card message
      Parameters:
      request - CardMessage request
      Returns:
      Response related to sent message
      Since:
      1.3
      See Also:
    • sendCarouselMessage

      Send a carousel message
      Parameters:
      request - CarouselMessage request
      Returns:
      Response related to sent message
      Since:
      1.3
      See Also:
    • sendChoiceMessage

      Send a choice message
      Parameters:
      request - ChoiceMessage request
      Returns:
      Response related to sent message
      Since:
      1.3
      See Also:
    • sendContactInfoMessage

      SendMessageResponse sendContactInfoMessage(SendMessageRequest<ContactInfoMessage> request)
      Send a contact info message
      Parameters:
      request - ContactInfoMessage request
      Returns:
      Response related to sent message
      Since:
      1.3
      See Also:
    • sendListMessage

      Send a list message
      Parameters:
      request - ListMessage request
      Returns:
      Response related to sent message
      Since:
      1.3
      See Also:
    • sendLocationMessage

      Send a location message
      Parameters:
      request - LocationMessage request
      Returns:
      Response related to sent message
      Since:
      1.3
      See Also:
    • sendMediaMessage

      Send a media message
      Parameters:
      request - MediaMessage request
      Returns:
      Response related to sent message
      Since:
      1.3
      See Also:
    • sendTemplateMessage

      Send a template message
      Parameters:
      request - TemplateMessage request
      Returns:
      Response related to sent message
      Since:
      1.3
      See Also:
    • sendTextMessage

      Send a send message request message
      Parameters:
      request - request
      Returns:
      Response related to sent message
      Since:
      1.3
      See Also:
    • update

      ConversationMessage update(String messageId, MessageUpdateRequest messageUpdateRequest) throws ApiException
      Update message metadata (using default parameters)

      Update a specific message metadata by its ID.

      Parameters:
      messageId - The unique ID of the message. (required)
      messageUpdateRequest - Update message metadata request. (required)
      Returns:
      ConversationMessage
      Throws:
      ApiException - if fails to make API call
    • update

      ConversationMessage update(String messageId, MessagesUpdateQueryParameters queryParameter, MessageUpdateRequest messageUpdateRequest) throws ApiException
      Update message metadata

      Update a specific message metadata by its ID.

      Parameters:
      messageId - The unique ID of the message. (required)
      queryParameter - (optional)
      messageUpdateRequest - Update message metadata request. (required)
      Returns:
      ConversationMessage
      Throws:
      ApiException - if fails to make API call