Home · Blog · How to change a bot token in Telegram, MAX and VK without losing correspondence

How to change a bot token in Telegram, MAX and VK without losing correspondence

· Command CHBT · Channels, Diagnostics

To change a bot token in CHBT, open Channels → “⋯” in the channel row → Change key, paste the new token into the New key (API token) field and press Save key. The channel, open conversations, contacts and flows stay in place; there is no need to delete and reconnect the channel. If the new key did not fit, CHBT returns the previous one and shows the reason — the channel will not break. Change key is available for Telegram, MAX and VK; the key can be changed by the project owner and admins. Below — where to get a new token, what to do on a leak and what to do if the bot went silent after the change.

Where to get a new token

MessengerWhere to issue a new key
Telegram@BotFather: /revoke revokes the old token and issues a new one; the current token is in /mybots → API Token
MAXThe MAX for business account, bot settings
VKCommunity: Manage → API usage → Access keys, with the Community messages and Community management rights

The new token must belong to the same bot or the same community. CHBT checks that the key works but does not compare whether it is the same bot. Paste another bot’s token — contacts stay in the channel, but they will be written to by a bot they never talked to, and messages will not be delivered.

A planned change: order without downtime

  1. Issue a new key in the platform account, do not revoke the old one yet (possible in MAX and VK).
  2. In CHBT: Channels → “⋯” → Change key → paste the new one → Save key.
  3. Wait for the Works status on the channel.
  4. Write to the bot from a phone: the reply should arrive, the message should appear in Conversations.
  5. Revoke the old key in the platform account and write to the bot once more.

In Telegram /revoke revokes the old token at once, so paste the new one into CHBT right after the command — until you do, the bot is silent.

What CHBT does on saving: sets up message receiving again with the new key — the Telegram webhook, the MAX event subscription or the VK Callback API.

A token leak: what to do now

  1. Get a new token — in Telegram with the /revoke command, in MAX and VK — a new key in the platform account.
  2. Paste it into CHBT via Change key.
  3. Revoke the old key where it did not happen by itself: delete the old VK community key, update the token in the MAX account.
  4. Test the bot from a phone — the reply should appear in Conversations.
  5. Remove the token from the leak source — a chat, a document, code.

A contractor who needs access to the bot does not need the token: add them to the CHBT project with the right role — a role is removed with one button.

If the new key did not fit

The form shows “The new key did not fit: … Kept the previous one.” — CHBT returned the old key and restored its webhook.

Reason in the messageWhat to do
The platform did not accept the keyCopy the key in full, without spaces at the edges
A key from another messengerA Telegram token — only into a Telegram channel, MAX — into MAX
The VK key lacks the Community messages or Community management rightsCreate the key again and tick both rights
Network or a platform failureTry again in a couple of minutes

If the old token is already revoked, the “previous” key does not work either — paste a working new one as soon as possible.

Change key or delete and reconnect

Change keyDelete and connect again
ChannelThe sameA new one
Open conversationsContinueClosed, correspondence read-only
Contacts, tags, dealsIn placeIn place
Answering in an old conversationPossibleNot possible — the conversation continues when the customer writes again
Channel settingsKeptSet up again

Deleting a channel makes sense only if you move to another bot or another community.

If the bot went silent after the change

SymptomCauseWhat to do
Status Error with text about the token, the owner got an email “Bot … needs attention”The platform rejected the keyRepeat Change key with a valid token
Status Works, but Conversations are emptyThe token is used in parallel in another service, which intercepted the webhookRemove the token from there and press Reinstall webhook
Replies are marked “not delivered”Sending failsHover over the mark — the tooltip has the platform’s error text
Customers write, the bot cannot answer themAnother bot’s token was pastedReturn the token of the bot customers wrote to

The key problem email arrives no more than once a day if Email notifications or Bot status are not turned off. Detailed checklists: Telegram bot is silent, MAX bot does not answer, VK bot does not answer.

Website and email

The website chat has no messenger token: the widget is connected with code that CHBT issues, there is nothing to change in it. Email has app passwords for IMAP and SMTP instead of a token. If an email password leaked, create a new app password in the mail service settings, delete the old one and reconnect email in Channels with the new password.

Channel tokens are stored encrypted in CHBT and are not shown anywhere after connecting — neither to the owner nor to operators.

More on the blog