# Tia on Telegram and WhatsApp

> Source: https://www.allsweb.com/sixpanel/docs/tia-on-telegram-and-whatsapp
> Markdown for agents: https://www.allsweb.com/sixpanel/docs/tia-on-telegram-and-whatsapp.md
> Publisher: AllsWeb (www.allsweb.com)

Part of: SixPanel documentation

**What this page is for:** talk to Tia from your phone. Link your own Telegram or WhatsApp
to this server and write to her there — *"is the shop OK?"*, *"deploy the blog"*, *"why is
the site slow?"* — in your own words and your own language. She answers with the same tools
as in the panel, asks you the same approvals, and every change she makes is on the
**Activity** page, marked as asked from Telegram or WhatsApp.

**You need**

- **SixPanel Pro** — Tia is an AI feature (see
  **[Your AllsWeb account and SixPanel Pro](https://www.allsweb.com/sixpanel/docs/allsweb-account-and-pro)**), and a provider
  with an API key on **AI → Providers**.
- The panel open, on **AI → Chat apps**.
- For Telegram: the Telegram app. For WhatsApp: a Meta (Facebook) business account, and the
  panel on its own domain (**Security → Access**).

Everything is on **AI → Chat apps**, one card for each app. The **Settings → Alerts** page
has one more card: the same alerts as the alert email, sent to a chat you linked.

---

## Telegram

Telegram needs a bot of your own, made for this server. It takes a minute.

1. In Telegram, open **@BotFather**, send `/newbot` and answer its two questions: a name,
   then a username that ends in `bot`. It answers with a **token** — a line like
   `123456789:AA…`.
2. On **AI → Chat apps → Telegram**, paste the token and press **Connect the bot**. The
   panel asks Telegram who the bot is before it keeps the token, and it never shows the
   token again — only its last four characters.
3. Press **Link my Telegram** (see [Linking your chat](#linking-your-chat) below).

Nothing on this server listens for Telegram: the panel asks Telegram for new messages
itself, with one request that waits up to 50 seconds for a message. An idle bot costs about
one request a minute. With no bot set up, nothing runs at all.

Make a **new bot for SixPanel** rather than reuse one another program uses. A bot that
already sends its messages somewhere else (a webhook) is refused when you paste its token,
and two servers cannot share one bot — each would take the other's messages. Give each
server its own bot.

## WhatsApp

WhatsApp goes through **WhatsApp's own Business Cloud API**, from Meta: your Meta app, a
business phone number and a permanent token. SixPanel never uses a "WhatsApp Web" program
that drives a phone's session — WhatsApp bans numbers that are used that way.

**The panel needs its own domain first** (**Security → Access**): Meta sends messages only to
an `https` address with a real certificate, and that address is the panel's domain. Until
there is one, the WhatsApp card says so.

1. On **developers.facebook.com**, make an app of type **Business** and add the **WhatsApp**
   product. Give it a phone number that is not used in the WhatsApp app — or try everything
   first with the test number Meta gives you.
2. In **Meta Business settings → System users**, make a system user, give it the app and your
   WhatsApp account, and generate a token that **does not expire**, with the permissions
   `whatsapp_business_messaging` and `whatsapp_business_management`. (The token on the app's
   API Setup page lasts only a day.)
3. On **AI → Chat apps → WhatsApp**, paste the **Phone number ID** (WhatsApp → API Setup in
   your Meta app), the **permanent access token** and the **App secret** (App settings →
   Basic), and press **Save**. The panel asks Meta for the number before it keeps them.
4. Press **Show the webhook address**. In your Meta app, **WhatsApp → Configuration →
   Webhook**: paste the **Callback URL** and the **Verify token**, press **Verify and save**,
   then subscribe to **messages**. The card says *verified by Meta* once Meta has checked it.
5. Press **Link my WhatsApp** (below).

The webhook address carries a key only this server and your Meta app know, and every message
Meta sends is signed with your App secret — the panel refuses one whose signature does not
match before it reads a word of it. The address and the verify token alone let nothing in;
the App secret is never shown again. **Make a new webhook address** (under *Change the
WhatsApp settings*) replaces both; paste the new ones into your Meta app afterwards.

### The 24-hour window

WhatsApp lets a business write freely for **24 hours after your last message**. Tia's
answers always fall inside it — you just wrote to her. An **alert** may not: after 24 hours
of quiet, WhatsApp accepts only a **message template** Meta approved.

So for alerts on WhatsApp, make one template in **WhatsApp Manager**: category **Utility**,
one variable in its body — for example `SixPanel alert: {{1}}` — and write its name and
language on the WhatsApp card under **Alerts outside the 24-hour window**. The alert goes
into the variable, on one line. Without a template, an alert outside the window is not sent,
and the chat's row says so. Each linked chat's row shows whether its window is open and
until when; any message from you opens it again.

## Linking your chat

Tia answers **only the chats you linked**. To link yours:

1. Press **Link my Telegram** or **Link my WhatsApp**. The panel shows a one-time code, like
   `ABCD-2345`, that lives **ten minutes**.
2. Send it from your own phone: in Telegram, press **Open Telegram** (it opens your bot with
   the code ready) or send `/link ABCD-2345` to the bot; in WhatsApp, press **Open WhatsApp**
   or send `link ABCD-2345` to the business number.
3. The card turns green — *Linked* — and Tia greets you in the chat.

The panel keeps only a fingerprint of the code, never the code. Five wrong codes use the live
one up, and you make a new one. Up to five chats can be linked for each app (your phone and
a second account of yours, say). A Telegram chat is linked by your chat and your account
together, private chats only — a group is never answered. **Unlink** on a chat's row, or
`/unlink` in the chat, ends it.

**Anyone who can open a linked account can ask Tia to change this server.** Keep that account
locked: turn on Telegram's two-step verification, and WhatsApp's.

## Talking to Tia in a chat

Write as you would in the panel. While she works, Telegram shows her typing; a long job (a
deploy, a backup) is said once — *Working on it* — and her answer comes when she is done,
with the steps she took on its first line: *✓ 3 steps · Server status, Read logs, Deploy*.
Under an answer, her ideas for what to ask next are buttons in Telegram; in WhatsApp, reply
`1`, `2` or `3`.

Commands (in WhatsApp the same words work without the `/`):

| Command | What it does |
|---|---|
| `/status` | How the server is: CPU, memory, disk, the services, the last backup, open incidents, and how many requests wait for your approval |
| `/sites` | Your projects and websites, with their addresses |
| `/alerts` | What monitoring has open |
| `/new` | Start a new conversation (one also starts by itself after 12 quiet hours) |
| `/stop` | Stop what Tia is doing |
| `/help` | What you can ask |
| `/unlink` | Stop this chat reaching the server |

`/status`, `/sites` and `/alerts` read the server with Tia's own tools; they cost nothing from your AI budget.

Each chat is a conversation on the **AI** page too — named *Telegram: …* or *WhatsApp: …* —
so you can read it, or carry on, in the panel.

### Approving from the chat

A change waits for your approval as your **Ask mode / Auto mode** says (see
**[Tia, the assistant](https://www.allsweb.com/sixpanel/docs/ai-assistant#ask-mode-and-auto-mode)**). The request arrives in
the chat with **Approve** and **Decline**, and in the panel's bell at the same time — answer
it in either place. It says what will happen, whether it can be taken back, and what exactly
will run; it waits 30 minutes.

Some requests are approved **in the panel only**, and the chat offers **Decline** and says
why:

- one that needs your **2FA code or admin password** — a root command, for one: those never
  go into a chat app;
- one that needs a word typed to confirm it;
- one too long to show whole in a chat, or one that holds something that is never sent to a
  chat app.

**Changes that cannot be taken back may be approved here** is on by default. Switch it off
and a delete, a restore or a reboot asked from that app waits for you in the panel — the chat
can then only decline it.

### What never goes into a chat

- **Passwords and keys are never typed into a chat app.** There is no secure field
  there, so Tia does not ask for one; she tells you to set it in the panel, on the page that
  takes it, or to ask her there (**AI → Tia**).
- Nothing secret is sent to a chat: everything Tia writes there passes the same masking as
  her answers in the panel, and the panel's address and entry code are never in it.
- A message that reaches the server more than **ten minutes late** — the panel was
  restarting, the phone was offline — is not acted on; Tia asks you to send it again.
- Twenty messages in ten minutes is the most one chat may send.

Every change Tia makes from a chat is on the **Activity** page, marked **AI** — hover the
badge: *Tia on Telegram* or *Tia on WhatsApp*. An approval you gave in a chat is a row of its
own, *approved on Telegram*.

## Alerts

**Settings → Alerts → Alerts in Telegram and WhatsApp** — and the **Alerts** switch on each
linked chat's row on **AI → Chat apps** — send the same alerts as the alert email to that
chat: a failed job, a full disk, a service that stopped, a lockout, monitoring's incidents.
They work with or without an alert email set up. **Send a test** checks one chat. Each row
shows when the last alert went and what the app answered.

On WhatsApp, an alert outside the 24-hour window needs your template (see
[The 24-hour window](#the-24-hour-window)).

If you also added the same Telegram chat as a channel under **Server → Monitoring**, you get
monitoring's alerts twice — remove one of the two.

## If something goes wrong

| What you see | What to do |
|---|---|
| *Telegram does not know this token* | Copy it again from @BotFather: `/mybots` → your bot → **API Token**. |
| *This bot already sends its messages to another address* | Make a new bot for SixPanel with `/newbot`, or remove that bot's webhook first. |
| *Something else reads this bot's messages* | Another server uses the same bot. Give each server its own bot. |
| *Telegram refused the bot token* | The token was revoked or changed in @BotFather. Paste the new one. |
| WhatsApp: *not verified by Meta yet* | In your Meta app, paste the Callback URL and the Verify token again (Show the webhook address) and press **Verify and save**. |
| WhatsApp: *a delivery with a wrong signature was refused* | The App secret saved here is not your app's. Paste it again under *Change the WhatsApp settings*. |
| WhatsApp: *Meta refused the access token* | It expired — the API Setup page's token lasts a day. Make a permanent system user token. |
| An alert says *not sent: outside WhatsApp's 24-hour window* | Write any message to the business number, or set an alert template. |
| Tia says *This needs SixPanel Pro* | Pro ended on your AllsWeb account; the commands still answer. |

**Remove** on an app's card takes its settings and its linked chats away from this server.
Delete the bot in @BotFather, or the app on developers.facebook.com, yourself if you do not
want them any more.
