Interface MessagesService
To start sending messages you must have a Conversation API app. The app holds information about the channel credentials and registered webhooks to which the API delivers callbacks such as message delivery receipts and contact messages. If you don't already have an app please follow the instructions in the getting started guide available in the Sinch Dashboard to create one.
- Since:
- 1.3
- See Also:
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic enum
Specifies the message source for which the request will be processed. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Helper method fordelete(String, MessageSource)
void
delete
(String messageId, MessagesService.MessageSource messageSource) Delete a specific message by its ID.Helper method forget(String, MessageSource)
get
(String messageId, MessagesService.MessageSource messageSource) Retrieves a specific message by its ID.list
(MessagesListRequest request) This operation lists all messages sent or received via particularProcessingMode
.sendCardMessage
(SendMessageRequest<CardMessage> request) Send a card messageSend a carousel messagesendChoiceMessage
(SendMessageRequest<ChoiceMessage> request) Send a choice messageSend a contact info messagesendListMessage
(SendMessageRequest<ListMessage> request) Send a list messageSend a location messagesendMediaMessage
(SendMessageRequest<MediaMessage> request) Send a media messagesendMessage
(SendMessageRequest<? extends AppMessageBody> request) Send a messageSend a template messagesendTextMessage
(SendMessageRequest<TextMessage> request) Send a send message request messageupdate
(String messageId, MessagesService.MessageSource messageSource, MessageUpdateRequest request) Update a specific message by its ID.update
(String messageId, MessageUpdateRequest request) Helper method forupdate(String, MessageSource, MessageUpdateRequest)
-
Method Details
-
sendMessage
Send a messageYou 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.
- Parameters:
request
- Request parameters- Returns:
- Response related to sent message
- Since:
- 1.3
-
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
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:
-
get
Helper method forget(String, MessageSource)
- Parameters:
messageId
- The unique ID of the message.- Returns:
- Conversation message
- Since:
- 1.3
- See Also:
-
get
Retrieves a specific message by its ID.- Parameters:
messageId
- The unique ID of the message.messageSource
- Specifies the message source for which the request will be processed. Used for operations on messages in Dispatch Mode. For more information, see Processing Modes- Returns:
- Conversation message
- Since:
- 1.3
- Default value:
CONVERSATION_SOURCE
-
list
This operation lists all messages sent or received via particularProcessingMode
.Setting the
messages_source
parameter toCONVERSATION_SOURCE
allows for querying messages inCONVERSATION
mode, and setting it toDISPATCH_SOURCE
will allow for queries of messages in DISPATCH mode.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, whereaccept_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:
request
- Request parameters- Returns:
- List of messages
- Since:
- 1.3
-
delete
Helper method fordelete(String, MessageSource)
- Parameters:
messageId
- The unique ID of the message.- Since:
- 1.3
- See Also:
-
delete
Delete a specific message by its ID.- Parameters:
messageId
- The unique ID of the message.messageSource
- Specifies the message source for which the request will be processed. Used for operations on messages in Dispatch Mode. For more information, see Processing Modes- Since:
- 1.3
- API Note:
- Removing all messages of a conversation will not automatically delete the conversation.
- Default value:
CONVERSATION_SOURCE
-
update
Helper method forupdate(String, MessageSource, MessageUpdateRequest)
- Parameters:
messageId
- The unique ID of the message.request
- Request parameters to be used for updating- Returns:
- Updated message
- Since:
- 1.3
- See Also:
-
update
ConversationMessage update(String messageId, MessagesService.MessageSource messageSource, MessageUpdateRequest request) Update a specific message by its ID.- Parameters:
messageId
- The unique ID of the messagemessageSource
- Specifies the message source for which the request will be processed. Used for operations on messages in Dispatch Mode. For more information, see Processing Modesrequest
- Request parameters to be used for updating- Returns:
- Updated message
- Since:
- 1.3
- Default value:
CONVERSATION_SOURCE
-