SlideShare a Scribd company logo
Integrating Telegram Bots
with Rails
Chris Downey
cdowney@protonmail.com
Please install Telegram on your phone or laptop for
hands-on experience during the presentation
https://telegram.org/
it will also be more interesting when we get into managing subscriptions
1
Create a DCRug Telegram bot
Bots are third-party apps that run
inside Telegram.
Our Rails app controls the bot,
providing the content, managing
subscribers, interactions, and
broadcasts.
Our bot will send DCRug event listings
2
Create a DCRug Telegram bot
Start by using a bot to create your bot
3
Now that DCRug bot is created,
how do we communicate with it?
4
With bots, we can have 2 types of communication:
1. Subscriber initiated
2. Bot (Rails app) initiated
5
Subscriber initiated communication
6
Bot (Rails app) initiated communication
7
Capture real-time Telegram bot events
Just for fun: first article on web hooks (may have coined term):
http://progrium.com/blog/2007/05/03/web-hooks-to-revolutionize-the-web/
8
We will setup DCRug bot with a webhook, and use
ngrok to create a secure tunnel to my dev machine
and to inspect the webhook payload
9
10
Setup dev machine to accept webhooks from
Telegram with ngrok
11
If you have Telegram installed, please subscribe
Via browser: http://telegram.me/DCRug_bot
Via Telegram: go into “Chats” and search for DCRug
(please call out if this isn’t working for you)
secret command /count provides number of subscribers
12
What just happened?
Our bot (Rails app!):
• intercepted a webhook
• extracted the bot command
• created a subscriber in the database
• sent a response to the new subscriber
13
Intercept a webhook
14
Extract bot command from webhook payload
15
Create a subscriber in the database
16
Send response to the new subscriber
use telegram-bot-ruby gem to wrap and simplify Telegram API
17
18
Pop Quiz!
how can we broadcast DCRug events,
right now, to all active subscribers?
Broadcast DCRug events to all subscribers
19
The End
Questions, comments, thoughts?
20
(See me after the meeting for an example of another very different bot if interested, it
enables searches across 2 websites and a database of tweets going back 6 years)
A bot serving a small
educational non-profit
https://telegram.me/VaxCalc_bot
Searches a database of more than 1,100 “foundational
knowledge” tweets produced since 2010
Combines results with custom Google search of 2
content-heavy websites with articles going back 30 years
good search: allergy
21
(to be fixed) Subscribers receive 4:10 pm notification of “trending” tweet past 24 hours

More Related Content

Viewers also liked

Telegram bots
Telegram botsTelegram bots
Telegram bots
Andrii Sierkov
 
Telegram Sentences Powerpoint
Telegram Sentences PowerpointTelegram Sentences Powerpoint
Telegram Sentences Powerpoint
Lisa Durff
 
Tutorial Contoh Penggunaan API Twitter
Tutorial Contoh Penggunaan API TwitterTutorial Contoh Penggunaan API Twitter
Tutorial Contoh Penggunaan API Twitter
Aryo Luntanglantung
 
Ebook I - membuat bot telegram dengan php
Ebook I  - membuat bot telegram dengan phpEbook I  - membuat bot telegram dengan php
Ebook I - membuat bot telegram dengan php
Hasanudin H Syafaat
 
Telegram - восходящий тренд Вебинар WebPromoExperts #312
Telegram - восходящий тренд Вебинар WebPromoExperts #312Telegram - восходящий тренд Вебинар WebPromoExperts #312
Telegram - восходящий тренд Вебинар WebPromoExperts #312
Академия интернет-маркетинга «WebPromoExperts»
 
Designing the Conversation [SmashingConf 2016]
Designing the Conversation [SmashingConf 2016]Designing the Conversation [SmashingConf 2016]
Designing the Conversation [SmashingConf 2016]
Aaron Gustafson
 
Python - Telegram
Python - TelegramPython - Telegram
Python - Telegram
Widoyo PH
 
