Telegram Bot Setup Guide
Create bot // Get tokens // Find IDs // Deploy form
How to Create a Telegram Bot
All Telegram bots are created and managed through @BotFather — the official Telegram bot that controls all other bots. Follow the steps below.
Open Telegram on any device (mobile or desktop). In the search bar, type @BotFather and tap on the result. Make sure it has a blue verified checkmark.
Alternatively, open this link directly in Telegram:
https://t.me/BotFather
Press START if you haven't used BotFather before. Then send the command:
/newbot
BotFather will reply asking for the bot's display name (can contain spaces, e.g. My Contact Bot).
After setting the name, BotFather will ask for a username. This must:
└ End in bot (e.g. mycontact_bot or MyContactBot)
└ Be unique — no other bot can have this username
└ Contain only letters, digits, and underscores
BotFather will confirm your bot is created and display a bot token. Copy it and keep it safe — you will need it in the next section.
How to Get Your Bot Token
A bot token is a string in this exact format:
1234567890:AAEz3FI9ypvMdtTzzl4NdzymT2AEG2tNByc
// ↑ Bot ID ↑ Secret hash (35 characters)
If you lost your token, go to @BotFather, send /mybots, select your bot, then tap API Token.
/mybots
→ Select your bot from the list
→ Click "API Token"
→ Copy the token shown
If your token is leaked, immediately revoke it via BotFather:
/mybots
→ Select your bot
→ "API Token"
→ "Revoke current token"
A new token will be generated. Update it in your form code immediately.
var TOKEN = '7449425339:AAH7V_P5sIMpE5owPr2Uec-AYkLXgcjNKYE';
↑ Replace this entire string with your bot token
How to Get Your Telegram User ID
Your personal Telegram user ID is a permanent numeric identifier for your account. It never changes, even if you change your username or phone number.
Open Telegram and search for @userinfobot. Send any message (e.g. /start) and it will instantly reply with your user ID and other account info.
https://t.me/userinfobot
Id: 1958371619
First: John
Last: Doe
Username: @johndoe
Language: en
The number next to Id: is your personal user ID.
Send a message to your bot, then call this URL in any browser (replace TOKEN with your bot token):
https://api.telegram.org/botYOUR_TOKEN/getUpdates
Find message.from.id in the JSON response — that is your user ID.
{
"message": {
"from": {
"id": 1958371619, ← YOUR USER ID
"first_name": "John",
"username": "johndoe"
}
}
}
How to Get a Telegram Group ID
Group IDs are always negative numbers and begin with -100 for supergroups and channels. Regular groups start with just -.
Open the group in Telegram. Tap the group name at the top → Add Members → search for your bot by its @username → Add it.
Send any message in the group (you can delete it later). This is required so the API has something to return in the next step.
Paste this URL in your browser (replace with your token):
https://api.telegram.org/botYOUR_TOKEN/getUpdates
Look for message.chat.id in the response — the negative number is your group ID:
{
"message": {
"chat": {
"id": -1003838567224, ← GROUP ID
"title": "My Contact Group",
"type": "supergroup"
}
}
}
Add @getidsbot to your group. It will automatically post the group ID as soon as it joins. You can remove it afterwards.
https://t.me/getidsbot
How to Deploy the Contact Form
In your Blogger post editor, switch from Compose mode to HTML mode (pencil icon → HTML). Paste the entire form code there and publish.
var TOKEN = 'YOUR_BOT_TOKEN_HERE';
var TARGETS = ['-YOUR_GROUP_ID', 'YOUR_PERSONAL_ID'];
Go to Layout in Blogger dashboard → Add a Gadget → choose HTML/JavaScript. Paste the form code and save.
After deploying, fill in the form and submit. Within seconds you should receive a message in:
GROUP -1003838567224
PERSONAL DM 1958371619
If no message arrives, open your browser console (F12 → Console) and check for error messages beginning with [TG-REST].
Quick Reference Table
| WHAT | WHERE TO GET IT | FORMAT / EXAMPLE |
|---|---|---|
| Bot Token | @BotFather → /newbot or /mybots → API Token | 1234567890:AABBccDD... |
| Personal User ID | @userinfobot → send any message → read Id field | 1958371619 (positive integer) |
| Group ID | Add bot to group → getUpdates → chat.id | -1003838567224 (negative) |
| Channel ID | @getidsbot → add to channel | -100xxxxxxxxxx (negative) |
| API ENDPOINT | WHAT IT DOES |
|---|---|
| /sendMessage | Sends a text message to a chat_id |
| /sendDocument | Sends a file attachment to a chat_id |
| /getUpdates | Retrieves incoming messages (used to find IDs) |
| /getMe | Returns basic info about the bot (verify token works) |
7449425339:AAH7V_P5sIMpE5...
-1003838567224
1958371619
+2349076129380