SlideShare ist ein Scribd-Unternehmen logo
1 von 17
Python - Telegram
Widoyo
<widoyo@gmail.com>
KopDar Python-ID Jogja
4 Februari 2017
DISCLAIMER, Sangkalan
Saya BUKAN Python Expert, Peneliti Ilmu Komputer
Hanya Sebagian SANGAT kecil dan lapisan atas dari Fasilitas pada Telegram
yang dipakai / terangkan
Widoyo, saya
1. Superman IT di tempat kerja
2. 13,5 tahun Pegawai Negeri, 12,5 tahun pengangguran
3. Lebih fokus aplikasi Web
4. Menggunakan Python sejak ~2008, mulai ngelirik sejak ~2005, boca-baca
Zope tidak ngerti, sebelumnya PHP
5. Django 0.98 - 1.3.x
6. Webpy 0.36 - 0.37
Python
1. Semakin Sedikit Code kita tulis, Semakin sedikit pula potensi Salah/Error
2. Enak ditulis, Enak dibaca, Lebih Produktif
3. Dari Mainan hingga Serius
4. Bisa jalan dimana-mana
Komputer
Smartphone (Android, SL4A)
Microcontroller
5. Tidak banyak dikenal Anak Lokal
ESP8266 - 01, berisi MicroPython 1.8.5
Telegram
1. A new era of messaging
2. Telegram is a messaging app with a focus on speed and security, it’s super-
fast, simple and free.
3. Programming
a. Bot API
b. Telegram API
c. Protokol MTProto
Masalah
1. Atasan ingin mendapatkan informasi Curah Hujan beberapa lokasi melalui
WhatsApp
Pencarian Solusi
1. Google “Python Whatsapp” ketemu tgalal/Yowsup, sekali coba banned
2. WhatsApp tidak mengijinkan
3. Telegram - Python-telegram-bot
4. PLUS Manual Copy(Telegram)-Paste(WhatsApp) pada Smartphone
5. Atasan HAPPY
Telegram Bot
1. Akun khusus yang tidak perlu nomor telepon
2. Selanjutnya kita dapat membuat program (program bot) yang
memanfaatkan Telegram Message sebagai interface
3. Untuk ingin tahu tentang (salah satunya) membuat akun Telegram Bot, sila
kirim /start ke @BotFather
4. Lebih lanjut ada di https://core.telegram.org/bots
Program Bot
1. Dapat berjalan pada komputer kita, asal terdapat sambungan ke Server
Telegram
2. Kita program untuk menerima perintah - selanjutnya melakukan misalnya
a. Akses Database
b. Integrasi dengan layanan lain
@GudegBot
(fiktif)
Command
1./start
Menampilkan bantuan/cara penggunaan
2./terdekat
Menampilkan daftar penjual gudeg terdekat dengan pengguna
3./favorit
Menampilkan daftar penjual gudeg yang mendapatkan feedback positif
Python Telegram Bot
http://python-telegram-bot.readthedocs.io/en/latest/
gudegbot.py
…
def main():
updater = Updater(token=GUDEGBOT_TOKEN)
dp = updater.dispatcher
start_handler = CommandHandler('start', start)
terdekat_handler = CommandHandler('terdekat', terdekat)...
dp.add_handler(start_handler)
dp.add_handler(latest_handler)...
updater.start_polling()
updater.idle()
if __name__ == '__main__':
main()
gudegbot.py
def start(bot, update):
‘’’Return message about how to use’’’
pass
def terdekat(bot, update):
‘’’Return message list of gudeg terdekat’’’
pass
def favorit(bot, update):
‘’’Return message list of gudeg recommended’’’
pass
Cara Mendapatkan Update
Updater
1. Program kita melakukan polling ke Server
Telegram secara periodik
2. Dapat dijalankan pada komputer yang
tidak visible di Internet
Web Hook
1. Server Telegram akan PUSH ke web
server kita
2. Harus memiliki domain/IP address yang
aksesible oleh Server Telegram
Penutup
1. Jaga tetap Open Mind
2. Tetap Belajar
3. Tetap Produktif

Weitere ähnliche Inhalte

Andere mochten auch

Unit Testing
Unit TestingUnit Testing
Unit TestingDotitude
 
Easy Web Project Development & Management with Django & Mercurial
Easy Web Project Development & Management with Django & MercurialEasy Web Project Development & Management with Django & Mercurial
Easy Web Project Development & Management with Django & MercurialWidoyo PH
 
Buku kecil coffee script
Buku kecil coffee scriptBuku kecil coffee script
Buku kecil coffee scriptWidoyo PH
 
