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 thesend(String)
method within the builder. Make sure to at least add a message content usingmainContent(String)
. You can optionally set the user to send that message from using thesenderId(String)
method.- Author:
- Filip Hrisafov, Joram Barrez, Micha Kiener
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description MessageBuilder
actionDefinitionId(String actionDefinitionId)
Optionally reference an action definition given by its id.MessageBuilder
actionDefinitionKey(String key)
Optionally reference an action definition given by its key.MessageBuilder
actionInstanceId(String actionInstanceId)
MessageBuilder
addTag(String tag)
MessageBuilder
addTags(List<String> tags)
MessageBuilder
creatorId(String creatorId)
MessageBuilder
externalId(String externalId)
MessageBuilder
mainContent(String mainContent)
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).MessageBuilder
mainContentTemplate(String messageCode, String language, Map<String,Object> payload)
Deprecated.always use the method with the template key instead and provide your own keyMessageBuilder
mainContentType(String mainContentType)
MessageBuilder
media(ContentItem contentItem)
Send a media message with a provisional content itemMessageBuilder
media(ContentItem contentItem, InputStream contentStream)
MessageBuilder
privateGroupMessage(String recipientGroupId)
The message should be a private message for the group with therecipientGroupId
MessageBuilder
privateMessage(String recipientId)
The message should be a private message for the user with therecipientId
.MessageBuilder
replyToMessageId(String messageId)
MessageBuilder
scope(String scopeId, String scopeType)
Set an explicit scope for a referenced action definition to be passed on to the action instance, if created when posting this message.Message
send(String conversationId)
Creates and sends the message to the specified conversation.MessageBuilder
senderId(String senderId)
MessageBuilder
stickyMessage()
MessageBuilder
subType(String subType)
MessageBuilder
tags(List<String> tags)
MessageBuilder
type(String type)
MessageBuilder
updaterId(String updaterId)
-
-
-
Method Detail
-
creatorId
MessageBuilder creatorId(String creatorId)
-
senderId
MessageBuilder senderId(String senderId)
-
updaterId
MessageBuilder updaterId(String updaterId)
-
externalId
MessageBuilder externalId(String externalId)
-
actionInstanceId
MessageBuilder actionInstanceId(String actionInstanceId)
-
actionDefinitionId
MessageBuilder actionDefinitionId(String 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
MessageBuilder actionDefinitionKey(String key)
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
MessageBuilder mainContent(String 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
MessageBuilder mainContentType(String mainContentType)
-
media
MessageBuilder media(ContentItem contentItem, InputStream contentStream)
-
media
MessageBuilder media(ContentItem contentItem)
Send a media message with a provisional content item- Parameters:
contentItem
- the provisional content
-
type
MessageBuilder type(String type)
-
subType
MessageBuilder subType(String subType)
-
privateMessage
MessageBuilder privateMessage(String recipientId)
The message should be a private message for the user with therecipientId
.- Parameters:
recipientId
- the id of the recipient user
-
privateGroupMessage
MessageBuilder privateGroupMessage(String recipientGroupId)
The message should be a private message for the group with therecipientGroupId
- Parameters:
recipientGroupId
- the id of the recipient group
-
stickyMessage
MessageBuilder stickyMessage()
-
tags
MessageBuilder tags(List<String> tags)
-
addTag
MessageBuilder addTag(String tag)
-
addTags
MessageBuilder addTags(List<String> tags)
-
replyToMessageId
MessageBuilder replyToMessageId(String messageId)
-
scope
MessageBuilder scope(String scopeId, String scopeType)
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
-
-