101 Conversational User Interfaces
101 Conversational User Interfaces 101 Conversational User Interfaces
101 Conversational User Interfaces
Redweb Ltd
 
Telegram
TelegramTelegram
Telegram
sanoofarmuhseen
 
Chat Bots, ChatOps and the Conversational User Interface (CUI)
Chat Bots, ChatOps and the Conversational User Interface (CUI)Chat Bots, ChatOps and the Conversational User Interface (CUI)
Chat Bots, ChatOps and the Conversational User Interface (CUI)
Richard Slater
 
Converations on conversational Ux
Converations on conversational UxConverations on conversational Ux
Converations on conversational Ux
Titash Neogi
 
Conversational interfaces - beyond the hype
Conversational interfaces - beyond the hypeConversational interfaces - beyond the hype
Conversational interfaces - beyond the hype
Matthieu Varagnat
 
AI and Python: Developing a Conversational Interface using Python
AI and Python: Developing a Conversational Interface using PythonAI and Python: Developing a Conversational Interface using Python
AI and Python: Developing a Conversational Interface using Python
amyiris
 
Bots are the New Apps: Building with the Bot Framework & Language Understanding
Bots are the New Apps: Building with the Bot Framework & Language UnderstandingBots are the New Apps: Building with the Bot Framework & Language Understanding
Bots are the New Apps: Building with the Bot Framework & Language Understanding
Nick Landry
 
Chatbots, Conversational Interfaces, and the Rise of Messaging platforms
Chatbots, Conversational Interfaces, and the Rise of Messaging platformsChatbots, Conversational Interfaces, and the Rise of Messaging platforms
Chatbots, Conversational Interfaces, and the Rise of Messaging platforms
Sean Johnson
 
Designing for conversation
Designing for conversationDesigning for conversation
Designing for conversation
yiibu
 
An Introduction To Chat Bots
An Introduction To Chat BotsAn Introduction To Chat Bots
An Introduction To Chat Bots
Sohan Maheshwar
 
chatbot and messenger as a platform
chatbot and messenger as a platformchatbot and messenger as a platform
chatbot and messenger as a platform
Daisuke Minamide
 
Why Social Media Chat Bots Are the Future of Communication - Deck
Why Social Media Chat Bots Are the Future of Communication - DeckWhy Social Media Chat Bots Are the Future of Communication - Deck
Why Social Media Chat Bots Are the Future of Communication - Deck
Jan Rezab
 
Introduction to Chatbots
Introduction to ChatbotsIntroduction to Chatbots
Introduction to Chatbots
Daden Limited
 

Viewers also liked (20)

Telegram bots
Telegram botsTelegram bots
Telegram bots
 
Telegram Sentences Powerpoint
Telegram Sentences PowerpointTelegram Sentences Powerpoint
Telegram Sentences Powerpoint
 
Tutorial Contoh Penggunaan API Twitter
Tutorial Contoh Penggunaan API TwitterTutorial Contoh Penggunaan API Twitter
Tutorial Contoh Penggunaan API Twitter
 
Ebook I - membuat bot telegram dengan php
Ebook I  - membuat bot telegram dengan phpEbook I  - membuat bot telegram dengan php
Ebook I - membuat bot telegram dengan php
 
Telegram - восходящий тренд Вебинар WebPromoExperts #312
Telegram - восходящий тренд Вебинар WebPromoExperts #312Telegram - восходящий тренд Вебинар WebPromoExperts #312
Telegram - восходящий тренд Вебинар WebPromoExperts #312
 
Designing the Conversation [SmashingConf 2016]
Designing the Conversation [SmashingConf 2016]Designing the Conversation [SmashingConf 2016]
Designing the Conversation [SmashingConf 2016]
 
Python - Telegram
Python - TelegramPython - Telegram
Python - Telegram
 
101 Conversational User Interfaces
101 Conversational User Interfaces 101 Conversational User Interfaces
101 Conversational User Interfaces
 
