Skip to content

get wakatime stats summerized and sent to your telegram

License

Notifications You must be signed in to change notification settings

waaeel/wakatime-telegram-bot

Repository files navigation

screenshot

📖 Usage

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

You will need the below installed on your computer

Cloning the repository

$ git clone https://github.com/waaeel/wakatime-telegram-bot.git
$ cd wakatime-telegram-bot
$ npm install

⚙️ Configuration

  1. Create a file called .env in the root directory of your project. OR Note: Instead of creating a .env file, create a replica of the env.example file provided

    $ cp env.example .env
  2. Inside the .env file, add key WAKATIME_API_KEY obtained from Wakatime Settings. One must create an account and copy the API Key.

    WAKATIME_API_KEY = "YOUR WAKATIME API TOKEN HERE";
  3. Inside the .env file, add key TELEGRAM_TOKEN and TELEGRAM_CHAT_ID obtained from Telegram Bots App. Follow the below steps:

    • Click BotFather and open in either Telegram Desktop or Mobile App(search for @BotFather)
    • After opening it, press start and type /newbot
    • Provide a name and a username for the bot. ensure it ends with bot at its end, for instance Richierich25_bot
    • It will provide a link to the newly created bot and provide the HTTP API Key or TELEGRAM_TOKEN. Open the link provided. important as the bot has to be started for it to receive messages later
    • Press start or to start chatting with the newly created bot
    • To obtain the TELEGRAM_CHAT_ID, search for the @get_id_bot account and pressstart
    • it will provide you your chat id
    TELEGRAM_TOKEN = "YOUR TELEGRAM TOKEN HERE";
    TELEGRAM_CHAT_ID = "YOUR TELEGRAM CHAT ID HERE";

🖥️ Deployment

When you are done with the setup, and have tested locally, we recommend you to deploy it using Github Actions. We highly recommend to read through the Using Github Actions docs.

  1. Inside the .github/workflows/build.yml file, set the desired time interval in CRON FORMAT after which you wish the Application to execute and push further notifications

More documention for troubleshooting CRON FORMAT

schedule:
  - cron: "20 16 * * 0" #every sunday at 4:20pm
  1. Adding API Tokens and Secrets into the repository

    • Open your repository with the application code
    • Click on Settings from the Github Menu options
    • Press Secrets from the left section
    • Press New Secret and add your tokens one by one by giving it a suitable Name and Value
    • Add WAKATIME_API_KEY, TELEGRAM_TOKEN and TELEGRAM_CHAT_ID

🛠️ Technology Used

  • NodeJS
  • Javascript

❤️ Credits

Releases

No releases published

Packages

No packages published