Skip to content

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:

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

Messenger Logo

  • 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

Slack Logo

  • 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

Google Assistant Logo Google Home Logo

Please refer to connector-ga for sources and README instructions.

Alexa / Echo

Alexa Logo

  • 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

RocketChat Logo

  • Channel : Rocket.Chat
  • Type : text
  • Status : to be precised

Please refer to connector-rocketchat for sources and README instructions.

WhatsApp

WhatsApp Logo

Please refer to connector-whatsapp for sources and README instructions.

Teams

Teams Logo

  • 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

BusinessChat Logo

Please refer to connector-businesschat for sources and README instructions.

Twitter

Twitter Logo

  • 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

Allo-Media Logo

  • 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

Google Chat Logo

  • 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)

Web Logo

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)

Web Logo

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

React logo

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)

Flutter logo

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)

SharePoint logo

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.

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.

Android Logo Google Assistant Logo Google Home Logo Teams Logo

  • 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.

iOS Logo BusinessChat Logo

  • 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

Alexa Logo

  • 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).

Allo-Media Logo Voxygen Logo

  • 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.

Nuance Logo

  • 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.