Masih m bajak software
Masih m bajak software  Masih m bajak software
Masih m bajak software Widoyo PH
 
Software Project Management
Software Project ManagementSoftware Project Management
Software Project ManagementWidoyo PH
 
Integrating Telegram Bots with Ruby on Rails
Integrating Telegram Bots with Ruby on RailsIntegrating Telegram Bots with Ruby on Rails
Integrating Telegram Bots with Ruby on RailsChris Downey
 
Designing the Conversation [SmashingConf 2016]
Designing the Conversation [SmashingConf 2016]Designing the Conversation [SmashingConf 2016]
Designing the Conversation [SmashingConf 2016]Aaron Gustafson
 
Realtime communication in mobile
Realtime communication in mobileRealtime communication in mobile
Realtime communication in mobilegirish_fingent
 
How Computer Vision is Reshaping Real Estate Search - Andrew Flachner
How Computer Vision is Reshaping Real Estate Search - Andrew FlachnerHow Computer Vision is Reshaping Real Estate Search - Andrew Flachner
How Computer Vision is Reshaping Real Estate Search - Andrew FlachnerInman News
 
101 Conversational User Interfaces
101 Conversational User Interfaces 101 Conversational User Interfaces
101 Conversational User Interfaces Redweb Ltd
 
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 UxTitash Neogi
 
Conversational interfaces - beyond the hype
Conversational interfaces - beyond the hypeConversational interfaces - beyond the hype
Conversational interfaces - beyond the hypeMatthieu 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 Pythonamyiris
 
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 UnderstandingNick 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 platformsSean Johnson
 
Adobe Presents Internal Service Delivery Platform at Velocity 13 Santa Clara
Adobe Presents Internal Service Delivery Platform at Velocity 13 Santa ClaraAdobe Presents Internal Service Delivery Platform at Velocity 13 Santa Clara
Adobe Presents Internal Service Delivery Platform at Velocity 13 Santa Claradev2ops
 

Andere mochten auch (20)

Unit Testing
Unit TestingUnit Testing
Unit Testing
 
Easy Web Project Development & Management with Django & Mercurial
Easy Web Project Development & Management with Django & MercurialEasy Web Project Development & Management with Django & Mercurial
Easy Web Project Development & Management with Django & Mercurial
 
Buku kecil coffee script
Buku kecil coffee scriptBuku kecil coffee script
Buku kecil coffee script
 
Masih m bajak software
Masih m bajak software  Masih m bajak software
Masih m bajak software
 
Software Project Management
Software Project ManagementSoftware Project Management
Software Project Management
 
Integrating Telegram Bots with Ruby on Rails
Integrating Telegram Bots with Ruby on RailsIntegrating Telegram Bots with Ruby on Rails
Integrating Telegram Bots with Ruby on Rails
 
Telegram - восходящий тренд Вебинар WebPromoExperts #312
Telegram - восходящий тренд Вебинар WebPromoExperts #312Telegram - восходящий тренд Вебинар WebPromoExperts #312
Telegram - восходящий тренд Вебинар WebPromoExperts #312
 
Telegram bots
Telegram botsTelegram bots
Telegram bots
 
Designing the Conversation [SmashingConf 2016]
Designing the Conversation [SmashingConf 2016]Designing the Conversation [SmashingConf 2016]
Designing the Conversation [SmashingConf 2016]
 
Realtime communication in mobile
Realtime communication in mobileRealtime communication in mobile
Realtime communication in mobile
 
How Computer Vision is Reshaping Real Estate Search - Andrew Flachner
How Computer Vision is Reshaping Real Estate Search - Andrew FlachnerHow Computer Vision is Reshaping Real Estate Search - Andrew Flachner
How Computer Vision is Reshaping Real Estate Search - Andrew Flachner
 
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
 
Adobe Presents Internal Service Delivery Platform at Velocity 13 Santa Clara
Adobe Presents Internal Service Delivery Platform at Velocity 13 Santa ClaraAdobe Presents Internal Service Delivery Platform at Velocity 13 Santa Clara
Adobe Presents Internal Service Delivery Platform at Velocity 13 Santa Clara
 

Ähnlich wie Python - Telegram

FIC - Flutter Basic.pdf
FIC - Flutter Basic.pdfFIC - Flutter Basic.pdf
FIC - Flutter Basic.pdfherminsusilo2
 
Chatbot With Dialogflow
Chatbot With DialogflowChatbot With Dialogflow
Chatbot With DialogflowYatno Sudar
 
materi Bot Telegram dengan google apps script dan spreadsheet
materi Bot Telegram dengan google apps script dan spreadsheetmateri Bot Telegram dengan google apps script dan spreadsheet
materi Bot Telegram dengan google apps script dan spreadsheetHilmanudinAji
 