Telegram
TelegramTelegram
Telegram
 
Chat Bots, ChatOps and the Conversational User Interface (CUI)
Chat Bots, ChatOps and the Conversational User Interface (CUI)Chat Bots, ChatOps and the Conversational User Interface (CUI)
Chat Bots, ChatOps and the Conversational User Interface (CUI)
 
Converations on conversational Ux
Converations on conversational UxConverations on conversational Ux
Converations on conversational Ux
 
Conversational interfaces - beyond the hype
Conversational interfaces - beyond the hypeConversational interfaces - beyond the hype
Conversational interfaces - beyond the hype
 
AI and Python: Developing a Conversational Interface using Python
AI and Python: Developing a Conversational Interface using PythonAI and Python: Developing a Conversational Interface using Python
AI and Python: Developing a Conversational Interface using Python
 
Bots are the New Apps: Building with the Bot Framework & Language Understanding
Bots are the New Apps: Building with the Bot Framework & Language UnderstandingBots are the New Apps: Building with the Bot Framework & Language Understanding
Bots are the New Apps: Building with the Bot Framework & Language Understanding
 
Chatbots, Conversational Interfaces, and the Rise of Messaging platforms
Chatbots, Conversational Interfaces, and the Rise of Messaging platformsChatbots, Conversational Interfaces, and the Rise of Messaging platforms
Chatbots, Conversational Interfaces, and the Rise of Messaging platforms
 
Designing for conversation
Designing for conversationDesigning for conversation
Designing for conversation
 
An Introduction To Chat Bots
An Introduction To Chat BotsAn Introduction To Chat Bots
An Introduction To Chat Bots
 
chatbot and messenger as a platform
chatbot and messenger as a platformchatbot and messenger as a platform
chatbot and messenger as a platform
 
Why Social Media Chat Bots Are the Future of Communication - Deck
Why Social Media Chat Bots Are the Future of Communication - DeckWhy Social Media Chat Bots Are the Future of Communication - Deck
Why Social Media Chat Bots Are the Future of Communication - Deck
 
Introduction to Chatbots
Introduction to ChatbotsIntroduction to Chatbots
Introduction to Chatbots
 

Similar to Integrating Telegram Bots with Ruby on Rails

Websocket 101 in Python
Websocket 101 in PythonWebsocket 101 in Python
Websocket 101 in Python
Juti Noppornpitak
 
A Botnet Detecting Infrastructure Using a Beneficial Botnet
A Botnet Detecting Infrastructure Using a Beneficial BotnetA Botnet Detecting Infrastructure Using a Beneficial Botnet
A Botnet Detecting Infrastructure Using a Beneficial Botnet
Takashi Yamanoue
 
What is NOSTR? - Meetup#8 - 2023-01-12
What is NOSTR? - Meetup#8 - 2023-01-12What is NOSTR? - Meetup#8 - 2023-01-12
What is NOSTR? - Meetup#8 - 2023-01-12
RoundRockBitcoiners
 
Let's Get Real (time): Server-Sent Events, WebSockets and WebRTC for the soul
Let's Get Real (time): Server-Sent Events, WebSockets and WebRTC for the soulLet's Get Real (time): Server-Sent Events, WebSockets and WebRTC for the soul
Let's Get Real (time): Server-Sent Events, WebSockets and WebRTC for the soul
Swanand Pagnis
 
Dylan Butler & Oliver Hager - Building a cross platform cryptocurrency app
Dylan Butler & Oliver Hager - Building a cross platform cryptocurrency appDylan Butler & Oliver Hager - Building a cross platform cryptocurrency app
Dylan Butler & Oliver Hager - Building a cross platform cryptocurrency app
DevCamp Campinas
 
Building a Slack Bot Workshop @ Nearsoft OctoberTalks 2017
Building a Slack Bot Workshop @ Nearsoft OctoberTalks 2017Building a Slack Bot Workshop @ Nearsoft OctoberTalks 2017
Building a Slack Bot Workshop @ Nearsoft OctoberTalks 2017
Rafael Antonio Gutiérrez Turullols
 
