tock / ai.tock.bot.connector.whatsapp

Package ai.tock.bot.connector.whatsapp

WhatsApp connector implementation

Types

WhatsAppConnector

class WhatsAppConnector : ConnectorBase

WhatsAppConnectorCallback

The WhatsApp ConnectorCallback.

class WhatsAppConnectorCallback : ConnectorCallbackBase

WhatsAppConnectorData

Dedicated Whatsapp parameters.

class WhatsAppConnectorData : ConnectorData

Annotations

WhatsAppHandler

To specify ConnectorStoryHandler for WhatsApp connector. KClass passed as value of this annotation must have a primary constructor with a single not optional StoryHandlerDefinitionBase argument.

annotation class WhatsAppHandler

Properties

whatsAppConnectorType

The WhatsApp connector type.

val whatsAppConnectorType: ConnectorType

Functions

endForWhatsApp

Sends an WhatsApp message as last bot answer, only if the ConnectorType of the current BotBus is whatsAppConnectorType.

fun <T : Bus<T>> T.endForWhatsApp(messageProvider: T.() -> WhatsAppBotMessage, delay: Long = defaultDelay(currentAnswerIndex)): T

sendToWhatsApp

Sends an WhatsApp message only if the ConnectorType of the current BotBus is whatsAppConnectorType.

fun <T : Bus<T>> T.sendToWhatsApp(messageProvider: T.() -> WhatsAppBotMessage, delay: Long = defaultDelay(currentAnswerIndex)): T

whatsAppImage

Creates a WhatsAppBotImageMessage.

fun BotBus.whatsAppImage(byteImages: ByteArray, contentType: String = "image/png", caption: CharSequence? = null): WhatsAppBotImageMessage

whatsAppInteractiveMessage

Creates a WhatsAppBotInteractiveMessage

fun BotBus.whatsAppInteractiveMessage(nameSpace: String, templateName: String, components: List<WhatsAppComponent>? = emptyList()): WhatsAppBotInteractiveMessage

whatsAppText

Creates a WhatsAppBotTextMessage.

fun BotBus.whatsAppText(text: CharSequence, previewUrl: Boolean = false): WhatsAppBotTextMessage

withWhatsApp

Adds a WhatsApp ConnectorMessage if the current connector is WhatsApp. You need to call BotBus.send or BotBus.end later to send this message.

fun <T : Bus<T>> T.withWhatsApp(messageProvider: () -> WhatsAppBotMessage): T