# Gym

This template is a gym bot that books and cancels classes for you using [Tables](#tables).

<figure><img src="/files/f4KGeFPUTPKNBX9jkKNi" alt="" width="268"><figcaption><p>Ollie the gym template bot.</p></figcaption></figure>

{% hint style="warning" %}
Make sure to always [update the NLP](https://docs.chatlayer.ai/understanding-users/natural-language-processing-nlp#updating-the-nlp) after loading a template!
{% endhint %}

## Tables

This chatbot uses 3 tables that are accessible under the [**Tables**](#tables) tab on the left-hand menu:

* **Lead generation**: a table that gathers the new user details uncovered in the conversation.
* **Group classes EN**: a list of gym classes in English
* **Group classes DE**: a list of gym classes in German

<figure><img src="/files/lSQZ3wibHi2X6qfnTxes" alt=""><figcaption><p>The Group classes EN table.</p></figcaption></figure>

## Flow: General

### Block: Choose language

When the conversation starts, the user is first asked which language they would like. This bot is bilingual as it exists in both English and German. The **Choose language** block is triggered when the chat starts. The chosen language will be set as value for the `preferredLanguage` variable.&#x20;

{% hint style="success" %}
Read more about multilingual bots [here](https://docs.chatlayer.ai/understanding-users/multilanguage-bots).
{% endhint %}

### Block: Introduction

The **Introduction** block sets up the 3 main use cases, into 3 Quick Reply buttons. You can see that as the "main menu":

* `I'm new` leads to the Lead Generation flow,&#x20;
* `Bookings` leads to the Book class and Cancel class flows
* `FAQ` leads to the FAQ flow

### Block: Start again

This Action block clears all the variables of the conversation so that the chat can start again. This is useful for testing but also if the conversation is left and then restarted. It is triggered whenever users greet the bot, by using the `chitchat.greeting` intent.

## Flow: Lead generation

This is the flow triggered by clicking on the "I'm new" button in the **Introduction** message, or by the `i_am_new` intent. The bot offers a free trial to the user, then their details are asked before they get suggested to book a class right away.&#x20;

## Flows: Classes

This is where conversations on booking or cancelling a class happen. Each of them is triggered by either the `book_class` or `cancel_class` intent.

#### Blocks: Which language?

The data fetched by the bot is influenced by the `preferredLanguage` variable set during the **Choose Language** phase at the conversation's onset. This adjustment is crucial as the representation of dates, times, and locations varies between languages such as German and English. The Condition blocks act as routers to ascertain the specific data to fetch, based on the user's language preference.

#### Blocks: Clear booked class and Clear cancelled class

The **Clear booked class** and **Clear cancelled class** Action blocks reset the variables defining the class to be booked or cancelled. This ensures that if users repeat a flow, the bot does not assume the same class is intended, prompting the user to specify the class again.

## Flow: FAQ

In this flow are grouped some of the frequently asked questions and their answers. We focused on 2 different topics: covid rules and prices.

{% hint style="info" %}
To discover how you can upgrade your FAQ flows, try out our [Knowledge Base AI ](/start-quickly/bot-templates/knowledge-base-ai-template.md)template.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.chatlayer.ai/start-quickly/bot-templates/gym.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
