telegram bot


Open a chat with @BotFather in Telegram and click on the command /start.

After you get a list of commands, /newbotyou use the command /newbotto get this message /newbot:

All right, a new bot. What do we call it? Please choose a name for your bot.

Enter a name for your bot, which can be anything, and submit it. Then BotFather asks for a username for your bot:

Well. Now let's choose a username for your bot. It has to botend in the. For example: TetrisBot or Tetris_bot.

That has to end with "bot". If the username you want is taken or not available, try again with a different name.

Finally, your bot will be created and the following message will appear. You have to use the bot token to communicate with the telegram. So make a note of it.

Done! Congratulations on your new bot. You can find it at telegram.me/???bot. You are now ready to add a description, section and profile picture for your bot. A list of commands can be found in / help. By the way: when you have finished creating your cool bot, call our bot support if you want a better username. Just make sure the bot is fully functional before doing this.

Use this token to access the HTTP API: xxx: xxx

With the won tokens you can now send a test message by the site https://api.telegram.org/botBOTTOKEN/sendmessage?chat_id=YOURCHATID&text=YOURTEXTcall

There are two general methods for the telegram bots to interact: a push and a pull method. With the pull method, you /getupdates'll have /getupdatesto keep checking to see if any new messages are being sent to your bot. The push method uses a webhook ( /setwebhookmethod) for your script that is called every time a user sends a message to your bot.

The information provided is a JSON-formatted file with all the necessary information (of the sender and the message).

You can write your bot in many languages ​​(PHP, Python, Lua ...) as long as it treats the webhook as input and can call websites.

For more information, you can always refer to the BOT API documentation, which can be found here .

0 Comments