Diplomabot is a Go-based bot that notifies me when my university diploma is ready for pickup. It automates the process of checking my diploma status on the IGCE website and sends me a Telegram message when the diploma is issued and ready to be picked up.
The bot can be described in five parts:
-
Access the IGCE Website The bot accesses the IGCE Undergraduate Office's web page, which uses xajax for client-side rendering. It performs an http POST request that returns an XML containing the page's HTML.
-
Unmarshal XML After receiving the XML response, the bot unmarshals it to extract the HTML content from the body of the page.
-
Scraping for Diploma Link Using the HTML, the bot scrapes a link for a PDF document that lists the students names with issued diplomas.
-
Download and Read PDF The bot downloads the PDF and extract the text from the PDF using an external API.
-
Notification via Telegram If your name appears in the extracted text, the bot sends a notification message to you via Telegram, informing you that your diploma is ready for being picked up.
git clone https://github.com/vitorxfs/diplomabot
cd diplomabot
TELEGRAM_BOT_ID
: Your Telegram bot ID.TELEGRAM_CHAT_ID
: Your Telegram chat ID for receiving notifications.UTILS_TOKEN
: Token for the external API used to read PDF text.UTILS_BASE_URL
: Base URL for the external API.
go run .
go build -o ./.out/diplomabot
./.out/diplomabot
- Run
crontab -e
to open crontabs file; - Add your cron job in a new line on the file, adding your environment variables:
0 8 * * * TELEGRAM_BOT_ID=<bot_id> TELEGRAM_CHAT_ID=<chatId> UTILS_TOKEN=<utils_token> UTILS_BASE_URL=<utils_base_url> /path/to/binary/diplomabot >/path/to/logfile.txt 2>&1