SlideShare a Scribd company logo
Telegram bots
Theory and practice
Bohdan Pashkovskyi, Ph.D., Senior .NET Developer at Perfectial
Bots: An introduction for developers
Bots are third-party applications that run inside Telegram.
Users can interact with bots by sending them messages,
commands and inline requests. You control your bots
using HTTPS requests to our bot API.
How do I create a bot?
Just talk to BotFather and follow a few simple steps. Once
you've created a bot and received your authorization token,
head down to the Bot API manual to see what you can
teach your bot to do.
How are bots different from humans?
Bots have no online status and no last seen timestamps,
the interface shows the label ‘bot’ instead.
How are bots different from humans?
Bots have limited cloud storage — older messages may be
removed by the server shortly after they have been
processed.
How are bots different from humans?
Bots can't initiate conversations with users. A user must
either add them to a group or send them a message first.
People can use telegram.me/<bot_username> links or
username search to find your bot.
How are bots different from humans?
Bot usernames always end in ‘bot’ (e.g. @TriviaBot,
@GitHub_bot).
How are bots different from humans?
When added to a group, bots do not receive all messages
by default.
How are bots different from humans?
Bots never eat, sleep or complain (unless expressly
programmed otherwise).
Privacy mode
A bot running in privacy mode will not receive all
messages that people send to the group. Instead, it will
only receive:
Privacy mode
Messages that start with a slash ‘/’
Privacy mode
Replies to the bot's own messages
Privacy mode
Service messages (people added or removed from the
group, etc.)
Privacy mode
Messages from channels where it's a member
Commands
Commands present a more flexible way to communicate
with your bot. The following syntax may be used:
/command
Commands
A command must always start with the ‘/’ symbol and may not be
longer than 32 characters. Commands can use latin letters, numbers
and underscores. Here are a few examples:
/get_messages_stats
/set_timer 10min Alarm!
/get_timezone London, UK
Commands
Authorizing your bot
Each bot is given a unique authentication token when it is created. The
token looks something like 123456:ABC-DEF1234ghIkl-
zyx57W2v1u123ew11, but we'll use simply <token> in this document
instead.
Making requests
All queries to the Telegram Bot API must be served over HTTPS and
need to be presented in this form:
https://api.telegram.org/bot<token>/METHOD_NAME.
Getting updates
There are two mutually exclusive ways of receiving updates for your
bot — the getUpdates method on one hand and Webhooks on the
other. Incoming updates are stored on the server until the bot receives
them either way, but they will not be kept longer than 24 hours.
Regardless of which option you choose, you will receive JSON-
serialized Update objects as a result.
getUpdates
Use this method to receive incoming updates using long polling (wiki).
An Array of Update objects is returned.
setWebhook
Use this method to specify a url and receive incoming updates via an
outgoing webhook. Whenever there is an update for the bot, we will
send an HTTPS POST request to the specified url, containing a JSON-
serialized Update. In case of an unsuccessful request, we will give up
after a reasonable amount of attempts. Returns True on success.
Telegram bots
Telegram bots
.NET Client
https://github.com/TelegramBots/Telegram.Bot
Initialize .NET client
CommandHandler Example
@ivanofrankivsk_130_bot
@ivanofrankivsk_130_bot
Telegram bots
Telegram bots
@IF112_bot
Додавання водяного знаку
Можливість адміністрації писати
в чаті від імені бота
Telegram bots
@ifpolice_bot
Відправка повідомлення поліції
Можливість поліції писати в чаті
112 від імені бота
Telegram bots
@plusser_bot
Вам набридло збирати плюсики у чаті
і підраховувати хто ж прийде?
Плюсуватор це зробить за вас.
@plusser_bot
Вам набридло збирати плюсики у чаті
і підраховувати хто ж прийде?
Плюсуватор це зробить за вас.
Thank you
Questions?
Bohdan Pashkovskyi, Ph.D., Senior .NET Developer at Perfectial

More Related Content

DOCX
PPTX
Telegram Bot
PPT
Turbot - A Next Generation Botnet
PPTX
PPTX
How to Create a WhatsApp Chatbot using Flask Python Framework
PDF
Integrating Telegram Bots with Ruby on Rails
PDF
S377 telegrambot
PDF
New Botnets Trends and Threats (BH Europe 2007)
Telegram Bot
Turbot - A Next Generation Botnet
How to Create a WhatsApp Chatbot using Flask Python Framework
Integrating Telegram Bots with Ruby on Rails
S377 telegrambot
New Botnets Trends and Threats (BH Europe 2007)

