Skip to content

Tock code examples

Examples in Bot Samples

The tock-bot-samples repository contains code examples, including those used in Tock documentation to program journeys in WebHook or WebSocket modes.

The Open Data bot

The tock-bot-open-data repository contains an example of a bot implementation based on the SNCF Open Data API.

This bot uses the Kotlin framework for Tock (and not the Bot API mode via Webhook or WebSocket).

It also implements internationalization with two languages ​​offered: French and English.

Deploy the bot with Docker

To deploy the bot with Docker / Docker Compose, follow the instructions in the tock-docker repository.

Deploy the bot in your IDE

If you prefer to deploy a Tock platform without the Open Data Bot, and run it in your IDE (allowing you to do step-by-step debugging, for example), follow these instructions:

  • Deploy a Tock NLU stack using the docker-compose.yml descriptor as explained here

  • Request your own SNCF Open Data key (free) and configure the environment variable (see OpenDataConfiguration)

  • Set up a connector: Messenger, Google Assistant or other (see channels and connectors)

  • Start the OpenDataBot launcher in your IDE, IntelliJ or other. The bot is operational, talk to it! :)

Chat with Tock
×