# Answer visitors with a support bot

> Make a chatbot for your website, choose what it knows and who answers, add it to your site and read the conversations.

A support bot answers the visitors of your website in a chat widget, at any hour. The app names a support bot a
chatbot. This page tells you how to make a chatbot and choose what it knows and who answers. It also tells how to put
the bot on your site, test it and read the conversations.

## Before you begin

- Owners and admins make, change and delete chatbots.
- You need the Customer support product. An owner or admin gives products to people in **Settings** > **People**.
- A teammate writes each answer, so your troop must be able to work. Each answer is a run on your AI plan.
- Tell Troopy what your business does. The bot answers from it. Read [What the bot knows](#what-the-bot-knows).

A workspace can have many chatbots, for example one for each website. Each chatbot has its own look, its own teammates,
its own websites and its own script tag.

## Make a chatbot

1. Open **Products** > **Customer support**.
2. Select **New chatbot**.
3. Type a **Name**, for example `Store support`. Select **Make the chatbot**.

Troopy opens the **Chatbot builder**. A new chatbot is a **Draft**: it is off, and the Chief of Staff answers for it.
The chatbot starts with a welcome message and a blue brand colour.

## Set up the chatbot

The builder has 2 tabs, **Customize** and **Install**. The live preview is at the right. Owners and admins change the
fields, then select **Save changes**.

| Section of Customize      | What you set                                                                            |
| ------------------------- | --------------------------------------------------------------------------------------- |
| **Make it yours**         | The **Assistant name**, the avatar, the **Welcome message** and the **Brand color**.    |
| **Text colours**          | The colour of the text of the visitor and of the assistant in the bubbles.              |
| **Knowledge and replies** | What the bot may tell visitors, and the **Replying team**.                              |
| **Chat features**         | **Emoji picker**, **File attachments**, **Voice messages** and **Voice transcription**. |
| **Where it lives**        | The **Allowed websites**, and **Enable on your website**.                               |

- The avatar is a PNG, JPEG or WebP file of 512 KB at most. **Upload avatar** saves it at once.
- The welcome message has 500 characters at most.
- **Pick the colour that reads best on your brand colour** chooses the colour of the text of the visitor for you.

With changes that are not saved, the builder shows **Changes not saved**. The way back to **Chatbots** then asks
**Leave without saving?** first.

## What the bot knows

The bot answers only from what your business made public. **Knowledge and replies** > **What it may tell visitors**
counts the pages and the docs that the bot may use.

- The name, the website and the description of the business. Write the description in **Brain** > **Brand** >
  **Company** > **What the business does**.
- The pages of the own website of the business, which Troopy learned. Read [Teach the brain](/docs/brain).
- The docs that a person shows to the bot.

To show a doc to the bot, open the menu of the doc in **Docs**, and select **Show to the support bot**. **Hide from the
support bot** takes it back. The person who made the doc, owners and admins decide. The bot reads the text of the doc.
It never reads its dated notes, its comments or the names of its authors.

> [!WARNING]
> Any visitor can read what you show to the bot. A doc is off until a person shows it. A record of a person or a
> company can never go to the bot.

The bot never reads the memory files, the notes of teammates, the About you files, interviews, research reports,
canvases, files, or the other docs. Whatever a visitor writes, the rest of the brain stays inside the business.

## Choose who answers

Under **Replying team**, select the teammates that answer. The first teammate that you select answers, and shows
**Replies first**. It can ask the other teammates of the list for help in private, 2 times at most for each message. The
visitor never sees those talks.

- With no teammate, the builder shows "Choose at least one troop to reply." and the bot cannot answer.
- A paused teammate shows **Paused**, and you cannot add it.
- A chatbot has 12 teammates at most.

The bot has no approvals and no skills, and it changes nothing in Troopy. It can do one thing more than answer. When a
visitor reports a defect of your product, such as an error, the bot makes an engineering task of high priority. It
tells the visitor only after the task exists. A visitor never adds a memory to the brain.

## Put the chatbot on your website

1. In **Customize** > **Where it lives**, type each address in **Allowed websites**, one on each line.
2. Type the whole address with `https://`. Add each subdomain on its own line.
3. Turn on **Enable on your website**.
4. Select **Save changes**.
5. Open the **Install** tab, and select **Copy embed code**.
6. Paste the code before the closing `</body>` tag of each page.

```html
<script async src="https://troopy.ai/api/support/widget.js" data-bot-id="YOUR_CHATBOT_ID"></script>
```

The chat shows in the bottom corner of the page. It keeps the styles of your site and its own styles apart. On Pro, it shows "Powered by Troopy" under the message box. Max and Ultra show no badge.

> [!NOTE]
> The widget opens only on a page whose exact origin is in **Allowed websites**. `localhost`, `127.0.0.1`, another
> port and another subdomain are all different origins. A page that opens as `file://` has no origin, so serve it over
> HTTP for a test.

A chatbot has 30 allowed websites at most. The id of a chatbot never changes, so the code on your site stays good.

## Test the chatbot

The live preview at the right of the builder talks to the chatbot as a visitor does. Members, owners and admins can
use it.

1. Select **Save changes** one time. The preview needs saved settings.
2. Type a message, or select a suggested question.
3. Select **Desktop preview** or **Mobile preview** to see the chat in each size.

- The preview tests a chatbot that is off.
- The look of the preview shows your changes before you save them. The answers use the last saved settings.
- **New conversation** starts again. Each save starts a new conversation too.
- Your tests show in **Conversations** under **Previews**.

## Read the conversations

Open **Conversations**, under **Customer support** in the sidebar. The **Conversations** button of a chatbot card
opens the conversations of that chatbot only.

| Control                | What it does                                                                   |
| ---------------------- | ------------------------------------------------------------------------------ |
| **All chatbots**       | Shows the conversations of one chatbot, or of all of them.                     |
| Search                 | Finds words of the messages, a website, or a whole conversation id.            |
| **Online and offline** | Shows the visitors who are online, offline, or both.                           |
| **Visitors**           | Shows the chats of visitors, the chats of the preview (**Previews**), or both. |
| **Refresh**            | Loads the list again at once.                                                  |

The list shows 25 conversations on a page, the newest first. Select a conversation to read it.

- A visitor shows as **Visitor** and the last 6 characters of the conversation id.
- **Details** shows the conversation id, when it started, until when the visitor can write, and when the page last
  reported.
- A file of a visitor opens in a dialog: a picture, a PDF, audio or text. Each file has a download link.
- A visitor is **Online** while a page with your chatbot is open. The page reports every 30 seconds.

Nobody answers a visitor from this page. The page loads again every 5 seconds while its tab shows.

Troopy keeps a conversation after the visitor leaves. The widget opens a session on each page that loads it. Troopy
deletes a session that has no message when its 12 hours end.

## Files, voice and emoji

Owners and admins turn each feature on or off for a chatbot, under **Chat features**.

| Feature                 | What the visitor can do                                                    |
| ----------------------- | -------------------------------------------------------------------------- |
| **Emoji picker**        | Add emoji from a picker. A visitor can still type an emoji when it is off. |
| **File attachments**    | Send pictures, PDFs and text files: 8 MB a file, and 3 files a message.    |
| **Voice messages**      | Record a message of 60 seconds at most, listen to it, then send it.        |
| **Voice transcription** | Turn a voice message into words that the bot answers.                      |

- A session takes 20 uploads or 40 MB at most.
- The bot reads the words of a text file and of a transcript. It does not look at pictures or PDFs. It asks the visitor
  to say what they show.
- The bot transcribes 50 voice messages a day at most, by default.
- With transcription on and no transcription service, the microphone stays hidden. Turn off **Voice transcription** to
  take recordings with no words.
- If your site shows the chat inside an iframe, the iframe needs `allow="microphone"` for voice messages.

## Delete a chatbot

1. Open **Products** > **Customer support**.
2. On the card of the chatbot, select the delete button.
3. Select **Delete chatbot**.

> [!WARNING]
> You cannot bring back a deleted chatbot. Its chat stops on your websites at once. Its conversations and their files
> stay in **Conversations**.

## Who can do what

| Person             | What the person can do                                                |
| ------------------ | --------------------------------------------------------------------- |
| Owner or admin     | Make, set up, turn on and delete chatbots, and choose their features. |
| Member             | Open each chatbot, use the live preview, and read the conversations.  |
| Viewer or approver | Open each chatbot and read the conversations.                         |

## Limits

| Limit                         | Value                                           |
| ----------------------------- | ----------------------------------------------- |
| Allowed websites of a chatbot | 30                                              |
| Teammates of a chatbot        | 12                                              |
| A message of a visitor        | 2,000 characters                                |
| Help from other teammates     | 2 times for each message                        |
| A session of a visitor        | 12 hours                                        |
| Requests to one chatbot       | 120 a minute for each action                    |
| Files                         | 8 MB a file, 3 a message, 20 or 40 MB a session |
| A voice message               | 60 seconds                                      |
| Transcriptions                | 50 a chatbot a day, by default                  |

## Problems

| Message                                                                 | Why                                                             | What to do                                                                         |
| ----------------------------------------------------------------------- | --------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
| "This assistant is disabled or this website is not allowed to connect." | The chatbot is off, or the page is not in **Allowed websites**. | Turn on **Enable on your website**, and add the exact address of the page. Save.   |
| "This conversation is unavailable or expired."                          | The 12 hours of the session ended.                              | The visitor reconnects to start a new conversation.                                |
| "Please wait before trying again."                                      | The chatbot got too many requests in a minute.                  | Wait one minute.                                                                   |
| "The assistant is temporarily unavailable. Please try again."           | The teammate could not finish the answer.                       | Try again. If it stays, read [Fix a teammate that is stuck](/docs/stuck-teammate). |
| "Save settings to start chatting"                                       | The preview needs saved settings.                               | Select **Save changes**.                                                           |
| "Unavailable in this installation."                                     | The server of Troopy has this feature off.                      | Turn the feature off for the chatbot, or write to support@troopy.ai.               |

## Related

- [Teach the brain about your business](/docs/brain)
- [Write and share docs](/docs/documents)
- [Set up your brand](/docs/brand)
- [Hire and manage teammates](/docs/teammates)
- [Open and pin products](/docs/products)