Laporan praktikum modul 5
Laporan praktikum modul 5Laporan praktikum modul 5
Laporan praktikum modul 5321416028
 
Laporan praktikum modul 5
Laporan praktikum modul 5 Laporan praktikum modul 5
Laporan praktikum modul 5 Hardini_HD
 
Mikrotik tutorial dude
Mikrotik tutorial dudeMikrotik tutorial dude
Mikrotik tutorial dudeDenny Hotspot
 
Laporan praktikum-modul-5
Laporan praktikum-modul-5 Laporan praktikum-modul-5
Laporan praktikum-modul-5 haryati_rya
 
Laporan praktikum-modul-5
Laporan praktikum-modul-5 Laporan praktikum-modul-5
Laporan praktikum-modul-5 haryati_rya
 
Seri 5 : Mengaktifkan dan menggunakan emulator Pada App Inventor
Seri 5 : Mengaktifkan dan menggunakan emulator Pada App InventorSeri 5 : Mengaktifkan dan menggunakan emulator Pada App Inventor
Seri 5 : Mengaktifkan dan menggunakan emulator Pada App InventorIki Mazadi
 
Study Jam Mobile 4 - Introduction to Flutter.pdf
Study Jam Mobile 4 - Introduction to Flutter.pdfStudy Jam Mobile 4 - Introduction to Flutter.pdf
Study Jam Mobile 4 - Introduction to Flutter.pdfanjarmath
 
Part-1 (python).pptx
Part-1 (python).pptxPart-1 (python).pptx
Part-1 (python).pptxummi1206
 
Pretty Good Privacy
Pretty Good PrivacyPretty Good Privacy
Pretty Good PrivacyAlex Adipati
 
1. pengenalan python
1. pengenalan python1. pengenalan python
1. pengenalan pythonirwansyah122
 
Laporan Praktikum Modul 5 (internet)
Laporan Praktikum Modul 5 (internet)Laporan Praktikum Modul 5 (internet)
Laporan Praktikum Modul 5 (internet)Faisal Amir
 

Ähnlich wie Python - Telegram (20)

Ini dia 4 cara login mikrotik selain winbox
Ini dia 4 cara login mikrotik selain winboxIni dia 4 cara login mikrotik selain winbox
Ini dia 4 cara login mikrotik selain winbox
 
Internet sehat
Internet sehatInternet sehat
Internet sehat
 
FIC - Flutter Basic.pdf
FIC - Flutter Basic.pdfFIC - Flutter Basic.pdf
FIC - Flutter Basic.pdf
 
Jurnal AGY
Jurnal AGYJurnal AGY
Jurnal AGY
 
Laporan praktikum modul 5
Laporan praktikum modul 5Laporan praktikum modul 5
Laporan praktikum modul 5
 
Chatbot With Dialogflow
Chatbot With DialogflowChatbot With Dialogflow
Chatbot With Dialogflow
 
materi Bot Telegram dengan google apps script dan spreadsheet
materi Bot Telegram dengan google apps script dan spreadsheetmateri Bot Telegram dengan google apps script dan spreadsheet
materi Bot Telegram dengan google apps script dan spreadsheet
 
Laporan praktikum modul 5
Laporan praktikum modul 5Laporan praktikum modul 5
Laporan praktikum modul 5
 
Laporan praktikum modul 5
Laporan praktikum modul 5 Laporan praktikum modul 5
Laporan praktikum modul 5
 
Mikrotik tutorial dude
Mikrotik tutorial dudeMikrotik tutorial dude
Mikrotik tutorial dude
 
Laporan praktikum-modul-5
Laporan praktikum-modul-5 Laporan praktikum-modul-5
Laporan praktikum-modul-5
 
Laporan praktikum-modul-5
Laporan praktikum-modul-5 Laporan praktikum-modul-5
Laporan praktikum-modul-5
 
Seri 5 : Mengaktifkan dan menggunakan emulator Pada App Inventor
Seri 5 : Mengaktifkan dan menggunakan emulator Pada App InventorSeri 5 : Mengaktifkan dan menggunakan emulator Pada App Inventor
Seri 5 : Mengaktifkan dan menggunakan emulator Pada App Inventor
 
Pertemuan 5
Pertemuan 5Pertemuan 5
Pertemuan 5
 
Road to PythonTeX
Road to PythonTeX Road to PythonTeX
Road to PythonTeX
 
Study Jam Mobile 4 - Introduction to Flutter.pdf
Study Jam Mobile 4 - Introduction to Flutter.pdfStudy Jam Mobile 4 - Introduction to Flutter.pdf
Study Jam Mobile 4 - Introduction to Flutter.pdf
 
