Telegram API Bot curl Command Message Sending

Creating a Telegram Bot Using Telegram API and Sending Messages with curl Command

Introducing the steps and methods to create a bot using Telegram API and send messages to Telegram from Linux Bash command line using curl command. Creating Telegram API is a bit special - you open the telegram client and create a bot in chat format. Telegram Contact @BotFather...

Shou Arisaka
3 min read
Nov 26, 2025

Introducing the steps and methods to create a bot using Telegram API and send messages to Telegram from Linux Bash command line using curl command.

Telegram is convenient, isn’t it? I’ve been using it for about half a year now, and I don’t think I can go back to LINE. Originally, I migrated from LINE with security consciousness, but the API is easy, group invitations are convenient, and the biggest difference from LINE is indeed multi-device usage. People using LINE would understand, but LINE’s quality is such that you can’t log in from multiple smartphones or computers in the first place.

So, here’s how to get started with Telegram API.

Reference: Telegram API: Send Message - Personal Notification Bot - ShellHacks

Creating Telegram API is a bit special - you open the telegram client and create a bot in chat format. Who do you chat with? There seem to be others, but we’ll use this one for now.

Telegram: Contact @BotFather

Add as friend and start a conversation.

Image

Now, please proceed with the chat as follows.

Foobar I, [16.12.18 09:27]
/newbot
BotFather, [16.12.18 09:27]
Alright, a new bot. How are we going to call it? Please choose a name for your bot.
Foobar I, [16.12.18 09:28]
testbot
BotFather, [16.12.18 09:28]
Good. Now let's choose a username for your bot. It must end in `bot`. Like this, for example: TetrisBot or tetris_bot.
Foobar I, [16.12.18 09:28]
testbot_bot
BotFather, [16.12.18 09:28]
Sorry, this username is already taken. Please try something different.
Foobar I, [16.12.18 09:29]
yuis_testbot_bot

/newbot … bot creation testbot … bot name yuis_testbot_bot … bot URL (ID)

Then,

Done! Congratulations on your new bot. You will find it at t.me/yuis_testbot_bot. You can now add a description, about section and profile picture for your bot, see /help for a list of commands. By the way, when you've finished creating your cool bot, ping our Bot Support if you want a better username for it. Just make sure the bot is fully operational before you do this.

Use this token to access the HTTP API:
696443...VxqS5DB7T4

For a description of the Bot API, see this page: https://core.telegram.org/bots/api

You’ll receive a message like this with the token.

And another thing, it tells you the chat room: t.me/yuis_testbot_bot

Now, click t.me/yuis_testbot_bot to open the chat. After doing /start, use the following command. (Replace <TOKEN>)

https://api.telegram.org/bot&lt;TOKEN&gt;/getUpdates

Then, you’ll get a response like the following. (Note: If you access the URL without opening the chat room, you won’t get the correct response.)

{"ok":true,"result":[{"update_id":,
"message":{"message_id":3,"from":{"id":638...737,"is_bot":false,"first_name":"Foobar","last_..."text":"/start","entities":[{"offset":0,"length":6,"type":"bot_command"}]}}]}

“id”:638…737 is the chatID.

Now let’s execute a command like the following.

curl -s -X POST https://api.telegram.org/bot<TOKEN>/sendMessage -d chat_id=<CHAT_ID> -d text="Hello World"

e.g.

curl -s -X POST https://api.telegram.org/bot6964439...lVxqS5DB7T4/sendMessage -d chat_id=63...737 -d text="Hello World"

You should have received a chat with the message “Hello World”. That was easy.

Even if you close telegram once, as long as you don’t delete the chat room, messages will be delivered with the previous command. If you have telegram on your smartphone, the same message will be automatically delivered.

I was sending to LINE with GoogleAppsScript, but what triggered this was thinking about using telegram instead. GAS is convenient, so I might write a GAS article again soon.

Share this article

Shou Arisaka Nov 26, 2025

🔗 Copy Links