SlideShare ist ein Scribd-Unternehmen logo
1 von 29
Downloaden Sie, um offline zu lesen
Create Your Bot with Delphi
Crea il tuo Bot con Delphi
Who am I?
About me
Marco Breveglieri
Software and Web Developer
www.compilaquindiva.com
Via De Gasperi 14
42019 Scandiano (RE)
ITALY
You might find interesting…
Delphi Succinctly
Learn the fundamentals of Delphi
to build a variety of solutions for
many devices and platforms in
about 100 pages.
Find more here:
👉 http://bit.ly/delphi-succinctly
You might find interesting…
Delphi Podcast
The first Italian podcast
about Delphi.
Listen here:
👉 http://www.delphipodcast.com
and also take part in it!
You might find interesting…
Component Tales
Find out what Delphi components
do when you close the IDE...
Smile (if you can) here:
👉 https://twitter.com/ComponentTales
Bots!
An introduction to Bots
What is a Bot?
A «(Ro)bot» is a software
application that runs
automated tasks over the
Internet.
Typically, bots perform tasks
that are both simple and
structurally repetitive, at a
much higher rate than
would be possible for a
human alone.
Bot Purposes
• Communicate with other users (that's our case 👍)
• Instant Messaging and IRC
• Social Bots
• Telegram Bots
• Commercial Purposes
• Auctions and Bets (eBay, Betfair, …)
• Application and Content Stores (Apple Store, Google Play, YouTube …)
• Malicious Purposes
• Spam bots
• DDos attacker
• Gaming
• MMORPG
What you can do
• Get customized notification and
news
• Integrate your messaging
experience with external
services
• Create your own custom service
• Create games (NEW! in Telegram
Bots)
• Smart newspapers
• Weather forecast
• Local news or events
• Track shipping
• Translate content on-the-fly
• Import photos, videos and
content
• Build a knowledge base
• Get cool! 😎
What you can do
Why Chat Bots?
• Bots are a lot easier to install than mobile apps
• Bots are easily distributed
• Quality mobile apps are expensive to build, mantain and deploy
• You don't have to deal with security aspects
• Moving complexity to the cloud reduces a user's cognitive load
Natural Language Processing
NLP is the ability of a
computer program to
understand human speech
as it is written or spoken.
• It makes computer to perform
useful tasks with the natural
languages humans use
• It is based on machine learning
• Supports both speech and text
But we will not deal with NLP in
this speech.
Platforms and Frameworks
Just to name a few…
• Microsoft Bot Framework
• Telegram API/SDK
• Facebook Messenger Bots
• Google Allo (?)
Telegram
Get to know Telegram
What is Telegram?
Telegram is a cloud-based instant
messaging (IM) service.
Users can send and exchange
• Simple messages
• Photos and videos
• Stickers
• Virtually any type of file
• Supports (custom) encrypted
(E2E) messaging
• Cloud Based Architecture
• Native app for every platform,
including Web
• Client-side code is open-source
• Server-side code is proprietary
and closed-source
Available Clients
Telegram supports a wide
range of devices and
operating systems.
• Web
• Windows
• Android
• iOS
• Windows Phone
• OSX
• Linux
• Ubuntu Touch
Telegram Facts
• 100 million Monthly Active Users
• 350 K of signups per day
• 15 billion daily message sent
• Has proven to be quite robust
• Has a good Bot platform!
Telegram Bot Platform
• Release in June 2015:
recent but powerful!
• Updated just some day ago
(added Game support)
• Open to everyone without
barriers
• No approval process required
• Allows 1-1 conversations
• Can be added to groups
and channels
• Can be invoked "on the fly"
(inline bots)
Difference with humans
• No online status and no last seen timestamps
• Can't initiate conversation with users
• Username always ends in "bot"
• When added to a group, bots do not receive all messages by default
• Bots never eat, sleep or complain (unless expressly programmed
otherwise)
Let's see some sample
Comune di Reggio Emilia BOT (@ComuneREbot)
https://telegram.me/ComuneREbot
Nice Bots:
• TrackBot (https://botfactory.info/trackbot/)
• Giphy Bot (https://telegram.me/gif)
• TerremotiBot (https://botfactory.info/terremotibot/)
• CinemasBot (https://telegram.me/cinemasbot)
Want more?
http://botsfortelegram.com/
Create a Bot
Let's create a Bot with Telegram
How do bots work?
• Send messages and commands to
bots by opening a chat with them
or by adding them to groups.
• Send requests directly from the
input field by typing the bot's
@username and a query (inline
bots)
• Messages, commands and requests
sent by users are passed to the
software running on Telegram
servers.
• Telegram servers handles all
encryption and communication
with the Telegram API for you.
• You communicate with this server
via a simple HTTPS-interface that
offers a simplified version of the
Telegram API: the Bot API.
Create a new Bot
BotFather is the one bot to rule
them all.
It will help you create new bots
and change settings for existing
ones.
«One Bot to rule them all, One Bot to
find them
One Bot to bring them all and in the
darkness bind them»
-- The Lord of the Bots, J.R.R.Tolkien
Bot API
• The Bot API is an HTTP-based api
• It supports GET and POST requests
Making Requests
• All queries must be served over HTTPS and in this form:
https://api.telegram.org/bot<token>/METHOD_NAME
• All queries must be made using UTF-8
• All methods are case-insensitive
• The response is a JSON object which:
• always has an 'ok' boolean field.
• has a 'result' field if the response is ok.
• may have an optional 'description' field which contains some info about the occurred error
• also has a 'error_code' in the case of errors.
Let's test it!
How to get updates?
Call the method name:
getUpdates()
You can use
• Continuous Polling
• Long Polling technique
(easy, but slightly inefficient and
resource consumer)
• Webhooks
(better, but more complex)
Let's see some code
Questions?
Don't be afraid
of asking…
Thanks!
😇

Weitere ähnliche Inhalte

Was ist angesagt?

Best practices in Moodle Course Design
Best practices in Moodle Course DesignBest practices in Moodle Course Design
Best practices in Moodle Course Design
Michelle Moore
 
Peraturan makmal komputer dan etika penggunaan internet
Peraturan makmal komputer dan etika penggunaan internetPeraturan makmal komputer dan etika penggunaan internet
Peraturan makmal komputer dan etika penggunaan internet
O'conner L'minl
 
Soal trouble praktikum revisi
Soal trouble praktikum revisiSoal trouble praktikum revisi
Soal trouble praktikum revisi
Samsugi S
 

Was ist angesagt? (20)

CSS Module 2 - Setting IP Address
CSS Module 2 - Setting IP AddressCSS Module 2 - Setting IP Address
CSS Module 2 - Setting IP Address
 
Best practices in Moodle Course Design
Best practices in Moodle Course DesignBest practices in Moodle Course Design
Best practices in Moodle Course Design
 
How to prepare a portable bootable devices
How to prepare a portable bootable devicesHow to prepare a portable bootable devices
How to prepare a portable bootable devices
 
Boost Your Teaching with Google Tools
Boost Your Teaching with Google ToolsBoost Your Teaching with Google Tools
Boost Your Teaching with Google Tools
 
IPCOP
IPCOPIPCOP
IPCOP
 
Hardware review rubrics
Hardware review rubricsHardware review rubrics
Hardware review rubrics
 
Practicas visualbasic
Practicas visualbasicPracticas visualbasic
Practicas visualbasic
 
20 Need-to-Know Microsoft Teams Productivity Tips
20 Need-to-Know Microsoft Teams Productivity Tips20 Need-to-Know Microsoft Teams Productivity Tips
20 Need-to-Know Microsoft Teams Productivity Tips
 
Google meet guide file
Google meet guide fileGoogle meet guide file
Google meet guide file
 
File server on using cisco packet tracer
File server on using cisco packet tracerFile server on using cisco packet tracer
File server on using cisco packet tracer
 
Langkah-Langkah Menggunakan POWERPOInt
Langkah-Langkah Menggunakan POWERPOIntLangkah-Langkah Menggunakan POWERPOInt
Langkah-Langkah Menggunakan POWERPOInt
 
Part 4 - Form dan Objek Kontrol (Lanjutan)
Part 4 - Form dan Objek Kontrol (Lanjutan)Part 4 - Form dan Objek Kontrol (Lanjutan)
Part 4 - Form dan Objek Kontrol (Lanjutan)
 
Peraturan makmal komputer dan etika penggunaan internet
Peraturan makmal komputer dan etika penggunaan internetPeraturan makmal komputer dan etika penggunaan internet
Peraturan makmal komputer dan etika penggunaan internet
 
Seip trainee admission form
Seip trainee admission formSeip trainee admission form
Seip trainee admission form
 
Soal trouble praktikum revisi
Soal trouble praktikum revisiSoal trouble praktikum revisi
Soal trouble praktikum revisi
 
penyelenggaraan komputer
penyelenggaraan komputerpenyelenggaraan komputer
penyelenggaraan komputer
 
Google meet guide file
Google meet guide fileGoogle meet guide file
Google meet guide file
 
IP Addressing Semi - Detailed Lesson Plan (TLE ICT 10)
IP Addressing Semi - Detailed Lesson Plan (TLE ICT 10)IP Addressing Semi - Detailed Lesson Plan (TLE ICT 10)
IP Addressing Semi - Detailed Lesson Plan (TLE ICT 10)
 
Installing win 7 os
Installing win 7 osInstalling win 7 os
Installing win 7 os
 
Measurement units of byte
Measurement units of byteMeasurement units of byte
Measurement units of byte
 

Ähnlich wie Create a Bot with Delphi and Telegram - ITDevCon 2016

Ähnlich wie Create a Bot with Delphi and Telegram - ITDevCon 2016 (20)

Bot. You said bot? Let build bot then! - Laurent Ellerbach
Bot. You said bot? Let build bot then! - Laurent EllerbachBot. You said bot? Let build bot then! - Laurent Ellerbach
Bot. You said bot? Let build bot then! - Laurent Ellerbach
 
ITCamp 2017 - Laurent Ellerbach - Bot. You said bot? Let's build a bot then...
ITCamp 2017 - Laurent Ellerbach - Bot. You said bot? Let's build a bot then...ITCamp 2017 - Laurent Ellerbach - Bot. You said bot? Let's build a bot then...
ITCamp 2017 - Laurent Ellerbach - Bot. You said bot? Let's build a bot then...
 
Lessons learned from building a commercial bot development platform
Lessons learned from building a commercial bot development platformLessons learned from building a commercial bot development platform
Lessons learned from building a commercial bot development platform
 
SharePoint Fest DC 2019 - Bot Framework and Microsoft Graph - Join The Revolu...
SharePoint Fest DC 2019 - Bot Framework and Microsoft Graph - Join The Revolu...SharePoint Fest DC 2019 - Bot Framework and Microsoft Graph - Join The Revolu...
SharePoint Fest DC 2019 - Bot Framework and Microsoft Graph - Join The Revolu...
 
Chatbot ppt
Chatbot pptChatbot ppt
Chatbot ppt
 
Global Azure2021 Verona.pptx
Global Azure2021 Verona.pptxGlobal Azure2021 Verona.pptx
Global Azure2021 Verona.pptx
 
Building a bot with an intent
Building a bot with an intentBuilding a bot with an intent
Building a bot with an intent
 
The Software Challenges of Building Smart Chatbots - ICSE'21
The Software Challenges of Building Smart Chatbots - ICSE'21The Software Challenges of Building Smart Chatbots - ICSE'21
The Software Challenges of Building Smart Chatbots - ICSE'21
 
Introduction to BOT Framework- Global Azure Bootcamp 2017
Introduction to BOT Framework- Global Azure Bootcamp 2017Introduction to BOT Framework- Global Azure Bootcamp 2017
Introduction to BOT Framework- Global Azure Bootcamp 2017
 
Chatbot Revolution: Exploring Opportunities, Use Cases, & Bot Design
Chatbot Revolution: Exploring Opportunities, Use Cases, & Bot DesignChatbot Revolution: Exploring Opportunities, Use Cases, & Bot Design
Chatbot Revolution: Exploring Opportunities, Use Cases, & Bot Design
 
Etherium Intro for techies
Etherium Intro for techiesEtherium Intro for techies
Etherium Intro for techies
 
PyMultitor
PyMultitorPyMultitor
PyMultitor
 
Dialogflow
DialogflowDialogflow
Dialogflow
 
Everything you need to know about chatbots
Everything you need to know about chatbotsEverything you need to know about chatbots
Everything you need to know about chatbots
 
Ai chatbot ppt.pptx
Ai chatbot ppt.pptxAi chatbot ppt.pptx
Ai chatbot ppt.pptx
 
OroCRM CTO Yoav Kutner Presents at Meet Magento
OroCRM CTO Yoav Kutner Presents at Meet MagentoOroCRM CTO Yoav Kutner Presents at Meet Magento
OroCRM CTO Yoav Kutner Presents at Meet Magento
 
Build an Intelligent Bot
Build an Intelligent BotBuild an Intelligent Bot
Build an Intelligent Bot
 
rohit sharma - dev ops virtual assistant - automate devops stuffs using nlp a...
rohit sharma - dev ops virtual assistant - automate devops stuffs using nlp a...rohit sharma - dev ops virtual assistant - automate devops stuffs using nlp a...
rohit sharma - dev ops virtual assistant - automate devops stuffs using nlp a...
 
Conversational UI Bot Framework
Conversational UI Bot FrameworkConversational UI Bot Framework
Conversational UI Bot Framework
 
New Botnets Trends and Threats (BH Europe 2007)
New Botnets Trends and Threats (BH Europe 2007)New Botnets Trends and Threats (BH Europe 2007)
New Botnets Trends and Threats (BH Europe 2007)
 

Mehr von Marco Breveglieri

Mehr von Marco Breveglieri (11)

Delphi & Dintorni Webinar - Diventa un mago del Testing
Delphi & Dintorni Webinar - Diventa un mago del TestingDelphi & Dintorni Webinar - Diventa un mago del Testing
Delphi & Dintorni Webinar - Diventa un mago del Testing
 
Delphi & Dintorni Webinar - Padroneggiare i principi SOLID con Delphi
Delphi & Dintorni Webinar - Padroneggiare i principi SOLID con DelphiDelphi & Dintorni Webinar - Padroneggiare i principi SOLID con Delphi
Delphi & Dintorni Webinar - Padroneggiare i principi SOLID con Delphi
 
Does The Delphi IDE Narrow You? Extend It! - ITDevConX European Delphi Confer...
Does The Delphi IDE Narrow You? Extend It! - ITDevConX European Delphi Confer...Does The Delphi IDE Narrow You? Extend It! - ITDevConX European Delphi Confer...
Does The Delphi IDE Narrow You? Extend It! - ITDevConX European Delphi Confer...
 
Creare un Information Radiator con Delphi
Creare un Information Radiator con DelphiCreare un Information Radiator con Delphi
Creare un Information Radiator con Delphi
 
"Non Aprite Quella Unit!" ovvero "Scrivere Clean Code in Delphi
"Non Aprite Quella Unit!" ovvero "Scrivere Clean Code in Delphi"Non Aprite Quella Unit!" ovvero "Scrivere Clean Code in Delphi
"Non Aprite Quella Unit!" ovvero "Scrivere Clean Code in Delphi
 
REST API fantastiche e dove trovarle
REST API fantastiche e dove trovarleREST API fantastiche e dove trovarle
REST API fantastiche e dove trovarle
 
Applicazioni Web ultra-performanti con Vue.js e Delphi
Applicazioni Web ultra-performanti con Vue.js e DelphiApplicazioni Web ultra-performanti con Vue.js e Delphi
Applicazioni Web ultra-performanti con Vue.js e Delphi
 
Web Development with Delphi and React - ITDevCon 2016
Web Development with Delphi and React - ITDevCon 2016Web Development with Delphi and React - ITDevCon 2016
Web Development with Delphi and React - ITDevCon 2016
 
Sviluppo Web con React e Delphi - Seminario Delphi Day 2016, Piacenza
Sviluppo Web con React e Delphi - Seminario Delphi Day 2016, PiacenzaSviluppo Web con React e Delphi - Seminario Delphi Day 2016, Piacenza
Sviluppo Web con React e Delphi - Seminario Delphi Day 2016, Piacenza
 
Reportage Delphi Day 2012
Reportage Delphi Day 2012Reportage Delphi Day 2012
Reportage Delphi Day 2012
 
Reportage "RAD Studio XE2 World Tour"
Reportage "RAD Studio XE2 World Tour"Reportage "RAD Studio XE2 World Tour"
Reportage "RAD Studio XE2 World Tour"
 

Kürzlich hochgeladen

AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 

Kürzlich hochgeladen (20)

HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
ManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide DeckManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide Deck
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 

Create a Bot with Delphi and Telegram - ITDevCon 2016

  • 1. Create Your Bot with Delphi Crea il tuo Bot con Delphi
  • 3. About me Marco Breveglieri Software and Web Developer www.compilaquindiva.com Via De Gasperi 14 42019 Scandiano (RE) ITALY
  • 4. You might find interesting… Delphi Succinctly Learn the fundamentals of Delphi to build a variety of solutions for many devices and platforms in about 100 pages. Find more here: 👉 http://bit.ly/delphi-succinctly
  • 5. You might find interesting… Delphi Podcast The first Italian podcast about Delphi. Listen here: 👉 http://www.delphipodcast.com and also take part in it!
  • 6. You might find interesting… Component Tales Find out what Delphi components do when you close the IDE... Smile (if you can) here: 👉 https://twitter.com/ComponentTales
  • 8. What is a Bot? A «(Ro)bot» is a software application that runs automated tasks over the Internet. Typically, bots perform tasks that are both simple and structurally repetitive, at a much higher rate than would be possible for a human alone.
  • 9. Bot Purposes • Communicate with other users (that's our case 👍) • Instant Messaging and IRC • Social Bots • Telegram Bots • Commercial Purposes • Auctions and Bets (eBay, Betfair, …) • Application and Content Stores (Apple Store, Google Play, YouTube …) • Malicious Purposes • Spam bots • DDos attacker • Gaming • MMORPG
  • 10. What you can do • Get customized notification and news • Integrate your messaging experience with external services • Create your own custom service • Create games (NEW! in Telegram Bots) • Smart newspapers • Weather forecast • Local news or events • Track shipping • Translate content on-the-fly • Import photos, videos and content • Build a knowledge base • Get cool! 😎
  • 12. Why Chat Bots? • Bots are a lot easier to install than mobile apps • Bots are easily distributed • Quality mobile apps are expensive to build, mantain and deploy • You don't have to deal with security aspects • Moving complexity to the cloud reduces a user's cognitive load
  • 13. Natural Language Processing NLP is the ability of a computer program to understand human speech as it is written or spoken. • It makes computer to perform useful tasks with the natural languages humans use • It is based on machine learning • Supports both speech and text But we will not deal with NLP in this speech.
  • 14. Platforms and Frameworks Just to name a few… • Microsoft Bot Framework • Telegram API/SDK • Facebook Messenger Bots • Google Allo (?)
  • 16. What is Telegram? Telegram is a cloud-based instant messaging (IM) service. Users can send and exchange • Simple messages • Photos and videos • Stickers • Virtually any type of file • Supports (custom) encrypted (E2E) messaging • Cloud Based Architecture • Native app for every platform, including Web • Client-side code is open-source • Server-side code is proprietary and closed-source
  • 17. Available Clients Telegram supports a wide range of devices and operating systems. • Web • Windows • Android • iOS • Windows Phone • OSX • Linux • Ubuntu Touch
  • 18. Telegram Facts • 100 million Monthly Active Users • 350 K of signups per day • 15 billion daily message sent • Has proven to be quite robust • Has a good Bot platform!
  • 19. Telegram Bot Platform • Release in June 2015: recent but powerful! • Updated just some day ago (added Game support) • Open to everyone without barriers • No approval process required • Allows 1-1 conversations • Can be added to groups and channels • Can be invoked "on the fly" (inline bots)
  • 20. Difference with humans • No online status and no last seen timestamps • Can't initiate conversation with users • Username always ends in "bot" • When added to a group, bots do not receive all messages by default • Bots never eat, sleep or complain (unless expressly programmed otherwise)
  • 21. Let's see some sample Comune di Reggio Emilia BOT (@ComuneREbot) https://telegram.me/ComuneREbot Nice Bots: • TrackBot (https://botfactory.info/trackbot/) • Giphy Bot (https://telegram.me/gif) • TerremotiBot (https://botfactory.info/terremotibot/) • CinemasBot (https://telegram.me/cinemasbot) Want more? http://botsfortelegram.com/
  • 22. Create a Bot Let's create a Bot with Telegram
  • 23. How do bots work? • Send messages and commands to bots by opening a chat with them or by adding them to groups. • Send requests directly from the input field by typing the bot's @username and a query (inline bots) • Messages, commands and requests sent by users are passed to the software running on Telegram servers. • Telegram servers handles all encryption and communication with the Telegram API for you. • You communicate with this server via a simple HTTPS-interface that offers a simplified version of the Telegram API: the Bot API.
  • 24. Create a new Bot BotFather is the one bot to rule them all. It will help you create new bots and change settings for existing ones. «One Bot to rule them all, One Bot to find them One Bot to bring them all and in the darkness bind them» -- The Lord of the Bots, J.R.R.Tolkien
  • 25. Bot API • The Bot API is an HTTP-based api • It supports GET and POST requests Making Requests • All queries must be served over HTTPS and in this form: https://api.telegram.org/bot<token>/METHOD_NAME • All queries must be made using UTF-8 • All methods are case-insensitive • The response is a JSON object which: • always has an 'ok' boolean field. • has a 'result' field if the response is ok. • may have an optional 'description' field which contains some info about the occurred error • also has a 'error_code' in the case of errors. Let's test it!
  • 26. How to get updates? Call the method name: getUpdates() You can use • Continuous Polling • Long Polling technique (easy, but slightly inefficient and resource consumer) • Webhooks (better, but more complex)