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.
.NET Client
https://github.com/TelegramBots/Telegram.Bot
Initialize .NET client
CommandHandler Example
@ivanofrankivsk_130_bot
@ivanofrankivsk_130_bot
@IF112_bot
Додавання водяного знаку
Можливість адміністрації писати
в чаті від імені бота
@ifpolice_bot
Відправка повідомлення поліції
Можливість поліції писати в чаті
112 від імені бота
@plusser_bot
Вам набридло збирати плюсики у чаті
і підраховувати хто ж прийде?
Плюсуватор це зробить за вас.
@plusser_bot
Вам набридло збирати плюсики у чаті
і підраховувати хто ж прийде?
Плюсуватор це зробить за вас.
Thank you
Questions?
Bohdan Pashkovskyi, Ph.D., Senior .NET Developer at Perfectial

More Related Content

Similar to Telegram bots

Blurblurbot - Telegram Bot
Blurblurbot - Telegram BotBlurblurbot - Telegram Bot
Blurblurbot - Telegram Bot
Darshil Chanpura
 
098
098098
Diwug 2019 Teams Development
Diwug 2019 Teams DevelopmentDiwug 2019 Teams Development
Diwug 2019 Teams Development
Albert-Jan Schot
 
Deep dive into advanced teams development
Deep dive into advanced teams developmentDeep dive into advanced teams development
Deep dive into advanced teams development
BIWUG
 
botnet.ppt
botnet.pptbotnet.ppt
botnet.ppt
KiranKumar24546
 
From ZERO to REST in an hour
From ZERO to REST in an hour From ZERO to REST in an hour
From ZERO to REST in an hour
Cisco DevNet
 
All you know about Botnet
All you know about BotnetAll you know about Botnet
All you know about Botnet
Naveen Titare
 
ATX Bot Talk - Hello PyBot
ATX Bot Talk - Hello PyBotATX Bot Talk - Hello PyBot
ATX Bot Talk - Hello PyBot
Jeff Kramer
 
Introduction to Slack App Development
Introduction to Slack App Development Introduction to Slack App Development
Introduction to Slack App Development
Serhat Can
 
Bot
BotBot
Defending Against Botnets
Defending Against BotnetsDefending Against Botnets
Defending Against Botnets
Jim Lippard
 
Botnet Architecture
Botnet ArchitectureBotnet Architecture
Botnet Architecture
Bhagath Singh Jayaprakasam
 
Detection of Botnets using Honeypots and P2P Botnets
Detection of Botnets using Honeypots and P2P BotnetsDetection of Botnets using Honeypots and P2P Botnets
Detection of Botnets using Honeypots and P2P Botnets
CSCJournals
 
Developing apps using Perl
Developing apps using PerlDeveloping apps using Perl
Developing apps using Perl
Anatoly Sharifulin
 
Clever data building a chatbot from your database
Clever data building a chatbot from your databaseClever data building a chatbot from your database
Clever data building a chatbot from your database
Luis Beltran
 
Botnets In Cyber Security
Botnets In Cyber SecurityBotnets In Cyber Security
Botnets In Cyber Security
sumit saurav
 
Spam Wars
Spam WarsSpam Wars
Spam Wars
Maurice Green
 
virtual-2021-data.sql_.saturday.la-Building database interactions with users ...
virtual-2021-data.sql_.saturday.la-Building database interactions with users ...virtual-2021-data.sql_.saturday.la-Building database interactions with users ...
virtual-2021-data.sql_.saturday.la-Building database interactions with users ...
Luis Beltran
 
Http request&response by Vignesh 15 MAR 2014
Http request&response by Vignesh 15 MAR 2014Http request&response by Vignesh 15 MAR 2014
Http request&response by Vignesh 15 MAR 2014
Navaneethan Naveen
 
Create a Bot with Delphi and Telegram - ITDevCon 2016
Create a Bot with Delphi and Telegram - ITDevCon 2016Create a Bot with Delphi and Telegram - ITDevCon 2016
Create a Bot with Delphi and Telegram - ITDevCon 2016
Marco Breveglieri
 

Similar to Telegram bots (20)

Blurblurbot - Telegram Bot
Blurblurbot - Telegram BotBlurblurbot - Telegram Bot
Blurblurbot - Telegram Bot
 
098
098098
098
 
Diwug 2019 Teams Development
Diwug 2019 Teams DevelopmentDiwug 2019 Teams Development
Diwug 2019 Teams Development
 
Deep dive into advanced teams development
Deep dive into advanced teams developmentDeep dive into advanced teams development
Deep dive into advanced teams development
 
botnet.ppt
botnet.pptbotnet.ppt
botnet.ppt
 
From ZERO to REST in an hour
From ZERO to REST in an hour From ZERO to REST in an hour
From ZERO to REST in an hour
 
All you know about Botnet
All you know about BotnetAll you know about Botnet
All you know about Botnet
 
ATX Bot Talk - Hello PyBot
ATX Bot Talk - Hello PyBotATX Bot Talk - Hello PyBot
ATX Bot Talk - Hello PyBot
 
Introduction to Slack App Development
Introduction to Slack App Development Introduction to Slack App Development
Introduction to Slack App Development
 
Bot
BotBot
Bot
 