Lab3code.c#include stdio.h#include stdlib.h#include.docx
Lab3code.c#include stdio.h#include stdlib.h#include.docxLab3code.c#include stdio.h#include stdlib.h#include.docx
Lab3code.c#include stdio.h#include stdlib.h#include.docx
smile790243
 
Machine Problem 1: Let's chat
Machine Problem 1: Let's chatMachine Problem 1: Let's chat
Machine Problem 1: Let's chat
butest
 
Botnets
BotnetsBotnets
Google Wave 20/20: Product, Protocol, Platform
Google Wave 20/20: Product, Protocol, PlatformGoogle Wave 20/20: Product, Protocol, Platform
Google Wave 20/20: Product, Protocol, Platform
Pamela Fox
 
Telegram bots
Telegram botsTelegram bots
Telegram bots
Bohdan Pashkovskyi
 
GNUCITIZEN Pdp Owasp Day September 2007
GNUCITIZEN Pdp Owasp Day   September 2007GNUCITIZEN Pdp Owasp Day   September 2007
GNUCITIZEN Pdp Owasp Day September 2007
guest20ab09
 
Building Enterprise Chat Bots
Building Enterprise Chat BotsBuilding Enterprise Chat Bots
Building Enterprise Chat Bots
Vasu Jain
 
ONLINE FOOD ORDERS THROUGH WHATSAPP AUTOMATION BOT
ONLINE FOOD ORDERS THROUGH WHATSAPP AUTOMATION BOTONLINE FOOD ORDERS THROUGH WHATSAPP AUTOMATION BOT
ONLINE FOOD ORDERS THROUGH WHATSAPP AUTOMATION BOT
IRJET Journal
 
[TechWorldSummit Stockholm 2019] Building Bots for Human with Conversational ...
[TechWorldSummit Stockholm 2019] Building Bots for Human with Conversational ...[TechWorldSummit Stockholm 2019] Building Bots for Human with Conversational ...
[TechWorldSummit Stockholm 2019] Building Bots for Human with Conversational ...
Tomomi Imura
 
Encode Club Hackathon
Encode Club Hackathon  Encode Club Hackathon
Encode Club Hackathon
Vanessa Lošić
 
Chat bots101 - practical insights on the business of bots
Chat bots101 - practical insights on the business of botsChat bots101 - practical insights on the business of bots
Chat bots101 - practical insights on the business of bots
BAM
 
Chat bots101 - practical insights on the business of bots
Chat bots101 - practical insights on the business of botsChat bots101 - practical insights on the business of bots
Chat bots101 - practical insights on the business of bots
Roy Murphy
 
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)
André Fucs de Miranda
 
Paper Presentation - "Your Botnet is my Botnet : Analysis of a Botnet Takeover"
Paper Presentation - "Your Botnet is my Botnet : Analysis of a Botnet Takeover"Paper Presentation - "Your Botnet is my Botnet : Analysis of a Botnet Takeover"
Paper Presentation - "Your Botnet is my Botnet : Analysis of a Botnet Takeover"
Jishnu Pradeep
 

Similar to Integrating Telegram Bots with Ruby on Rails (20)

Websocket 101 in Python
Websocket 101 in PythonWebsocket 101 in Python
Websocket 101 in Python
 
A Botnet Detecting Infrastructure Using a Beneficial Botnet
A Botnet Detecting Infrastructure Using a Beneficial BotnetA Botnet Detecting Infrastructure Using a Beneficial Botnet
A Botnet Detecting Infrastructure Using a Beneficial Botnet
 
What is NOSTR? - Meetup#8 - 2023-01-12
What is NOSTR? - Meetup#8 - 2023-01-12What is NOSTR? - Meetup#8 - 2023-01-12
What is NOSTR? - Meetup#8 - 2023-01-12
 
