This repository demonstrates how to send notifications from Google Colab to Telegram using a bot. Notifications are sent upon the completion of a cell's execution, allowing you to track the progress of your work seamlessly. Follow the steps below to get started.
- Open Telegram and search for
@BotFather
. - Start a conversation with
@BotFather
by sending/start
. - Follow the instructions to create a new bot by sending
/newbot
. - After naming your bot, you will receive an API token. Keep this token safe.
To send messages, you need your chat ID. Use the following code to get it.
Use the following function to send messages to your Telegram chat.
To integrate this with your Google Colab workflow, simply call the send_telegram_message
function at desired points in your code to send updates or notifications. Here’s an example:
# Example of a Google Colab cell where you notify the completion of a process
send_telegram_message('Training completed! Check your results.')
- Ensure your Telegram bot is active.
- Test your setup by sending a few test messages.
- Remember to handle your API token securely and do not expose it publicly.
- Python
- requests
- Telegram Bot API
This project is licensed under the MIT License - see the LICENSE file for details.
Special thanks to the Telegram Bot API documentation and the Python Requests library documentation for providing the necessary resources.
By following these steps, you'll be able to receive timely notifications from your Google Colab environment directly in your Telegram chat. Happy coding!