Tock Connectors
Introduction
Tock connectors integrate bots with various text/voice channels. Beside the test connector used by Tock Studio internally, connectors refer to channels, external to the Tock platform.
The Tock connector architecture makes it possible to build conversational assistants, loosely coupled to the channels they are exposed to. One can first build a bot for a given channel, then make it a multichannel bot by adding connectors.
The Web connector exposes a generic API to interact with a Tock bot. As a consequence, more integrations are possible on the “frontend” by leveraging this API as a gateway.
This page actually lists:
-
The connectors provided with Tock:
-
Available toolkits leveraging the Web connector to integrate with more channels:
-
Voice technologies possible to integrate with Tock:
Connectors provided with Tock
Many connectors are provided with Tock for various types of text/voice external channels. New connectors are regularly added to the platform, depending on user project needs and availability of new messaging channels.
Examples: Google Home arriving in France in 2017, Alexa in 2018, WhatsApp then Business Chat APIs opened in 2019, etc.
To find, which bot leverages which connector in production, please refer to the Tock user showcase page.
Messenger
- Channel : Facebook Messenger
- Type : text (+ voice through voice recording upload)
- Status : Tock connector in production since 2016
Please refer to connector-messenger for sources and README instructions.
Slack
- Channel : Slack
- Type : text
- Status : Tock connector not used for production (no use case yet)
Please refer to connector-slack for sources and README instructions.
Google Assistant / Home
- Channel : Google Assistant / Google Home
- Type : text + voice
- Status : Tock connector in production since 2017
Please refer to connector-ga for sources and README instructions.
Alexa / Echo
- Channel : Amazon Alexa / Amazon Echo
- Type : voice
- Status : Tock connector in production since 2018
Important : please note that the NLP model for Alexa is necessarily built and managed by Amazon online services. Only the conversational framework can be used from Tock.
Please refer to connector-alexa for sources and README instructions.
Rocket.Chat
- Channel : Rocket.Chat
- Type : text
- Status : to be precised
Please refer to connector-rocketchat for sources and README instructions.
- Channel : WhatsApp from Facebook
- Type : text
- Status : Tock connector in production since 2019
Please refer to connector-whatsapp for sources and README instructions.
Teams
- Channel : Microsoft Teams
- Type : text + voice
- Status : Tock connector in production since 2019
Please refer to connector-teams for sources and README instructions.
Business Chat
- Channel : Apple Business Chat (Messages)
- Type : text
- Status : Tock connector in production since 2019
Please refer to connector-businesschat for sources and README instructions.
- Channel : Twitter (messages privés)
- Type : text
- Status : Tock connector in production since 2019
Please refer to connector-twitter for sources and README instructions.
Allo-Media
- Channel : Allo-Media (téléphonie)
- Type : voice
- Status : Tock connector in production since 2020
This connector has been developped for the French AlloCovid bot. To know more, please check the AlloMediaConnector class and the bot sources also on GitHub.
Google Chat
- Channel : Google Chat (aka Google Hangouts)
- Type : text
- Status : Tock connector not used for production (no use case yet)
Please refer to connector-google-chat for sources and README instructions.
Web (generic)
This generic connector integrates Tock bots with Web sites or applications: portals, dedicated sites, apps, REST clients, etc.
The connector exposes a REST API to the bot, making it easy to integrate with any Website, mobile application or programming language.
Several toolkits and components consuming the Web connector API are already available to integrate Tock bots with more types of sites and applications, such as Websites with React, mobile-native applications with Flutter and intranet sites on SharePoint.
- Channel : Web (generic for any Web site or application)
- Type : text
- Status : Tock connector in production since 2020
Please refer to connector-web for sources and README instructions, including samples and the Swagger documentation for the REST API.
Test (generic)
This Tock-internal connector allows to talk to a bot directly from the
Tock Studio interface (Test > Test the bot) and emulates other connectors.
Integrations through the Web connector
The Web connector exposes a generic API to interact with a bot. As a consequence, more integrations are possible on the “frontend”, by consuming the API as a gateway to the bot.
React
This React component integrates and renders a Tock bot inside a Web application or site.
The Webapp communicates with the bot through a Web connector.
- Integration: React (JavaScript / JSX)
- Type: Web applications
- Status: in production since 2020
Please refer to tock-react-kit
for sources and README instructions.
Flutter (beta)
This Flutter component integrates and renders a Tock bot inside a mobile or Web application.
The application communicates with the bot through a Web connector.
- Integration: Flutter (Dart)
- Type: mobile-native or Web applications
- Status: beta, in development
Please refer to tock-flutter-kit
for sources and README instructions.
SharePoint (beta)
This WebPart component integrates and renders a Tock bot inside a SharePoint page/site.
The component embeds the tock-react-kit to communicate with the bot through a
Web connector and render the bot inside the SharePoint page.
- Integration: Microsoft SharePoint
- Type: Web & intranet sites
- Status: beta, in development
Please refer to tock-sharepoint
for sources and README instructions.
Voice Technologies
Tock bots merely process text sentences by default. Nevertheless, voice and speech technologies can be leveraged around the bot to achieve voice dialogs (namely voicebots and callbots):
- Translating Speech-To-Text before bot processing (ie. before NLU)
- Translating Text-To-Speech after bot processing (ie. synthesis speech from bot answer)
Some of the provided connectors integrate with external channels, capable of STT and TTS.
More voice technologies have been integrated with Tock over time, even when no ready-to-use connector is provided.
Google / Android
Google Speech-To-Text and Text-To-Speech features are used by the Google Assistant / Home connector, the microphone feature from the Microsoft Teams app for Android compatible with the Teams connector, as well as the Android platform for mobile-native development.
- Technologie : Google / Android STT & TTS
- Status : used with Tock in production (through Google Assistant / Home and Microsoft Teams connectors, as well as native Android for on-app mobile bots)
Apple / iOS
Apple Speech-To-Text and Text-To-Speech features are used by the Business Chat connector, as well as the iOS platform for mobile-native development.
- Technologie : Apple / iOS STT & TTS
- Status : used with Tock in production (though Business Chat connector and native iOS for on-app mobile bots)
Amazon / Alexa
- Technologie : Amazon / Alexa STT & TTS
- Status : used with Tock in production (through Alexa connector)
Allo-Media & Voxygen
To build the French AlloCovid bot, an Allo-Media connector has been developped, to integrate the Tock bot with Allo-Media services: Speech-To-Text (from phone speech) and Text-To-Speech (leveraging Voxygen synthesis voices).
- Technologie : Allo-Media & Voxygen
- Status : used with Tock in production (though Allo-Media connector)
Nuance
Nuance propose des solutions de reconnaissance vocale & IA.
Back in 2016 for voice command usages, Nuance was successfully integrated with Tock for its Speech-To-Text features.
- Technologie : Nuance
- Status : used with Tock in 2016
Define your own connector
It is possible to develop its own connector.
An example of custom connector can be seen in the Bot Open Data sample project.
To develop your own, follow these steps:
1) Implement the interface Connector
Here is an example of implementation:
val testConnectorType = ConnectorType("test")
class TestConnector(val applicationId: String, val path: String) : Connector {
override val connectorType: ConnectorType = testConnectorType
override fun register(controller: ConnectorController) {
controller.registerServices(path) { router ->
//main API
router.post("$path/message").blockingHandler { context ->
//ConnectorRequest is my business object passed by the front app
val message: ConnectorRequest = mapper.readValue(context.bodyAsString)
//business object mapped to Tock event
val event = readUserMessage(message)
//we pass the Tock event to the framework
val callback = TestConnectorCallback(applicationId, message.userId, context, controller)
controller.handle(event, ConnectorData(callback))
}
}
}
override fun send(event: Event, callback: ConnectorCallback, delayInMs: Long) {
callback as TestConnectorCallback
if (event is Action) {
//we record the action
callback.actions.add(event)
//if it's the last action to send, send the answer
if (event.metadata.lastAnswer) {
callback.sendAnswer()
}
} else {
logger.trace { "unsupported event: $event" }
}
}
}
// to retrieve all actions before sending
class TestConnectorCallback(
override val applicationId: String,
val userId: String,
val context: RoutingContext,
val controller: ConnectorController,
val actions: MutableList<Action> = CopyOnWriteArrayList()): ConnectorCallbackBase(applicationId, testConnectorType) {
internal fun sendAnswer() {
//we transform the list of Tock responses into a business response
val response = mapper.writeValueAsString(actions.map{...})
//then we send the answer
context.response().end(response)
}
}
2) Implement the interface ConnectorProvider
Here is an example of implementation:
object TestConnectorProvider : ConnectorProvider {
override val connectorType: ConnectorType = testConnectorType
override fun connector(connectorConfiguration: ConnectorConfiguration): Connector {
return TestConnector(
connectorConfiguration.connectorId,
connectorConfiguration.path
)
}
}
class TestConnectorProviderService: ConnectorProvider by TestConnectorProvider
3) Make this connector available via a Service Loader
By placing a file META-INF/services/ai.tock.bot.connector.ConnectorProvider in the classpath, containing the class name :
mypackage.TestConnectorProviderService
4) Add all classes and files created in the admin classpath and bot classpath
The new connector must then be available in the “Bot Configurations” administration interface.