Class WhatsAppJmsExternalConversationSystemAdapter
- java.lang.Object
-
- com.flowable.engage.external.system.whatsapp.WhatsAppJmsExternalConversationSystemAdapter
-
- All Implemented Interfaces:
ExternalConversationSystemAdapter,WhatsAppExternalConversationSystemAdapter
public class WhatsAppJmsExternalConversationSystemAdapter extends Object implements WhatsAppExternalConversationSystemAdapter
-
-
Field Summary
Fields Modifier and Type Field Description protected JmsMessageOperationsjmsMessagingOperationsprotected intmaximumMessageSizeprotected com.fasterxml.jackson.databind.ObjectMapperobjectMapperprotected StringoutboundMessageDestinationprotected Collection<String>supportedSendMessageTypes-
Fields inherited from interface com.flowable.engage.external.system.api.ExternalConversationSystemAdapter
SEND_DOCUMENT, SEND_IMAGE, SEND_REPLY, SEND_VIDEO, SEND_VOICE
-
-
Constructor Summary
Constructors Constructor Description WhatsAppJmsExternalConversationSystemAdapter(JmsMessageOperations jmsMessagingOperations, com.fasterxml.jackson.databind.ObjectMapper objectMapper, String outboundMessageDestination, int maximumMessageSize, Collection<String> supportedSendMessageTypes)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancheckMessageSize(String content)StringconvertAndCheckMessageSize(String message)WhatsAppContactVerificationQuerycreateContactVerificationQuery()Create the verification query for WhatsApp contacts.WhatsAppInteractiveMessageBuildercreateInteractiveMessageBuilder()Create a message builder for the WhatsApp interactive message.ExternalMessageBuildercreateMessageBuilder()Creates theExternalMessageBuilderthat is responsible for constructing the external message for the give external user id.WhatsAppTemplateMessageBuildercreateTemplateMessageBuilder()Create a message builder for the WhatsApp template message.Collection<String>fetchSupportedSendMessageTypes()StringgetExternalSystemId()Returns the id of the external system implemented by this adapter.voidmarkMessageAsRead(String whatsAppMessageId, String businessAccountId)Mark a WhatsApp message as read with the given business account.protected voidsend(Object payload, String type)voidsendMessageDuringCommitting(OutboundMessageDto outboundMessage)voidsendOutboundMessage(OutboundMessageDto outboundMessage)voidvalidateMessageContent(String messageContent, String messageCategory)Validates the content of the message.voidverifyContact(WhatsAppContactVerificationRequest payload)
-
-
-
Field Detail
-
jmsMessagingOperations
protected final JmsMessageOperations jmsMessagingOperations
-
objectMapper
protected final com.fasterxml.jackson.databind.ObjectMapper objectMapper
-
outboundMessageDestination
protected final String outboundMessageDestination
-
maximumMessageSize
protected final int maximumMessageSize
-
supportedSendMessageTypes
protected final Collection<String> supportedSendMessageTypes
-
-
Constructor Detail
-
WhatsAppJmsExternalConversationSystemAdapter
public WhatsAppJmsExternalConversationSystemAdapter(JmsMessageOperations jmsMessagingOperations, com.fasterxml.jackson.databind.ObjectMapper objectMapper, String outboundMessageDestination, int maximumMessageSize, Collection<String> supportedSendMessageTypes)
-
-
Method Detail
-
getExternalSystemId
public String getExternalSystemId()
Description copied from interface:ExternalConversationSystemAdapterReturns the id of the external system implemented by this adapter.- Specified by:
getExternalSystemIdin interfaceExternalConversationSystemAdapter- Returns:
- the external system id implemented by this adapter
-
createMessageBuilder
public ExternalMessageBuilder createMessageBuilder()
Description copied from interface:ExternalConversationSystemAdapterCreates theExternalMessageBuilderthat is responsible for constructing the external message for the give external user id. This is invoked by the engage system when sending out outbound messages.- Specified by:
createMessageBuilderin interfaceExternalConversationSystemAdapter- Returns:
- the
ExternalMessageBuilder
-
createInteractiveMessageBuilder
public WhatsAppInteractiveMessageBuilder createInteractiveMessageBuilder()
Description copied from interface:WhatsAppExternalConversationSystemAdapterCreate a message builder for the WhatsApp interactive message.- Specified by:
createInteractiveMessageBuilderin interfaceWhatsAppExternalConversationSystemAdapter- Returns:
- the interactive message builder
-
createTemplateMessageBuilder
public WhatsAppTemplateMessageBuilder createTemplateMessageBuilder()
Description copied from interface:WhatsAppExternalConversationSystemAdapterCreate a message builder for the WhatsApp template message.- Specified by:
createTemplateMessageBuilderin interfaceWhatsAppExternalConversationSystemAdapter- Returns:
- the template message builder
-
createContactVerificationQuery
public WhatsAppContactVerificationQuery createContactVerificationQuery()
Description copied from interface:WhatsAppExternalConversationSystemAdapterCreate the verification query for WhatsApp contacts.- Specified by:
createContactVerificationQueryin interfaceWhatsAppExternalConversationSystemAdapter- Returns:
- the verification query
-
markMessageAsRead
public void markMessageAsRead(String whatsAppMessageId, String businessAccountId)
Description copied from interface:WhatsAppExternalConversationSystemAdapterMark a WhatsApp message as read with the given business account.- Specified by:
markMessageAsReadin interfaceWhatsAppExternalConversationSystemAdapter- Parameters:
whatsAppMessageId- The id of the message in WhatsApp that should be marked as readbusinessAccountId- The business account id for which the message should be marked as read
-
validateMessageContent
public void validateMessageContent(String messageContent, String messageCategory)
Description copied from interface:ExternalConversationSystemAdapterValidates the content of the message. If the content is invalid an exception should be thrown.- Specified by:
validateMessageContentin interfaceExternalConversationSystemAdapter- Parameters:
messageContent- the content of the message that should be validatedmessageCategory- the message category
-
fetchSupportedSendMessageTypes
public Collection<String> fetchSupportedSendMessageTypes()
- Specified by:
fetchSupportedSendMessageTypesin interfaceExternalConversationSystemAdapter- Returns:
- the types of messages that the adapter can send
-
checkMessageSize
protected boolean checkMessageSize(String content)
-
sendOutboundMessage
public void sendOutboundMessage(OutboundMessageDto outboundMessage)
-
sendMessageDuringCommitting
public void sendMessageDuringCommitting(OutboundMessageDto outboundMessage)
-
verifyContact
public void verifyContact(WhatsAppContactVerificationRequest payload)
-
-