tock / ai.tock.bot.engine / Bus

Bus

interface Bus<T : Bus<T>> : I18nTranslator (source)

A new bus instance is created for each user request.

The bus is used by bot implementations to reply to the user request.

Properties

applicationId

The current application id.

abstract val applicationId: String

botId

The current bot id.

abstract val botId: PlayerId

currentAnswerIndex

The current answer index of the bot for this action.

abstract val currentAnswerIndex: Int

currentIntent

The current intent for this user (may be different from the initial intent).

open val currentIntent: IntentAware?

intent

The current intent of the dialog at Bus (ie request) initialization.

abstract val intent: IntentAware?

stepName

The name of the step if any.

abstract val stepName: String?

test

Is it a test mode ?

abstract val test: Boolean

userId

The current user id.

abstract val userId: PlayerId

Functions

defaultDelay

Get the default delay between two answers.

abstract fun defaultDelay(answerIndex: Int): Long

end

Sends i18nText as last bot answer.

open fun end(i18nText: CharSequence, delay: Long = defaultDelay(currentAnswerIndex), vararg i18nArgs: Any?): T
open fun end(i18nText: CharSequence, vararg i18nArgs: Any?): T

Send previously registered ConnectorMessage as last bot answer.

open fun end(delay: Long = defaultDelay(currentAnswerIndex)): T

Sends messages provided by messageProvider as last bot answer. if messageProvider returns a CharSequence send it as text. Else call simply end().

open fun end(delay: Long = defaultDelay(currentAnswerIndex), messageProvider: T.() -> Any?): T

endRawText

Sends text that should not be translated as last bot answer.

abstract fun endRawText(plainText: CharSequence?, delay: Long = defaultDelay(currentAnswerIndex)): T

send

Sends previously registered ConnectorMessage.

open fun send(delay: Long = defaultDelay(currentAnswerIndex)): T

Sends i18nText.

open fun send(i18nText: CharSequence, delay: Long = defaultDelay(currentAnswerIndex), vararg i18nArgs: Any?): T
open fun send(i18nText: CharSequence, vararg i18nArgs: Any?): T

Sends messages provided by messageProvider. if messageProvider returns a CharSequence send it as text. Else call simply send().

open fun send(delay: Long = defaultDelay(currentAnswerIndex), messageProvider: T.() -> Any?): T

sendRawText

Send text that should not be translated.

abstract fun sendRawText(plainText: CharSequence?, delay: Long = defaultDelay(currentAnswerIndex)): T

withMessage

Adds the specified ConnectorMessage to the bus context if the targetConnectorType is compatible.

open fun withMessage(message: ConnectorMessage): T
abstract fun withMessage(connectorType: ConnectorType, messageProvider: () -> ConnectorMessage): T

Adds the specified ConnectorMessage to the bus context if the targetConnectorType and connectorId is compatible.

abstract fun withMessage(connectorType: ConnectorType, connectorId: String, messageProvider: () -> ConnectorMessage): T

Extension Functions

alexaReprompt

Set a reprompt.

fun I18nTranslator.alexaReprompt(reprompt: CharSequence): AlexaMessage

alexaStandardCard

Add the specified card.

fun I18nTranslator.alexaStandardCard(title: CharSequence, text: CharSequence, smallImageUrl: String, largeImageUrl: String = smallImageUrl): AlexaMessage

attachment

Creates an attachment.

fun <T : Bus<T>> T.attachment(attachmentUrl: String, type: AttachmentType, vararg quickReplies: QuickReply): AttachmentMessage
fun <T : Bus<T>> T.attachment(attachmentUrl: String, type: AttachmentType, quickReplies: List<QuickReply>): AttachmentMessage

attachmentField

fun I18nTranslator.attachmentField(title: String, value: String, short: Boolean = true): AttachmentField

audio