Let's Get Real (time): Server-Sent Events, WebSockets and WebRTC for the soul
Let's Get Real (time): Server-Sent Events, WebSockets and WebRTC for the soulLet's Get Real (time): Server-Sent Events, WebSockets and WebRTC for the soul
Let's Get Real (time): Server-Sent Events, WebSockets and WebRTC for the soul
 
Dylan Butler & Oliver Hager - Building a cross platform cryptocurrency app
Dylan Butler & Oliver Hager - Building a cross platform cryptocurrency appDylan Butler & Oliver Hager - Building a cross platform cryptocurrency app
Dylan Butler & Oliver Hager - Building a cross platform cryptocurrency app
 
Building a Slack Bot Workshop @ Nearsoft OctoberTalks 2017
Building a Slack Bot Workshop @ Nearsoft OctoberTalks 2017Building a Slack Bot Workshop @ Nearsoft OctoberTalks 2017
Building a Slack Bot Workshop @ Nearsoft OctoberTalks 2017
 
Lab3code.c#include stdio.h#include stdlib.h#include.docx
Lab3code.c#include stdio.h#include stdlib.h#include.docxLab3code.c#include stdio.h#include stdlib.h#include.docx
Lab3code.c#include stdio.h#include stdlib.h#include.docx
 
Machine Problem 1: Let's chat
Machine Problem 1: Let's chatMachine Problem 1: Let's chat
Machine Problem 1: Let's chat
 
Botnets
BotnetsBotnets
Botnets
 
Google Wave 20/20: Product, Protocol, Platform
Google Wave 20/20: Product, Protocol, PlatformGoogle Wave 20/20: Product, Protocol, Platform
Google Wave 20/20: Product, Protocol, Platform
 
Telegram bots
Telegram botsTelegram bots
Telegram bots
 
GNUCITIZEN Pdp Owasp Day September 2007
GNUCITIZEN Pdp Owasp Day   September 2007GNUCITIZEN Pdp Owasp Day   September 2007
GNUCITIZEN Pdp Owasp Day September 2007
 
Building Enterprise Chat Bots
Building Enterprise Chat BotsBuilding Enterprise Chat Bots
Building Enterprise Chat Bots
 
ONLINE FOOD ORDERS THROUGH WHATSAPP AUTOMATION BOT
ONLINE FOOD ORDERS THROUGH WHATSAPP AUTOMATION BOTONLINE FOOD ORDERS THROUGH WHATSAPP AUTOMATION BOT
ONLINE FOOD ORDERS THROUGH WHATSAPP AUTOMATION BOT
 
[TechWorldSummit Stockholm 2019] Building Bots for Human with Conversational ...
[TechWorldSummit Stockholm 2019] Building Bots for Human with Conversational ...[TechWorldSummit Stockholm 2019] Building Bots for Human with Conversational ...
[TechWorldSummit Stockholm 2019] Building Bots for Human with Conversational ...
 
Encode Club Hackathon
Encode Club Hackathon  Encode Club Hackathon
Encode Club Hackathon
 
Chat bots101 - practical insights on the business of bots
Chat bots101 - practical insights on the business of botsChat bots101 - practical insights on the business of bots
Chat bots101 - practical insights on the business of bots
 
Chat bots101 - practical insights on the business of bots
Chat bots101 - practical insights on the business of botsChat bots101 - practical insights on the business of bots
Chat bots101 - practical insights on the business of bots
 
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)
 
Paper Presentation - "Your Botnet is my Botnet : Analysis of a Botnet Takeover"
Paper Presentation - "Your Botnet is my Botnet : Analysis of a Botnet Takeover"Paper Presentation - "Your Botnet is my Botnet : Analysis of a Botnet Takeover"
Paper Presentation - "Your Botnet is my Botnet : Analysis of a Botnet Takeover"
 

Recently uploaded

AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
Google
 
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
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
brainerhub1
 
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
 
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
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
Remote DBA Services
 
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
 
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
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
Peter Muessig
 