Part-1 (python).pptx
Part-1 (python).pptxPart-1 (python).pptx
Part-1 (python).pptx
 
Pretty Good Privacy
Pretty Good PrivacyPretty Good Privacy
Pretty Good Privacy
 
1. pengenalan python
1. pengenalan python1. pengenalan python
1. pengenalan python
 
Laporan Praktikum Modul 5 (internet)
Laporan Praktikum Modul 5 (internet)Laporan Praktikum Modul 5 (internet)
Laporan Praktikum Modul 5 (internet)
 

Python - Telegram

  • 1. Python - Telegram Widoyo <widoyo@gmail.com> KopDar Python-ID Jogja 4 Februari 2017
  • 2. DISCLAIMER, Sangkalan Saya BUKAN Python Expert, Peneliti Ilmu Komputer Hanya Sebagian SANGAT kecil dan lapisan atas dari Fasilitas pada Telegram yang dipakai / terangkan
  • 3. Widoyo, saya 1. Superman IT di tempat kerja 2. 13,5 tahun Pegawai Negeri, 12,5 tahun pengangguran 3. Lebih fokus aplikasi Web 4. Menggunakan Python sejak ~2008, mulai ngelirik sejak ~2005, boca-baca Zope tidak ngerti, sebelumnya PHP 5. Django 0.98 - 1.3.x 6. Webpy 0.36 - 0.37
  • 4. Python 1. Semakin Sedikit Code kita tulis, Semakin sedikit pula potensi Salah/Error 2. Enak ditulis, Enak dibaca, Lebih Produktif 3. Dari Mainan hingga Serius 4. Bisa jalan dimana-mana Komputer Smartphone (Android, SL4A) Microcontroller 5. Tidak banyak dikenal Anak Lokal
  • 5. ESP8266 - 01, berisi MicroPython 1.8.5
  • 6. Telegram 1. A new era of messaging 2. Telegram is a messaging app with a focus on speed and security, it’s super- fast, simple and free. 3. Programming a. Bot API b. Telegram API c. Protokol MTProto
  • 7. Masalah 1. Atasan ingin mendapatkan informasi Curah Hujan beberapa lokasi melalui WhatsApp
  • 8. Pencarian Solusi 1. Google “Python Whatsapp” ketemu tgalal/Yowsup, sekali coba banned 2. WhatsApp tidak mengijinkan 3. Telegram - Python-telegram-bot 4. PLUS Manual Copy(Telegram)-Paste(WhatsApp) pada Smartphone 5. Atasan HAPPY
  • 9. Telegram Bot 1. Akun khusus yang tidak perlu nomor telepon 2. Selanjutnya kita dapat membuat program (program bot) yang memanfaatkan Telegram Message sebagai interface 3. Untuk ingin tahu tentang (salah satunya) membuat akun Telegram Bot, sila kirim /start ke @BotFather 4. Lebih lanjut ada di https://core.telegram.org/bots
  • 10. Program Bot 1. Dapat berjalan pada komputer kita, asal terdapat sambungan ke Server Telegram 2. Kita program untuk menerima perintah - selanjutnya melakukan misalnya a. Akses Database b. Integrasi dengan layanan lain
  • 12. Command 1./start Menampilkan bantuan/cara penggunaan 2./terdekat Menampilkan daftar penjual gudeg terdekat dengan pengguna 3./favorit Menampilkan daftar penjual gudeg yang mendapatkan feedback positif
  • 14. gudegbot.py … def main(): updater = Updater(token=GUDEGBOT_TOKEN) dp = updater.dispatcher start_handler = CommandHandler('start', start) terdekat_handler = CommandHandler('terdekat', terdekat)... dp.add_handler(start_handler) dp.add_handler(latest_handler)... updater.start_polling() updater.idle() if __name__ == '__main__': main()
  • 15. gudegbot.py def start(bot, update): ‘’’Return message about how to use’’’ pass def terdekat(bot, update): ‘’’Return message list of gudeg terdekat’’’ pass def favorit(bot, update): ‘’’Return message list of gudeg recommended’’’ pass
  • 16. Cara Mendapatkan Update Updater 1. Program kita melakukan polling ke Server Telegram secara periodik 2. Dapat dijalankan pada komputer yang tidak visible di Internet Web Hook 1. Server Telegram akan PUSH ke web server kita 2. Harus memiliki domain/IP address yang aksesible oleh Server Telegram
  • 17. Penutup 1. Jaga tetap Open Mind 2. Tetap Belajar 3. Tetap Produktif