public Connector
A connector connects bots to users via a dedicated interface (like Messenger, Google Assistant, Slack... ).
There is one Connector for each user front-end application.
See ai.tock.bot.connector.messenger.MessengerConnector or ai.tock.bot.connector.ga.GAConnector for examples of interface Connector implementations.
@NotNull ConnectorType getConnectorType()
The type of the connector.
void register(@NotNull
ConnectorController controller)
Registers the connector for the specified controller.
void unregister(@NotNull
ConnectorController controller)
Unregisters the connector.
void send(@NotNull
Event event,
@NotNull
ConnectorCallback callback,
long delayInMs)
Send an event with this connector for the specified delay.
event - the event to sendcallback - the initial connector callbackdelayInMs - the optional delayvoid notify(@NotNull
ConnectorController controller,
@NotNull
PlayerId recipientId,
@NotNull
IntentAware intent,
@Nullable
StoryStep<? extends ai.tock.bot.definition.StoryHandlerDefinition> step,
@NotNull
java.util.Map<java.lang.String,java.lang.String> parameters,
@Nullable
ActionNotificationType notificationType,
@NotNull
kotlin.jvm.functions.Function1<? super java.lang.Throwable,kotlin.Unit> errorListener)
Sends a notification to the connector.
A interface BotBus is created and the corresponding story is called.
controller - the connector controllerrecipientId - the recipient identifierintent - the notification intentstep - the optional step targetparameters - the optional parametersnotificationType - notification type if anyerrorListener - called when a message has not been deliveredinterface BotBus@Nullable UserPreferences loadProfile(@NotNull ConnectorCallback callback, @NotNull PlayerId userId)
Load user preferences - default implementation returns null.
@Nullable UserPreferences refreshProfile(@NotNull ConnectorCallback callback, @NotNull PlayerId userId)
Refresh user preferences - default implementation returns null. Only not null values are taken into account.
@NotNull
kotlin.jvm.functions.Function1<ai.tock.bot.engine.BotBus,ai.tock.bot.connector.ConnectorMessage> addSuggestions(@NotNull
java.lang.CharSequence text,
@NotNull
java.util.List<? extends java.lang.CharSequence> suggestions)
Returns a interface ConnectorMessage with the specified list of suggestions.
If the connector does not support suggestions, returns null.
interface ConnectorMessage@NotNull
kotlin.jvm.functions.Function1<ai.tock.bot.engine.BotBus,ai.tock.bot.connector.ConnectorMessage> addSuggestions(@NotNull
ConnectorMessage message,
@NotNull
java.util.List<? extends java.lang.CharSequence> suggestions)
Updates a interface ConnectorMessage with the specified list of suggestions.
Default returns message unmodified.
interface ConnectorMessage,
message@NotNull
kotlin.jvm.functions.Function1<ai.tock.bot.engine.BotBus,java.util.List> toConnectorMessage(@NotNull
MediaMessage message)
Maps a interface MediaMessage into a interface ConnectorMessage.
If toConnectorMessage returns an empty list, the mapping is not supported for this connector.
Default returns an empty list.