Slide 1

Slide 1 text

BUILDING A TELEGRAM BOT WITH PYTHON & FLASK @billybobza

Slide 2

Slide 2 text

Janine is using WhatsApp, she’s feeling a bit overwhelmed.. she’s part of 27 active groups. Jackie is using Telegram, she knows her data is safer and life is good… Harold is using Signal. His data is very safe but he only has 2 people to talk to… He likes to be alone, so it’s fine.

Slide 3

Slide 3 text

Bots can add great usability to customers, stakeholders and other users of your products. They save time and money, and can replace expensive call-centre solutions under the right circumstances if done correctly. Relatively cheap to set up. WHY? BECAUSE IT’S USEFUL, FUN AND EASY!

Slide 4

Slide 4 text

SOURCE: https://bit.ly/2SEJwz7

Slide 5

Slide 5 text

STEP ONE SET UP TELEGRAM, PYTHON & FLASK • Set up your new bot on the Telegram platform • Create a new account, contact a user called “BotFather” • /newbot and name your bot and bot-user • Collect your token from BotFather, you’ll need this later • Build your Bot “engine” • Setup your Python env • Do your pip’s: install flask, python-telegram-bot, requests, gunicorn

Slide 6

Slide 6 text

STEP TWO BUILD THE FLASK ENGINE • Create your (Flask) files: • app.py telebot/credentials.py telebot/__init__.py Procfile • Setup your configuration in credentials, and code your engine into app.py

Slide 7

Slide 7 text

STEP THREE SETUP AND USE HEROKU - DEPLOY! • Login or Register a Heroku account • Download and install the Heroku CLI • Download and install git (if you don’t have it) • Once that is setup, update your config and do some git: • git add • git commit -m “this will actually work” • git push heroku master

Slide 8

Slide 8 text

BOOM IT WORKED!

Slide 9

Slide 9 text

THE END WE DID THIS LAST NIGHT IN OUR LEARN TO CODE USING PYTHON WEEKLY MEETUP: CODEWARSACADEMY: HTTPS://WWW.MEETUP.COM/CODENAME_THURSDAY-PY/ EVERY THURSDAY @7PM, ON DISCORD. @billybobza