Creates an audio file as attachment (https://developers.facebook.com/docs/messenger-platform/reference/send-api/#attachment).

fun <T : Bus<T>> T.audio(audioUrl: String, vararg quickReplies: QuickReply): AttachmentMessage
fun <T : Bus<T>> T.audio(audioUrl: String, quickReplies: List<QuickReply>): AttachmentMessage

basicCard

Provides a GABasicCard with all available parameters.

fun I18nTranslator.basicCard(title: CharSequence?, subtitle: CharSequence?, formattedText: CharSequence?, image: GAImage?, buttons: List<GAButton>): GABasicCard

Provides a GABasicCard with only one GAButton (only one is supported for now anyway).

fun I18nTranslator.basicCard(title: CharSequence? = null, subtitle: CharSequence? = null, formattedText: CharSequence? = null, image: GAImage? = null, button: GAButton? = null): GABasicCard

Provides a GABasicCard without formattedText.

fun I18nTranslator.basicCard(title: CharSequence, subtitle: CharSequence, image: GAImage, button: GAButton): GABasicCard

Provides a GABasicCard with title and button.

fun I18nTranslator.basicCard(title: CharSequence, button: GAButton): GABasicCard

Provides a GABasicCard with title and subtitle.

fun I18nTranslator.basicCard(title: CharSequence, subtitle: CharSequence): GABasicCard

Provides a GABasicCard with title and image.

fun I18nTranslator.basicCard(title: CharSequence, image: GAImage): GABasicCard

Provides a GABasicCard with title, subtitle and image.

fun I18nTranslator.basicCard(title: CharSequence, subtitle: CharSequence, image: GAImage): GABasicCard

Provides a GABasicCard with an image.

fun I18nTranslator.basicCard(image: GAImage): GABasicCard

buttonsTemplate

Creates a button template https://developers.facebook.com/docs/messenger-platform/send-api-reference/button-template

fun I18nTranslator.buttonsTemplate(text: CharSequence, vararg actions: UserAction): AttachmentMessage
fun I18nTranslator.buttonsTemplate(text: CharSequence, actions: List<UserAction>): AttachmentMessage

callToButton

fun I18nTranslator.callToButton(title: CharSequence, phoneNumber: String): CallButton

carouselItem

Provides a GACarouselItem with String parameters.

fun <T : Bus<T>> T.carouselItem(targetIntent: IntentAware, title: CharSequence, description: CharSequence? = null, image: GAImage? = null, vararg parameters: Pair<String, String>): GACarouselItem

Provides a GACarouselItem with Parameters parameters.

fun <T : Bus<T>> T.carouselItem(targetIntent: IntentAware, title: CharSequence, description: CharSequence? = null, image: GAImage? = null, parameters: Parameters): GACarouselItem

Provides a GACarouselItem with StoryStep and Parameters parameters.

fun <T : Bus<T>> T.carouselItem(targetIntent: IntentAware, step: StoryStep<out StoryHandlerDefinition>?, title: CharSequence, description: CharSequence? = null, image: GAImage? = null, parameters: Parameters): GACarouselItem

Provides a GACarouselItem with StoryStep and String parameters.

fun <T : Bus<T>> T.carouselItem(targetIntent: IntentAware, step: StoryStep<out StoryHandlerDefinition>?, title: CharSequence, description: CharSequence? = null, image: GAImage? = null, vararg parameters: Pair<String, String>): GACarouselItem

directMessage

Creates a direct message with only text

fun <T : Bus<T>> T.directMessage(message: CharSequence): OutcomingEvent

directMessageWithAttachment

Creates a direct message with an attachment

fun <T : Bus<T>> T.directMessageWithAttachment(message: CharSequence, mediaCategory: MediaCategory, contentType: String, bytes: ByteArray, vararg options: Option): OutcomingEvent
fun <T : Bus<T>> T.directMessageWithAttachment(message: CharSequence, mediaCategory: MediaCategory, contentType: String, bytes: ByteArray, vararg options: OptionWithoutDescription): OutcomingEvent

directMessageWithButtons

Creates a direct message with Buttons

fun <T : Bus<T>> T.directMessageWithButtons(message: CharSequence, ctas: List<CTA>): OutcomingEvent
fun <T : Bus<T>> T.directMessageWithButtons(message: CharSequence, vararg ctas: CTA): OutcomingEvent

directMessageWithGIF

Creates a direct message with a gif (Max 15MB)

fun <T : Bus<T>> T.directMessageWithGIF(message: CharSequence, contentType: String, bytes: ByteArray, vararg options: Option): OutcomingEvent
fun <T : Bus<T>> T.directMessageWithGIF(message: CharSequence, contentType: String, bytes: ByteArray, vararg options: OptionWithoutDescription): OutcomingEvent
fun <T : Bus<T>> T.directMessageWithGIF(contentType: String, bytes: ByteArray, vararg options: Option): OutcomingEvent
fun <T : Bus<T>> T.directMessageWithGIF(contentType: String, bytes: ByteArray, vararg options: OptionWithoutDescription): OutcomingEvent

directMessageWithImage

Creates a direct message with an image (Max 5MB)

fun <T : Bus<T>> T.directMessageWithImage(message: CharSequence, contentType: String, bytes: ByteArray, vararg options: Option): OutcomingEvent
fun <T : Bus<T>> T.directMessageWithImage(message: CharSequence, contentType: String, bytes: ByteArray, vararg options: OptionWithoutDescription): OutcomingEvent
fun <T : Bus<T>> T.directMessageWithImage(contentType: String, bytes: ByteArray, vararg options: Option): OutcomingEvent
fun <T : Bus<T>> T.directMessageWithImage(contentType: String, bytes: ByteArray, vararg options: OptionWithoutDescription): OutcomingEvent

directMessageWithOptions

Creates a direct message with quick replies

fun <T : Bus<T>> T.directMessageWithOptions(message: CharSequence, vararg options: Option): OutcomingEvent
fun <T : Bus<T>> T.directMessageWithOptions(message: CharSequence, vararg options: OptionWithoutDescription): OutcomingEvent

directMessageWithVideo

Creates a direct message with a video (Max 15MB)

fun <T : Bus<T>> T.directMessageWithVideo(message: CharSequence, contentType: String, bytes: ByteArray, vararg options: Option): OutcomingEvent
fun <T : Bus<T>> T.directMessageWithVideo(message: CharSequence, contentType: String, bytes: ByteArray, vararg options: OptionWithoutDescription): OutcomingEvent
fun <T : Bus<T>> T.directMessageWithVideo(contentType: String, bytes: ByteArray, vararg options: Option): OutcomingEvent
fun <T : Bus<T>> T.directMessageWithVideo(contentType: String, bytes: ByteArray, vararg options: OptionWithoutDescription): OutcomingEvent

endForAlexa

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

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

endForGoogleAssistant

Sends a Google Assistant message as last bot answer, only if the ConnectorType of the current BotBus is gaConnectorType.

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

endForMessenger

Sends a Messenger message as last bot answer, only if the ConnectorType of the current Bus is messengerConnectorType.

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

endForSlack

Sends a Slack message as last bot answer, only if the ConnectorType of the current BotBus is slackConnectorType.

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

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

expectedIntentForCarousel

Provides a GAExpectedIntent with a GACarouselSelect.

fun I18nTranslator.expectedIntentForCarousel(items: List<GACarouselItem>): GAExpectedIntent

expectedIntentForList

Provides a GAExpectedIntent with a GAListSelect.

fun I18nTranslator.expectedIntentForList(items: List<GAListItem>, title: CharSequence? = null): GAExpectedIntent

expectedIntentForSimpleSelect

Provides a GAExpectedIntent with a GASimpleSelect.

fun I18nTranslator.expectedIntentForSimpleSelect(items: List<GASelectItem>): GAExpectedIntent

flexibleSimpleResponse

Provides a GASimpleResponse with specified textToSpeech, ssml and displayText.

fun I18nTranslator.flexibleSimpleResponse(textToSpeech: CharSequence? = null, ssml: CharSequence? = null, displayText: CharSequence? = null): GASimpleResponse

gaButton

Provides a GAButton.

fun I18nTranslator.gaButton(title: CharSequence, url: String): GAButton

gaFinalMessage

Final Google Assistant message (end of conversation).

fun I18nTranslator.gaFinalMessage(richResponse: GARichResponse): GAResponseConnectorMessage
fun I18nTranslator.gaFinalMessage(text: CharSequence? = null): GAResponseConnectorMessage

gaFlexibleMessageForCarousel

Add a basic card if only one element in the items list, in order to avoid the limitation of 2 items.

fun I18nTranslator.gaFlexibleMessageForCarousel(items: List<GACarouselItem>, suggestions: List<CharSequence> = emptyList(), oneItemTitle: CharSequence? = null, oneItemSubtitle: CharSequence? = null, oneItemDescription: CharSequence? = null, oneItemSuggestions: List<CharSequence> = emptyList()): GAResponseConnectorMessage
fun I18nTranslator.gaFlexibleMessageForCarousel(items: List<GACarouselItem>, suggestions: List<CharSequence> = emptyList(), oneItemSuggestions: List<CharSequence> = emptyList(), oneItemBasicCardProvider: (GACarouselItem) -> GABasicCard = { basicCard( it.title.raw, if (it.image != null) it.description?.raw else null, if (it.image == null) it.description?.raw else null, it.image ) }): GAResponseConnectorMessage

gaFlexibleMessageForList

Add a basic card if only one element in the items list in order to avoid the limitation of 2 items.

fun I18nTranslator.gaFlexibleMessageForList(items: List<GAListItem>, title: CharSequence? = null, suggestions: List<CharSequence> = emptyList(), oneItemTitle: CharSequence? = null, oneItemSubtitle: CharSequence? = null, oneItemDescription: CharSequence? = null, oneItemSuggestions: List<CharSequence> = emptyList()): GAResponseConnectorMessage

gaImage

Provides a GAImage with all available parameters.

fun I18nTranslator.gaImage(url: String, accessibilityText: CharSequence, height: Int? = null, width: Int? = null): GAImage

gaMessage

Google Assistant Message with all available parameters.

fun I18nTranslator.gaMessage(inputPrompt: GAInputPrompt, possibleIntents: List<GAExpectedIntent> = listOf( expectedTextIntent() ), speechBiasingHints: List<String> = emptyList()): GAResponseConnectorMessage

Google Assistant Message with suggestions.

fun I18nTranslator.gaMessage(text: CharSequence, vararg suggestions: CharSequence): GAResponseConnectorMessage

Google Assistant Message with GABasicCard.

fun I18nTranslator.gaMessage(text: CharSequence, basicCard: GABasicCard): GAResponseConnectorMessage

Google Assistant Message with GARichResponse.

fun I18nTranslator.gaMessage(richResponse: GARichResponse): GAResponseConnectorMessage

Google Assistant Message with one GAExpectedIntent.

fun I18nTranslator.gaMessage(possibleIntent: GAExpectedIntent): GAResponseConnectorMessage

Google Assistant Message with multiple GAExpectedIntent.

fun I18nTranslator.gaMessage(possibleIntents: List<GAExpectedIntent>): GAResponseConnectorMessage

Google Assistant Message with text and multiple GAExpectedIntent.

fun I18nTranslator.gaMessage(text: CharSequence, possibleIntents: List<GAExpectedIntent>): GAResponseConnectorMessage

Provides a message with a GAListSelect.

fun I18nTranslator.gaMessage(gaRichResponse: GARichResponse, listItems: List<GAListItem>, title: CharSequence? = null): GAResponseConnectorMessage

gaMessageForCarousel

Provides a message with a GACarouselSelect.

fun I18nTranslator.gaMessageForCarousel(items: List<GACarouselItem>, suggestions: List<CharSequence> = emptyList()): GAResponseConnectorMessage

gaMessageForList

Provides a message with a GAListSelect and a list of GASuggestion.

fun I18nTranslator.gaMessageForList(items: List<GAListItem>, title: CharSequence? = null, suggestions: List<CharSequence> = emptyList()): GAResponseConnectorMessage

gaTransactionOrderDecision

Build an GATransactionDecisionValueSpecV3 message.

fun I18nTranslator.gaTransactionOrderDecision(order: GAOrder, orderOptions: GAOrderOptionsV3? = null, paymentParameters: GAPaymentParameters? = null, presentationOptions: GAPresentationOptions? = null): GAResponseConnectorMessage

gaTransactionOrderUpdate

Build an GAStructuredResponse from an GAOrderUpdateV3.

fun I18nTranslator.gaTransactionOrderUpdate(orderUpdate: GAOrderUpdateV3): GAResponseConnectorMessage

gaTransactionRequirementsCheckV3

Build a GATransactionRequirementsCheckSpecV3 response.

fun I18nTranslator.gaTransactionRequirementsCheckV3(): GAResponseConnectorMessage

genericElement

Creates a generic element.

fun I18nTranslator.genericElement(title: CharSequence, subtitle: CharSequence? = null, imageUrl: String? = null, buttons: List<Button>? = null): Element

image

Creates an image as attachment (https://developers.facebook.com/docs/messenger-platform/reference/send-api/#attachment).

fun <T : Bus<T>> T.image(imageUrl: String, vararg quickReplies: QuickReply): AttachmentMessage
fun <T : Bus<T>> T.image(imageUrl: String, quickReplies: List<QuickReply>): AttachmentMessage

inputPrompt

Provides a GAInputPrompt with all available parameters.

fun I18nTranslator.inputPrompt(richResponse: GARichResponse, noInputPrompts: List<GASimpleResponse> = emptyList()): GAInputPrompt

Provides a GAInputPrompt with a simple GARichResponse builder.

fun I18nTranslator.inputPrompt(text: CharSequence, linkOutSuggestion: GALinkOutSuggestion? = null, noInputPrompts: List<GASimpleResponse> = emptyList()): GAInputPrompt

item

Provides a GAItem with all available parameters.

fun I18nTranslator.item(simpleResponse: GASimpleResponse? = null, basicCard: GABasicCard? = null, structuredResponse: GAStructuredResponse? = null): GAItem

Provides a GAItem with a GABasicCard.

fun I18nTranslator.item(basicCard: GABasicCard): GAItem

Provides a GAItem with a GAStructuredResponse.

fun I18nTranslator.item(structuredResponse: GAStructuredResponse): GAItem

Provides a GAItem with a GASimpleResponse.

fun I18nTranslator.item(simpleResponse: GASimpleResponse): GAItem

linkOutSuggestion

Provides a GALinkOutSuggestion.

fun I18nTranslator.linkOutSuggestion(destinationName: CharSequence, url: String): GALinkOutSuggestion

listItem

Provides a GAListItem with String parameters without description.

fun <T : Bus<T>> T.listItem(title: CharSequence, targetIntent: IntentAware, vararg parameters: Pair<String, String>): GAListItem
fun <T : Bus<T>> T.listItem(title: CharSequence, targetIntent: IntentAware, parameters: Parameters): GAListItem

Provides a GAListItem with String parameters with description and optional imageUrl.

fun <T : Bus<T>> T.listItem(title: CharSequence, targetIntent: IntentAware, description: CharSequence, imageUrl: String? = null, vararg parameters: Pair<String, String>): GAListItem

Provides a GAListItem with String parameters with description and optional imageUrl.

fun <T : Bus<T>> T.listItem(title: CharSequence, targetIntent: IntentAware, description: CharSequence?, imageUrl: String? = null, parameters: Parameters): GAListItem

Provides a GAListItem with StoryStep and Parameters parameters without description.

fun <T : Bus<T>> T.listItem(title: CharSequence, targetIntent: IntentAware, step: StoryStep<out StoryHandlerDefinition>?, parameters: Parameters): GAListItem
fun <T : Bus<T>> T.listItem(title: CharSequence, targetIntent: IntentAware, step: StoryStep<out StoryHandlerDefinition>?, vararg parameters: Pair<String, String>): GAListItem

Provides a GAListItem with StoryStep and Parameters parameters.

fun <T : Bus<T>> T.listItem(title: CharSequence, targetIntent: IntentAware, step: StoryStep<out StoryHandlerDefinition>?, description: CharSequence? = null, imageUrl: String? = null, parameters: Parameters): GAListItem
fun <T : Bus<T>> T.listItem(title: CharSequence, targetIntent: IntentAware, step: StoryStep<out StoryHandlerDefinition>?, description: CharSequence? = null, imageUrl: String? = null, vararg parameters: Pair<String, String>): GAListItem

multiLineMessage

fun I18nTranslator.multiLineMessage(lines: List<CharSequence>, channel: String? = null): SlackMessageOut

nlpCardAction

fun <T : Bus<T>> T.nlpCardAction(title: CharSequence): CardAction

nlpOption

Creates a NLP Option Quick Reply without description

fun I18nTranslator.nlpOption(label: CharSequence): OptionWithoutDescription
fun I18nTranslator.nlpOption(label: CharSequence, description: CharSequence): Option

nlpPostbackButton

This button does not use any custom payload, but the textToSend will we parsed by the NLP engine.

fun I18nTranslator.nlpPostbackButton(title: CharSequence, textToSend: CharSequence = title): PostbackButton

nlpQuickReply

This quick reply does not use any custom payload, but the textToSend will we parsed by the NLP engine.

fun I18nTranslator.nlpQuickReply(title: CharSequence, textToSend: CharSequence = title, imageUrl: String? = null): QuickReply

option

Creates an Option Quick Reply

fun <T : Bus<T>> T.option(label: CharSequence, description: CharSequence, targetIntent: IntentAware, step: StoryStep<out StoryHandlerDefinition>? = null, vararg parameters: Pair<String, String>): Option
fun <T : Bus<T>> T.option(label: CharSequence, description: CharSequence, targetIntent: IntentAware, step: StoryStep<out StoryHandlerDefinition>? = null, parameters: Map<String, String>): Option

Creates an Option Quick Reply without description

fun <T : Bus<T>> T.option(label: CharSequence, targetIntent: IntentAware, step: StoryStep<out StoryHandlerDefinition>? = null, vararg parameters: Pair<String, String>): OptionWithoutDescription
fun <T : Bus<T>> T.option(label: CharSequence, targetIntent: IntentAware, step: StoryStep<out StoryHandlerDefinition>? = null, parameters: Map<String, String>): OptionWithoutDescription

optionInfo

Provides a GAOptionInfo with all available parameters.

fun <T : Bus<T>> T.optionInfo(title: CharSequence, targetIntent: IntentAware, step: StoryStep<out StoryHandlerDefinition>? = null, vararg parameters: Pair<String, String>): GAOptionInfo

optionValueSpec

Provides a GAOptionValueSpec with all available parameters.

fun I18nTranslator.optionValueSpec(simpleSelect: GASimpleSelect? = null, listSelect: GAListSelect? = null, carouselSelect: GACarouselSelect? = null): GAOptionValueSpec

permissionIntent

Google Assistant Message asking for GAPermission.

fun I18nTranslator.permissionIntent(optionalContext: CharSequence? = null, vararg permissions: GAPermission): GAExpectedIntent

postbackButton

Creates a postback button.

fun <T : Bus<T>> T.postbackButton(title: CharSequence, targetIntent: IntentAware, vararg parameters: Pair<String, String>): PostbackButton
fun <T : Bus<T>> T.postbackButton(title: CharSequence, targetIntent: IntentAware, parameters: Parameters): PostbackButton
fun <T : Bus<T>> T.postbackButton(title: CharSequence, targetIntent: IntentAware, step: StoryStep<out StoryHandlerDefinition>? = null, parameters: Parameters): PostbackButton
fun <T : Bus<T>> T.postbackButton(title: CharSequence, targetIntent: IntentAware, step: StoryStep<out StoryHandlerDefinition>? = null, vararg parameters: Pair<String, String>): PostbackButton

quickReply

Creates a quick reply.

fun <T : Bus<T>> T.quickReply(title: CharSequence, targetIntent: IntentAware, parameters: Parameters): QuickReply
fun <T : Bus<T>> T.quickReply(title: CharSequence, targetIntent: IntentAware, imageUrl: String? = null, step: StoryStep<out StoryHandlerDefinition>? = null, parameters: Parameters): QuickReply
fun <T : Bus<T>> T.quickReply(title: CharSequence, targetIntent: IntentAware, imageUrl: String? = null, step: StoryStep<out StoryHandlerDefinition>? = null, parameters: Collection<Pair<String, String>>): QuickReply
fun <T : Bus<T>> T.quickReply(title: CharSequence, targetIntent: IntentAware, imageUrl: String? = null, step: StoryStep<out StoryHandlerDefinition>? = null, parameters: Map<String, String>): QuickReply

Create a quick reply.

fun <T : Bus<T>> T.quickReply(title: CharSequence, targetIntent: IntentAware, imageUrl: String? = null, step: StoryStep<out StoryHandlerDefinition>? = null, vararg parameters: Pair<String, String>): QuickReply

richResponse

Provides a GARichResponse with suggestions as String.

fun I18nTranslator.richResponse(items: List<GAItem>, linkOutSuggestion: GALinkOutSuggestion? = null, vararg suggestions: CharSequence): GARichResponse

Provides a GARichResponse without linkOutSuggestion.

fun I18nTranslator.richResponse(items: List<GAItem>, vararg suggestions: CharSequence): GARichResponse
fun I18nTranslator.richResponse(items: List<GAItem>, suggestions: List<CharSequence>): GARichResponse

Provides a GARichResponse with only one GAItem.

fun I18nTranslator.richResponse(item: GAItem, linkOutSuggestion: GALinkOutSuggestion? = null, suggestions: List<CharSequence>): GARichResponse
fun I18nTranslator.richResponse(item: GAItem, linkOutSuggestion: GALinkOutSuggestion? = null, vararg suggestions: CharSequence): GARichResponse

Provides a GARichResponse with text item.

fun I18nTranslator.richResponse(text: CharSequence, linkOutSuggestion: GALinkOutSuggestion? = null, suggestions: List<CharSequence>): GARichResponse
fun I18nTranslator.richResponse(text: CharSequence, linkOutSuggestion: GALinkOutSuggestion? = null, vararg suggestions: CharSequence): GARichResponse
fun I18nTranslator.richResponse(text: CharSequence, vararg suggestions: CharSequence): GARichResponse
fun I18nTranslator.richResponse(text: CharSequence, suggestions: List<CharSequence>): GARichResponse

Provides a GARichResponse with a text and a GABasicCard.

fun I18nTranslator.richResponse(text: CharSequence, basicCard: GABasicCard, linkOutSuggestion: GALinkOutSuggestion? = null, suggestions: List<CharSequence>): GARichResponse
fun I18nTranslator.richResponse(text: CharSequence, basicCard: GABasicCard, suggestions: List<CharSequence>): GARichResponse
fun I18nTranslator.richResponse(text: CharSequence, basicCard: GABasicCard, vararg suggestions: CharSequence): GARichResponse

Provides a GARichResponse with a GABasicCard.

fun I18nTranslator.richResponse(basicCard: GABasicCard, linkOutSuggestion: GALinkOutSuggestion? = null, suggestions: List<CharSequence>): GARichResponse
fun I18nTranslator.richResponse(basicCard: GABasicCard, suggestions: List<CharSequence>): GARichResponse
fun I18nTranslator.richResponse(basicCard: GABasicCard, vararg suggestions: CharSequence): GARichResponse

selectItem

Provides a GASelectItem with String parameters.

fun <T : Bus<T>> T.selectItem(title: CharSequence, targetIntent: IntentAware, vararg parameters: Pair<String, String>): GASelectItem

Provides a GASelectItem with option title and String parameters.

fun <T : Bus<T>> T.selectItem(title: CharSequence, targetIntent: IntentAware, optionTitle: CharSequence? = null, vararg parameters: Pair<String, String>): GASelectItem

Provides a GASelectItem with option title, StoryStep and Parameters parameters.

fun <T : Bus<T>> T.selectItem(title: CharSequence, targetIntent: IntentAware, step: StoryStep<out StoryHandlerDefinition>, optionTitle: CharSequence? = null, parameters: Parameters): GASelectItem

Provides a GASelectItem with option title, StoryStep and String parameters.

fun <T : Bus<T>> T.selectItem(title: CharSequence, targetIntent: IntentAware, step: StoryStep<out StoryHandlerDefinition>? = null, optionTitle: CharSequence? = null, vararg parameters: Pair<String, String>): GASelectItem

sendToAlexa

Sends an Alexa message only if the ConnectorType of the current BotBus is alexaConnectorType.

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

sendToGoogleAssistant

Sends a Google Assistant message only if the ConnectorType of the current BotBus is gaConnectorType.

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

sendToMessenger

Sends a Messenger message only if the ConnectorType of the current Bus is messengerConnectorType.

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

sendToSlack

Sends a Slack message only if the ConnectorType of the current BotBus is slackConnectorType.

fun <T : Bus<T>> T.sendToSlack(delay: Long = defaultDelay(currentAnswerIndex), messageProvider: T.() -> SlackConnectorMessage): 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

simpleResponse

Provides a GASimpleResponse with specified CharSequence.

fun I18nTranslator.simpleResponse(text: CharSequence): GASimpleResponse

slackAttachment

fun I18nTranslator.slackAttachment(text: CharSequence? = null, vararg buttons: Button): SlackMessageAttachment
fun I18nTranslator.slackAttachment(vararg buttons: Button): SlackMessageAttachment
fun I18nTranslator.slackAttachment(text: CharSequence? = null, buttons: List<Button> = emptyList(), color: String = "good", pretext: String? = null, fallback: String = translate(text).toString(), vararg fields: AttachmentField): SlackMessageAttachment

slackButton

Creates Slack button: https://api.slack.com/reference/messaging/block-elements#button

fun <T : Bus<T>> T.slackButton(title: CharSequence, targetIntent: IntentAware? = null, parameters: Parameters = Parameters(), name: String = "default"): Button

Creates a Slack button: https://api.slack.com/reference/messaging/block-elements#button

fun <T : Bus<T>> T.slackButton(title: CharSequence, targetIntent: IntentAware?, step: StoryStep<out StoryHandlerDefinition>? = null, parameters: Parameters = Parameters(), name: String = "default"): Button
fun <T : Bus<T>> T.slackButton(title: CharSequence, targetIntent: IntentAware?, step: StoryStep<out StoryHandlerDefinition>? = null, vararg parameters: Pair<String, String>, name: String = "default"): Button

slackMessage

fun I18nTranslator.slackMessage(message: CharSequence, vararg attachments: SlackMessageAttachment): SlackMessageOut
fun I18nTranslator.slackMessage(message: CharSequence, channel: String? = null, vararg attachments: SlackMessageAttachment): SlackMessageOut

standaloneQuickReply

Creates a quick reply from an I18nTranslator.

fun I18nTranslator.standaloneQuickReply(title: CharSequence, targetIntent: IntentAware, parameters: Parameters = Parameters(), step: StoryStep<out StoryHandlerDefinition>? = null, imageUrl: String? = null, busStep: StoryStep<out StoryHandlerDefinition>? = null, currentIntent: Intent? = null, sourceAppId: String?): QuickReply

suggestion

Provides a GASuggestion.

fun I18nTranslator.suggestion(text: CharSequence): GASuggestion

teamsCarousel

fun I18nTranslator.teamsCarousel(carouselContent: List<TeamsBotMessage>): TeamsCarousel

teamsHeroCard

fun I18nTranslator.teamsHeroCard(title: CharSequence? = null, subtitle: CharSequence? = null, attachmentContent: CharSequence, images: List<CardImage>? = null, buttons: List<CardAction>? = null, tap: CardAction? = null): TeamsHeroCard

teamsMessage

fun I18nTranslator.teamsMessage(text: CharSequence): TeamsBotTextMessage

teamsMessageWithButtonCard

fun I18nTranslator.teamsMessageWithButtonCard(urlText: CharSequence, links: List<CardAction>): TeamsCardAction

text

Creates a text with quick replies.

fun I18nTranslator.text(text: CharSequence, vararg quickReplies: QuickReply): TextMessage
fun I18nTranslator.text(text: CharSequence, quickReplies: List<QuickReply>): TextMessage

textMessage

fun I18nTranslator.textMessage(message: CharSequence): SlackMessageOut

updatePermissionIntent

Google Assistant Message asking for update GAPermission.

fun I18nTranslator.updatePermissionIntent(intent: String): GAExpectedIntent

urlButton

Creates an url button.

fun I18nTranslator.urlButton(title: CharSequence, url: String): UrlButton

urlCardAction

fun <T : Bus<T>> T.urlCardAction(title: CharSequence, url: String): CardAction

video

Creates a video as attachment (https://developers.facebook.com/docs/messenger-platform/reference/send-api/#attachment).

fun <T : Bus<T>> T.video(videoUrl: String, vararg quickReplies: QuickReply): AttachmentMessage
fun <T : Bus<T>> T.video(videoUrl: String, quickReplies: List<QuickReply>): AttachmentMessage

webButton

Creates a button.

fun <T : Bus<T>> T.webButton(title: CharSequence, targetIntent: IntentAware? = null, imageUrl: String? = null, step: StoryStep<out StoryHandlerDefinition>? = null, parameters: Parameters = Parameters()): WebButton

webCard

Creates a WebMessage from a WebCard.

fun <T : Bus<T>> T.webCard(card: WebCard): WebMessagefun <T : Bus<T>> T.webCard(title: CharSequence?, subTitle: CharSequence?, buttons: List<Button> = emptyList()): WebCard

Creates a OldWebMessage from a MediaCard.

fun <T : Bus<T>> T.webCard(card: MediaCard): OldWebMessage

webCardWithAttachment

fun <T : Bus<T>> T.webCardWithAttachment(title: CharSequence?, subTitle: CharSequence?, attachmentUrl: CharSequence, buttons: List<Button>, type: AttachmentType = AttachmentType.file, attachementName: String = ""): WebCard

webCarousel

Creates a WebMessage from a WebCarousel.

fun <T : Bus<T>> T.webCarousel(vararg cards: WebCard, buttons: List<Button> = emptyList()): WebMessagefun <T : Bus<T>> T.webCarousel(cards: List<WebCard>, buttons: List<Button> = emptyList()): WebMessage

Creates a OldWebMessage from a MediaCarousel.

fun <T : Bus<T>> T.webCarousel(carousel: MediaCarousel): OldWebMessage

webDeepLink

fun <T : Bus<T>> T.webDeepLink(ref: String): WebMessage

webImage

Creates a WebMessage from a WebImage.

fun <T : Bus<T>> T.webImage(imageUrl: String, title: CharSequence): WebMessage

webIntentQuickReply

Creates a quickreply button with target intent

fun <T : Bus<T>> T.webIntentQuickReply(title: CharSequence, targetIntent: IntentAware, step: StoryStep<out StoryHandlerDefinition>? = null, parameters: Parameters = Parameters(), imageUrl: String? = null, style: <ERROR CLASS>): Button
fun <T : Bus<T>> T.webIntentQuickReply(title: CharSequence, targetIntent: IntentAware, step: StoryStep<out StoryHandlerDefinition>? = null, parameters: Parameters = Parameters(), imageUrl: String? = null, style: String? = ButtonStyle.primary.name): Button

webMessage

Creates a text with buttons.

fun I18nTranslator.webMessage(title: CharSequence, vararg buttons: WebButton): OldWebMessage
fun I18nTranslator.webMessage(title: CharSequence, buttons: List<WebButton>): OldWebMessage
fun I18nTranslator.webMessage(title: CharSequence, vararg buttons: Button): WebMessage

Creates a text with a list of buttons.

fun I18nTranslator.webMessage(title: CharSequence, buttons: List<Button> = emptyList()): WebMessage

webNlpQuickReply

Creates a quickreply button with target intent

fun <T : Bus<T>> T.webNlpQuickReply(title: CharSequence, nlpText: String? = null, imageUrl: String? = null, style: <ERROR CLASS>): Button
fun <T : Bus<T>> T.webNlpQuickReply(title: CharSequence, nlpText: String? = null, imageUrl: String? = null, style: String? = ButtonStyle.primary.name): Button

webPostbackButton

Creates a postback button

fun <T : Bus<T>> T.webPostbackButton(title: CharSequence, targetIntent: IntentAware, step: StoryStep<out StoryHandlerDefinition>? = null, parameters: Parameters = Parameters(), imageUrl: String? = null, style: <ERROR CLASS>): Button
fun <T : Bus<T>> T.webPostbackButton(title: CharSequence, targetIntent: IntentAware, step: StoryStep<out StoryHandlerDefinition>? = null, parameters: Parameters = Parameters(), imageUrl: String? = null, style: String? = ButtonStyle.primary.name): Button

webQuickReply

Creates a quickreply button

fun <T : Bus<T>> T.webQuickReply(title: CharSequence, targetIntent: IntentAware? = null, step: StoryStep<out StoryHandlerDefinition>? = null, parameters: Parameters = Parameters(), imageUrl: String? = null): Button

webTextButton

Creates a button from a text.

fun <T : Bus<T>> T.webTextButton(text: CharSequence): WebButton

webUrl

Creates a url button

fun <T : Bus<T>> T.webUrl(label: CharSequence, url: CharSequence): WebUrl

webUrlButton

Creates a url button

fun <T : Bus<T>> T.webUrlButton(title: CharSequence, url: String, imageUrl: String? = null, target: <ERROR CLASS>, style: <ERROR CLASS>): Button
fun <T : Bus<T>> T.webUrlButton(title: CharSequence, url: String, imageUrl: String? = null, target: String? = HrefTargetType._blank.name, style: <ERROR CLASS>): Button
fun <T : Bus<T>> T.webUrlButton(title: CharSequence, url: String, imageUrl: String? = null, target: <ERROR CLASS>, style: String? = ButtonStyle.primary.name): Button
fun <T : Bus<T>> T.webUrlButton(title: CharSequence, url: String, imageUrl: String? = null, target: String? = HrefTargetType._blank.name, style: String? = ButtonStyle.primary.name): Button

webWidget

Creates a custom payload

fun <T : Bus<T>> T.webWidget(widget: WebWidget, buttons: List<Button> = emptyList()): WebMessage

withAlexa

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

fun <T : Bus<T>> T.withAlexa(messageProvider: () -> AlexaMessage): T

withGoogleAssistant

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

fun <T : Bus<T>> T.withGoogleAssistant(messageProvider: () -> GAResponseConnectorMessage): T

withGoogleVoiceAssistant

If the device supports audio, adds a Google Assistant ConnectorMessage if the current connector is Google Assistant. You need to call BotBus.send or BotBus.end later to send this message.

fun <T : Bus<T>> T.withGoogleVoiceAssistant(messageProvider: () -> GAResponseConnectorMessage): T

withMessenger

Adds a Messenger ConnectorMessage if the current connector is Messenger. You need to call T:BusT.send or T:BusT.end later to send this message.

fun <T : Bus<T>> T.withMessenger(messageProvider: () -> MessengerConnectorMessage): T

Adds a Messenger ConnectorMessage if the current connector is Messenger and the current connector is connectorId. You need to call T:BusT.send or T:BusT.end later to send this message.

fun <T : Bus<T>> T.withMessenger(connectorId: String, messageProvider: () -> MessengerConnectorMessage): T

withSlack

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

fun <T : Bus<T>> T.withSlack(messageProvider: () -> SlackConnectorMessage): T

withTeams

fun <T : Bus<T>> T.withTeams(messageProvider: () -> TeamsBotMessage): T

withWeb

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

fun <T : Bus<T>> T.withWeb(messageProvider: () -> WebConnectorMessage): T

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

Inheritors

BotBus

Bus implementation for Tock integrated mode.

interface BotBus : Bus<BotBus>

ClientBus

Bus implementation for Tock Bot APÏ mode.

interface ClientBus : Bus<ClientBus>