{"id":24758883,"url":"https://github.com/wesleych3n/my-work-log","last_synced_at":"2025-07-20T04:36:23.691Z","repository":{"id":40491359,"uuid":"481068126","full_name":"WesleyCh3n/my-work-log","owner":"WesleyCh3n","description":"A self project to record and analyze work's check in/out time on google sheet with telegram bot.","archived":false,"fork":false,"pushed_at":"2022-11-29T06:36:08.000Z","size":32,"stargazers_count":0,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-23T10:16:52.587Z","etag":null,"topics":["data-analysis","telegram-bot","worklog"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WesleyCh3n.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-04-13T04:20:26.000Z","updated_at":"2022-05-06T02:39:33.000Z","dependencies_parsed_at":"2023-01-21T04:53:14.881Z","dependency_job_id":null,"html_url":"https://github.com/WesleyCh3n/my-work-log","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/WesleyCh3n/my-work-log","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WesleyCh3n%2Fmy-work-log","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WesleyCh3n%2Fmy-work-log/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WesleyCh3n%2Fmy-work-log/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WesleyCh3n%2Fmy-work-log/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WesleyCh3n","download_url":"https://codeload.github.com/WesleyCh3n/my-work-log/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WesleyCh3n%2Fmy-work-log/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266067465,"owners_count":23871353,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data-analysis","telegram-bot","worklog"],"created_at":"2025-01-28T16:39:40.762Z","updated_at":"2025-07-20T04:36:23.659Z","avatar_url":"https://github.com/WesleyCh3n.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# My Work Log\n\n[![Deploy](https://github.com/WesleyCh3n/work-log-py/actions/workflows/main.yml/badge.svg)](https://github.com/WesleyCh3n/work-log-py/actions/workflows/main.yml)\n\nThis is a self project to record and analyze my work's check in/out time on\ngoogle sheet with basic weather info using telegram bot.\n\n## Getting Started\n\nThe main program is a telegram (tg) bot, which receiving tg input message/cmd.\nOverview of the pipeline,\n\n```\ntg message (e.g. checkin/checkout)\n    ↳ tg bot\n        ↳ get weather api\n        ↳ insert a row to google sheet\n```\n\n### Available command\n\n- `\\checkin`: record check in time\n- `\\checkout`: record check out time\n- `\\today`: check today check in time\n- `\\draw`: get time series/correlation figure between selected time and\ntemperature.\n\n    For example:\n\n    \u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://user-images.githubusercontent.com/30611421/166861404-cf487d4c-11b1-498d-b76a-7887cf7295a2.png\" width=\"300\"/\u003e\n    \u003c/p\u003e\n\n### Prerequisites\n\nRequirements of this project\n\n- Your telegram user id. [*Tutorial*](https://www.alphr.com/telegram-find-user-id/)\n- A telegram bot token. [*Tutorial*](https://core.telegram.org/bots#6-botfather)\n- [CWB open weather data api](https://opendata.cwb.gov.tw/index) access token. [*Tutorial*](https://ithelp.ithome.com.tw/articles/10276375)\n- Google Sheet api credential and a google sheet ID. [*Tutorial*](https://www.learncodewithmike.com/2020/08/python-write-to-google-sheet.html)\n\nPlace the token in `.env` file, like\n\n```env\nTG_BOT_TOKEN=\"\u003cyour tg bot token\u003e\"\nTG_BOT_USER=\"\u003cyour telegram user id\u003e\"\nWEATHER_API_KEY=\"\u003ccwb key\u003e\"\nGOOGLE_SHEET_KEY=\"\u003cyour google sheet ID\u003e\"\n```\n\nAlso there is a `credential.json` to access google sheet api.\n\n## Running\n\n```shell\npip3 install -r requirements.txt\npython main.py\n```\n\n## Deploy on Heroku\n\nTo use github action to deploy the bot on Heroku, first create an Heroku\naccount and create an app for deployment. Setting the following in github\nsecrets.\n\n\n- `HEROKU_API_KEY`: heroku api key to automate deployment\n- `GOOGLE_API_CREDENTIAL`: content of google credential.json\n- `GOOGLE_SHEET_KEY`\n- `TG_BOT_TOKEN`\n- `TG_BOT_USER`\n- `WEATHER_API_KEY`\n\nand follow [main.yml](https://github.com/WesleyCh3n/work-log-py/tree/main/.github/workflows)\nto create an action pipeline.\n\n\u003e Remember to change [app name and email](https://github.com/WesleyCh3n/work-log-py/blob/5fb6ec69aa5ffebeb3901a39dfed275869790822/.github/workflows/main.yml#L24-L25) and [host address and timezone](https://github.com/WesleyCh3n/work-log-py/blob/5fb6ec69aa5ffebeb3901a39dfed275869790822/.github/workflows/main.yml#L31-L32) to match your setting.\n\nReference: [Deploy a Telegram Bot using Heroku](https://towardsdatascience.ggcom/how-to-deploy-a-telegram-bot-using-heroku-for-free-9436f89575d2)\n\n## Mentionable Note\n\nSend message to tg bot directly from api. So you can easily create something\nmore useful like using `ios shortcut` send msg directly.\n[*Reference*](https://core.telegram.org/bots/webhooks#testing-your-bot-with-updates)\n\nE.g.\n\n```sh\n# check in message\ncurl --tlsv1.2 -k -X POST -H \"Content-Type: application/json\" -d '{\n\"update_id\": 10000000,\n\"message\": {\n  \"message_id\": 000,\n  \"entities\": [\n    {\n      \"length\": 8,\n      \"offset\": 0,\n      \"type\": \"bot_command\"\n    }\n  ],\n  \"chat\": {\n    \"id\": \u003cyour user id\u003e,\n    \"last_name\": \"Ch3n\",\n    \"type\": \"private\",\n    \"first_name\": \"Wesley\"\n  },\n  \"date\": \u003ctimestamp\u003e,\n  \"text\": \"/checkin\",\n  \"from\": {\n    \"id\": \u003cyour user id\u003e,\n    \"first_name\": \"Wesley\",\n    \"last_name\": \"Ch3n\",\n    \"is_bot\": false,\n    \"language_code\": \"en\"\n  }\n}\n}' \"https://\u003cheroku app url\u003e/\u003cbot token\u003e\"\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwesleych3n%2Fmy-work-log","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwesleych3n%2Fmy-work-log","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwesleych3n%2Fmy-work-log/lists"}