Similar to Telegram bots (20)

PDF
Blurblurbot - Telegram Bot
PPT
DOCX
ChatGPT_MyLearning on Coding for ChatBot.docx
PPTX
Diwug 2019 Teams Development
PPTX
Deep dive into advanced teams development
PDF
Learn the Basics of Bots Before Exploring AI Agents: A Step-by-Step Guide to ...
PPT
botnet.ppt
PPTX
From ZERO to REST in an hour
PPTX
Botnet-short form for "robot network".pptx
DOCX
All you know about Botnet
PDF
ATX Bot Talk - Hello PyBot
PDF
Introduction to Slack App Development
PPTX
PPT
Defending Against Botnets
PPTX
unit cyber security BOTNETS Documents.pptx
PPTX
Botnet Architecture
PDF
Detection of Botnets using Honeypots and P2P Botnets
PDF
Developing apps using Perl
PPTX
Clever data building a chatbot from your database
PPTX
Botnets In Cyber Security
Blurblurbot - Telegram Bot
ChatGPT_MyLearning on Coding for ChatBot.docx
Diwug 2019 Teams Development
Deep dive into advanced teams development
Learn the Basics of Bots Before Exploring AI Agents: A Step-by-Step Guide to ...
botnet.ppt
From ZERO to REST in an hour
Botnet-short form for "robot network".pptx
All you know about Botnet
ATX Bot Talk - Hello PyBot
Introduction to Slack App Development
Defending Against Botnets
unit cyber security BOTNETS Documents.pptx
Botnet Architecture
Detection of Botnets using Honeypots and P2P Botnets
Developing apps using Perl
Clever data building a chatbot from your database
Botnets In Cyber Security
Ad

More from Bohdan Pashkovskyi (10)

PDF
Деякі аспекти встановлення дорожніх знаків
PPTX
CoreCamp "Automated testing basics for developers"
PPTX
CQRS and Event Sourcing
PPTX
C# Lesson 3
PPTX
C# Lesson 1
PPTX
Automated testing
PPTX
IF .NET User Group
PPTX
Asynchronous programming in C#
PPTX
ASP .NET MVC - best practices
PPTX
Деякі аспекти встановлення дорожніх знаків
CoreCamp "Automated testing basics for developers"
CQRS and Event Sourcing
C# Lesson 3
C# Lesson 1
Automated testing
IF .NET User Group
Asynchronous programming in C#
ASP .NET MVC - best practices
Ad

Recently uploaded (20)

PDF
Designing Intelligence for the Shop Floor.pdf
PPTX
Transform Your Business with a Software ERP System
PDF
iTop VPN 6.5.0 Crack + License Key 2025 (Premium Version)
PPTX
Reimagine Home Health with the Power of Agentic AI​
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PPTX
Advanced SystemCare Ultimate Crack + Portable (2025)
PPTX
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
PPTX
history of c programming in notes for students .pptx
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
medical staffing services at VALiNTRY
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PPTX
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PDF
Cost to Outsource Software Development in 2025
PPTX
Operating system designcfffgfgggggggvggggggggg
PPTX
Computer Software and OS of computer science of grade 11.pptx
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
Nekopoi APK 2025 free lastest update
PDF
Autodesk AutoCAD Crack Free Download 2025
Designing Intelligence for the Shop Floor.pdf
Transform Your Business with a Software ERP System
iTop VPN 6.5.0 Crack + License Key 2025 (Premium Version)
Reimagine Home Health with the Power of Agentic AI​
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Advanced SystemCare Ultimate Crack + Portable (2025)
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
history of c programming in notes for students .pptx
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
medical staffing services at VALiNTRY
Design an Analysis of Algorithms II-SECS-1021-03
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
wealthsignaloriginal-com-DS-text-... (1).pdf
Cost to Outsource Software Development in 2025
Operating system designcfffgfgggggggvggggggggg
Computer Software and OS of computer science of grade 11.pptx
How to Choose the Right IT Partner for Your Business in Malaysia
Nekopoi APK 2025 free lastest update
Autodesk AutoCAD Crack Free Download 2025

Telegram bots