Defending Against Botnets
Defending Against BotnetsDefending Against Botnets
Defending Against Botnets
 
Botnet Architecture
Botnet ArchitectureBotnet Architecture
Botnet Architecture
 
Detection of Botnets using Honeypots and P2P Botnets
Detection of Botnets using Honeypots and P2P BotnetsDetection of Botnets using Honeypots and P2P Botnets
Detection of Botnets using Honeypots and P2P Botnets
 
Developing apps using Perl
Developing apps using PerlDeveloping apps using Perl
Developing apps using Perl
 
Clever data building a chatbot from your database
Clever data building a chatbot from your databaseClever data building a chatbot from your database
Clever data building a chatbot from your database
 
Botnets In Cyber Security
Botnets In Cyber SecurityBotnets In Cyber Security
Botnets In Cyber Security
 
Spam Wars
Spam WarsSpam Wars
Spam Wars
 
virtual-2021-data.sql_.saturday.la-Building database interactions with users ...
virtual-2021-data.sql_.saturday.la-Building database interactions with users ...virtual-2021-data.sql_.saturday.la-Building database interactions with users ...
virtual-2021-data.sql_.saturday.la-Building database interactions with users ...
 
Http request&response by Vignesh 15 MAR 2014
Http request&response by Vignesh 15 MAR 2014Http request&response by Vignesh 15 MAR 2014
Http request&response by Vignesh 15 MAR 2014
 
Create a Bot with Delphi and Telegram - ITDevCon 2016
Create a Bot with Delphi and Telegram - ITDevCon 2016Create a Bot with Delphi and Telegram - ITDevCon 2016
Create a Bot with Delphi and Telegram - ITDevCon 2016
 

More from Bohdan Pashkovskyi

CoreCamp "Automated testing basics for developers"
CoreCamp "Automated testing basics for developers"CoreCamp "Automated testing basics for developers"
CoreCamp "Automated testing basics for developers"
Bohdan Pashkovskyi
 
CQRS and Event Sourcing
CQRS and Event SourcingCQRS and Event Sourcing
CQRS and Event Sourcing
Bohdan Pashkovskyi
 
C# Lesson 3
C# Lesson 3C# Lesson 3
C# Lesson 3
Bohdan Pashkovskyi
 
C# Lesson 1
C# Lesson 1C# Lesson 1
C# Lesson 1
Bohdan Pashkovskyi
 
Automated testing
Automated testingAutomated testing
Automated testing
Bohdan Pashkovskyi
 
IF .NET User Group
IF .NET User GroupIF .NET User Group
IF .NET User Group
Bohdan Pashkovskyi
 
Asynchronous programming in C#
Asynchronous programming in C#Asynchronous programming in C#
Asynchronous programming in C#
Bohdan Pashkovskyi
 
ASP .NET MVC - best practices
ASP .NET MVC - best practicesASP .NET MVC - best practices
ASP .NET MVC - best practices
Bohdan Pashkovskyi
 
.Net Core
.Net Core.Net Core

More from Bohdan Pashkovskyi (9)

CoreCamp "Automated testing basics for developers"
CoreCamp "Automated testing basics for developers"CoreCamp "Automated testing basics for developers"
CoreCamp "Automated testing basics for developers"
 
CQRS and Event Sourcing
CQRS and Event SourcingCQRS and Event Sourcing
CQRS and Event Sourcing
 
C# Lesson 3
C# Lesson 3C# Lesson 3
C# Lesson 3
 
C# Lesson 1
C# Lesson 1C# Lesson 1
C# Lesson 1
 
Automated testing
Automated testingAutomated testing
Automated testing
 
IF .NET User Group
IF .NET User GroupIF .NET User Group
IF .NET User Group
 
Asynchronous programming in C#
Asynchronous programming in C#Asynchronous programming in C#
Asynchronous programming in C#
 
ASP .NET MVC - best practices
ASP .NET MVC - best practicesASP .NET MVC - best practices
ASP .NET MVC - best practices
 
.Net Core
.Net Core.Net Core
.Net Core
 

Recently uploaded

Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
kalichargn70th171
 
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdfRevolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
Undress Baby
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
Deuglo Infosystem Pvt Ltd
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
Grant Fritchey
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
Remote DBA Services
 
GreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-JurisicGreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-Jurisic
Green Software Development
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
Hornet Dynamics
 
DDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systemsDDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systems
Gerardo Pardo-Castellote
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
Green Software Development
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
mz5nrf0n
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Neo4j
 
What is Augmented Reality Image Tracking
What is Augmented Reality Image TrackingWhat is Augmented Reality Image Tracking
What is Augmented Reality Image Tracking
pavan998932
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
Hornet Dynamics
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Aftab Hussain
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
Rakesh Kumar R
 
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesE-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
Quickdice ERP
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
ICS
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
Sven Peters
 

Recently uploaded (20)

Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
 
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdfRevolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
 
GreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-JurisicGreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-Jurisic
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
 
DDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systemsDDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systems
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
 
What is Augmented Reality Image Tracking
What is Augmented Reality Image TrackingWhat is Augmented Reality Image Tracking
What is Augmented Reality Image Tracking
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
 
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesE-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
 

Telegram bots