Class BaseExternalMessageBuilder
- java.lang.Object
-
- com.flowable.engage.external.system.common.BaseExternalMessageBuilder
-
- All Implemented Interfaces:
ExternalMessageBuilder
- Direct Known Subclasses:
LineExternalMessageBuilder,WeChatExternalMessageBuilder,WhatsAppExternalMessageBuilder
public abstract class BaseExternalMessageBuilder extends Object implements ExternalMessageBuilder
Base class that can be used by different external system provider to provide an implementation for the sending of the outbound message.- Author:
- Filip Hrisafov
-
-
Field Summary
Fields Modifier and Type Field Description protected StringbusinessAccountIdprotected StringexternalUserIdprotected Stringmessageprotected StringmessageId
-
Constructor Summary
Constructors Constructor Description BaseExternalMessageBuilder()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description ExternalMessageBuilderbusinessAccountId(String businessAccountId)The id of the business account for the external userprotected voidcheckBeforeSend(String type)Perform certain checks before sending the message.protected OutboundMessageDtocreateOutboundMessage(String type)ExternalMessageBuilderexternalUserId(String externalUserId)The id of the external user to which the message should be send toExternalMessageBuildermessage(String message)The contents of the message that needs to be sendExternalMessageBuildermessageId(String messageId)The id of the message being send (can be used for logging purposes)protected OutboundMessageDtonewOutboundMessageDto()voidsendMediaMessage(String mediaId)Perform sending of media messagevoidsendMessage()Perform sending a normal text messageprotected abstract voidsendOutboundMessage(OutboundMessageDto outboundMessage)protected StringvalidateAndCreateMessageContent(String type)This method is invoked when the content for the outbound message is create.
-
-
-
Method Detail
-
externalUserId
public ExternalMessageBuilder externalUserId(String externalUserId)
Description copied from interface:ExternalMessageBuilderThe id of the external user to which the message should be send to- Specified by:
externalUserIdin interfaceExternalMessageBuilder- Parameters:
externalUserId- the external user id
-
businessAccountId
public ExternalMessageBuilder businessAccountId(String businessAccountId)
Description copied from interface:ExternalMessageBuilderThe id of the business account for the external user- Specified by:
businessAccountIdin interfaceExternalMessageBuilder- Parameters:
businessAccountId- the bussiness account id
-
messageId
public ExternalMessageBuilder messageId(String messageId)
Description copied from interface:ExternalMessageBuilderThe id of the message being send (can be used for logging purposes)- Specified by:
messageIdin interfaceExternalMessageBuilder- Parameters:
messageId- the message id
-
message
public ExternalMessageBuilder message(String message)
Description copied from interface:ExternalMessageBuilderThe contents of the message that needs to be send- Specified by:
messagein interfaceExternalMessageBuilder- Parameters:
message- the message content
-
sendMessage
public void sendMessage()
Description copied from interface:ExternalMessageBuilderPerform sending a normal text message- Specified by:
sendMessagein interfaceExternalMessageBuilder
-
sendMediaMessage
public void sendMediaMessage(String mediaId)
Description copied from interface:ExternalMessageBuilderPerform sending of media message- Specified by:
sendMediaMessagein interfaceExternalMessageBuilder- Parameters:
mediaId- the id of the media that is being sent
-
checkBeforeSend
protected void checkBeforeSend(String type)
Perform certain checks before sending the message. By default this checks that theexternalUserIdandmessageIdhave been set.- Parameters:
type- the type of message that is being send
-
sendOutboundMessage
protected abstract void sendOutboundMessage(OutboundMessageDto outboundMessage)
-
createOutboundMessage
protected OutboundMessageDto createOutboundMessage(String type)
-
newOutboundMessageDto
protected OutboundMessageDto newOutboundMessageDto()
-
validateAndCreateMessageContent
protected String validateAndCreateMessageContent(String type)
This method is invoked when the content for the outbound message is create. It can be used to perform validations and to modify the content if it is required. By default this methods appends the display name to the message.- Parameters:
type- the type of the message for which the content is being created- Returns:
- the content that should be used to send the message
-
-