Package com.flowable.engage.message.api
Interface MessageBuilder
- All Known Implementing Classes:
MessageBuilderImpl
public interface MessageBuilder
The message builder API to create messages to be sent to a conversation using the
send(String)
method within the builder.
Make sure to at least add a message content using mainContent(String)
. You can optionally set the user to send that message from using the
senderId(String)
method.- Author:
- Filip Hrisafov, Joram Barrez, Micha Kiener
-
Method Summary
Modifier and TypeMethodDescriptionactionDefinitionId
(String actionDefinitionId) Optionally reference an action definition given by its id.Optionally reference an action definition given by its key.actionInstanceId
(String actionInstanceId) externalId
(String externalId) mainContent
(String mainContent) mainContentTemplate
(String templateKey, String messageCode, String language, Map<String, Object> payload) Adds content being rendered from the specified template (uses "standardMessage" as the template key and the provided message code and optional language as the variation).Deprecated.always use the method with the template key instead and provide your own keymainContentType
(String mainContentType) media
(ContentItem contentItem) Send a media message with a provisional content itemmedia
(ContentItem contentItem, InputStream contentStream) privateGroupMessage
(String recipientGroupId) The message should be a private message for the group with therecipientGroupId
privateMessage
(String recipientId) The message should be a private message for the user with therecipientId
.replyToMessageId
(String messageId) Set an explicit scope for a referenced action definition to be passed on to the action instance, if created when posting this message.Creates and sends the message to the specified conversation.
-
Method Details
-
creatorId
-
senderId
-
updaterId
-
externalId
-
actionInstanceId
-
actionDefinitionId
Optionally reference an action definition given by its id. The message will then reference that action definition by creating an action instance based on it within the send method. You might want to set an explicit scope for the action instance too usingscope(String, String)
, if not set, the conversation is automatically used as the scope for the action instance.- Parameters:
actionDefinitionId
- the id of the action definition to create an action instance for, which is then referenced by this message- Returns:
- the message builder for method chaining
-
actionDefinitionKey
Optionally reference an action definition given by its key. The message will then reference that action definition by creating an action instance based on it within the send method. You might want to set an explicit scope for the action instance too usingscope(String, String)
, if not set, the conversation is automatically used as the scope for the action instance.- Parameters:
key
- the key of the action definition to create an action instance for, which is then referenced by this message- Returns:
- the message builder for method chaining
-
mainContent
-
mainContentTemplate
@Deprecated MessageBuilder mainContentTemplate(String messageCode, String language, Map<String, Object> payload) Deprecated.always use the method with the template key instead and provide your own keyAdds content being rendered from the specified template (uses "standardMessage" as the template key and the provided message code and optional language as the variation). If the template has placeholders, then the payload needs to be provided as well in order to let the template engine render it.- Parameters:
messageCode
- the message code to be used for the variation of the templatelanguage
- the language ornull
to use the default onepayload
- the optional payload containing the values for the placeholder of the template, if needed- Returns:
- the message builder for method chaining
-
mainContentTemplate
MessageBuilder mainContentTemplate(String templateKey, String messageCode, String language, Map<String, Object> payload) Adds content being rendered from the specified template (uses "standardMessage" as the template key and the provided message code and optional language as the variation). If the template has placeholders, then the payload needs to be provided as well in order to let the template engine render it.- Parameters:
templateKey
- the key of the template to be used (will be "standardMessage", if none provided explicitly)messageCode
- the message code to be used for the variation of the templatelanguage
- the language ornull
to use the default onepayload
- the optional payload containing the values for the placeholder of the template, if needed- Returns:
- the message builder for method chaining
-
mainContentType
-
media
-
media
Send a media message with a provisional content item- Parameters:
contentItem
- the provisional content
-
type
-
subType
-
privateMessage
The message should be a private message for the user with therecipientId
.- Parameters:
recipientId
- the id of the recipient user
-
privateGroupMessage
The message should be a private message for the group with therecipientGroupId
- Parameters:
recipientGroupId
- the id of the recipient group
-
stickyMessage
MessageBuilder stickyMessage() -
tags
-
addTag
-
addTags
-
replyToMessageId
-
scope
Set an explicit scope for a referenced action definition to be passed on to the action instance, if created when posting this message. If not explicitly set, the conversation is used as the scope this message is sent to.- Parameters:
scopeId
- the id of the scope a referenced action definition should be bound toscopeType
- the type of the scope for the referenced action definition- Returns:
- the message builder for method chaining
-
send
Creates and sends the message to the specified conversation.- Parameters:
conversationId
- the id of the conversation to send the message to- Returns:
- the created and sent message object
-