Amrita Ahead Canvas LMS Telegram Bot
A Canvas-integration Bot application for the Telegram messaging app.
This bot is self-hosted and runs off of your own individual Canvas API key to access your Canvas courses. Anybody in a server with the bot can use its commands, but it can only access the courses that the canvas account associated with the API key has access to.
By default, all commands will be prefixed with the /
symbol in telegram.
-
General Commands
help
- provides information on available commands and usagecourses
- provides course codes for all available courses that the bot can accessdue
- lists upcoming due dates assignments for a given course id
Announcements are a crucial way for teachers to communicate with students using Canvas LMS. This bot provides a way for users to see announcements in Telegram itself whenever they are posted, because most the communication happens there.
- Announcement Commands
sub
- to subscribes a Telegram user chat or a particular group channel for announcements from a given Canvas courseunsub
- removes user subscription to a given Canvas course id
This bot runs a job every 5 minutes to check for new announcements on the Canvas API. If it finds any, it will push this to the people that have subscribed.
If someone subscribes, it'll write this to a subscribers.csv file. This file persists between starts, so subscribers will keep being subscribed if the bot gets restarted.
The bot will both print errors both to the terminal and to a TeleBot.log file.
The bot requires the following pip packages:
python-telegram-bot==20.0a0
aiohttp
canvasapi
datetime
html2text
pandas
pytz
requests
You can install all of them using pip install -r requirements.txt
.
Since the bot can only run on an individual API Key, users can only set up a working bot for their own Canvas courses. You can create your own Telegram Bot and run it with the code in this repository, using your own API keys instead. To do this you will need to:
Type git clone https://github.com/ashwinair/ahead-bot.git
in your command line or download from the main page of the repo. Initially you need to clear the subscribers.csv files except for the first line so that you can have your own reminders rather than that of this template bot.
Here is a step-by-step tutorial to generate your Canvas API token
Refer to Telegram Documentation for this, and get your Telegram bot API Key.
4. Change the following lines in /tele/constants.py with your details
API_KEY = 'Your Telegram API KEY'
CANVAS_URL = 'Your CANVAS DOMAIN'
CANVAS_TOKEN = 'Your CANVAS TOKEN ID'