Telegram bot built using python-telegram-bot that links people with leftovers to those who need the food
See the full article explaining this project here and how it was deployed in heroku here.
- Create a Telegram bot using the command /newbot with BotFather. Get the API key of your bot.
- Create a Telegram channel.
- Download the three files in this repo: bot.py (containing your python code for the Telegram bot), requirements.txt (containing the python libraries to be installed), and Procfile (containing the command to execute the python file).
- Modify the line in the bot.py file
'TOKEN = 'YOURTELEGRAMBOTTOKEN'
to the API key of your bot, and thechat_id = 'YOURTELEGRAMCHANNEL'
to the link of your Telegram channel. - Set up the Google Maps API:
- Go to the Google Cloud Platform console
- Search for API & Services in the search bar.
- Click on the blue plus button saying ENABLE APIS AND SERVICES right below the search bar.
- Search for Geocoding API and enable it.
- Under API & Services, go to Credentials and select CREATE CREDENTIALS > API key.
- Modify the line in the bot.py file
GMAPSAPI = 'YOURGOOGLEMAPSAPITOKEN'
to your Google Maps API. - Follow the steps here to set up an account and an app on Heroku.
- You're done! Send
/start
to your bot and it should respond with the following message:
Hi! I am your posting assistant to help you advertise your leftover food to reduce food waste. To start, please type the location of the leftover food.
You can find the bot I created at @foodrescuerbot and Telegram channel at https://t.me/foodrescuers.