What is Master Data Management by PiLog Group
What is Master Data Management by PiLog GroupWhat is Master Data Management by PiLog Group
What is Master Data Management by PiLog Group
aymanquadri279
 
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
 
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
 
How to write a program in any programming language
How to write a program in any programming languageHow to write a program in any programming language
How to write a program in any programming language
Rakesh Kumar R
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptxLORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
lorraineandreiamcidl
 
SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024
Hironori Washizaki
 
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
 
What is Augmented Reality Image Tracking
What is Augmented Reality Image TrackingWhat is Augmented Reality Image Tracking
What is Augmented Reality Image Tracking
pavan998932
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Łukasz Chruściel
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
TheSMSPoint
 

Recently uploaded (20)

AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
 
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
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.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
 
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
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
 
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
 
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
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
 
What is Master Data Management by PiLog Group
What is Master Data Management by PiLog GroupWhat is Master Data Management by PiLog Group
What is Master Data Management by PiLog Group
 
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
 
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
 
How to write a program in any programming language
How to write a program in any programming languageHow to write a program in any programming language
How to write a program in any programming language
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptxLORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
 
SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024
 
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
 
What is Augmented Reality Image Tracking
What is Augmented Reality Image TrackingWhat is Augmented Reality Image Tracking
What is Augmented Reality Image Tracking
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
 

Integrating Telegram Bots with Ruby on Rails

  • 1. Integrating Telegram Bots with Rails Chris Downey cdowney@protonmail.com Please install Telegram on your phone or laptop for hands-on experience during the presentation https://telegram.org/ it will also be more interesting when we get into managing subscriptions 1
  • 2. Create a DCRug Telegram bot Bots are third-party apps that run inside Telegram. Our Rails app controls the bot, providing the content, managing subscribers, interactions, and broadcasts. Our bot will send DCRug event listings 2
  • 3. Create a DCRug Telegram bot Start by using a bot to create your bot 3
  • 4. Now that DCRug bot is created, how do we communicate with it? 4
  • 5. With bots, we can have 2 types of communication: 1. Subscriber initiated 2. Bot (Rails app) initiated 5
  • 7. Bot (Rails app) initiated communication 7
  • 8. Capture real-time Telegram bot events Just for fun: first article on web hooks (may have coined term): http://progrium.com/blog/2007/05/03/web-hooks-to-revolutionize-the-web/ 8
  • 9. We will setup DCRug bot with a webhook, and use ngrok to create a secure tunnel to my dev machine and to inspect the webhook payload 9
  • 10. 10
  • 11. Setup dev machine to accept webhooks from Telegram with ngrok 11
  • 12. If you have Telegram installed, please subscribe Via browser: http://telegram.me/DCRug_bot Via Telegram: go into “Chats” and search for DCRug (please call out if this isn’t working for you) secret command /count provides number of subscribers 12
  • 13. What just happened? Our bot (Rails app!): • intercepted a webhook • extracted the bot command • created a subscriber in the database • sent a response to the new subscriber 13
  • 15. Extract bot command from webhook payload 15
  • 16. Create a subscriber in the database 16
  • 17. Send response to the new subscriber use telegram-bot-ruby gem to wrap and simplify Telegram API 17
  • 18. 18 Pop Quiz! how can we broadcast DCRug events, right now, to all active subscribers?
  • 19. Broadcast DCRug events to all subscribers 19
  • 20. The End Questions, comments, thoughts? 20 (See me after the meeting for an example of another very different bot if interested, it enables searches across 2 websites and a database of tweets going back 6 years)
  • 21. A bot serving a small educational non-profit https://telegram.me/VaxCalc_bot Searches a database of more than 1,100 “foundational knowledge” tweets produced since 2010 Combines results with custom Google search of 2 content-heavy websites with articles going back 30 years good search: allergy 21 (to be fixed) Subscribers receive 4:10 pm notification of “trending” tweet past 24 hours