{"id":23462025,"url":"https://github.com/cslant/telegram-git-notifier-app","last_synced_at":"2025-04-09T12:04:46.479Z","repository":{"id":176353659,"uuid":"656960426","full_name":"cslant/telegram-git-notifier-app","owner":"cslant","description":"The PHP app to send notification from Gitlab and Github events to Telegram channels","archived":false,"fork":false,"pushed_at":"2025-02-25T10:01:15.000Z","size":1285,"stargazers_count":28,"open_issues_count":0,"forks_count":6,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-02T10:13:20.399Z","etag":null,"topics":["action-telegram-notify","bot","cslant","github-events","github-notifications","github-telegram","github-telegram-bot","gitlab-notifier","gitlab-telegram","gitlab-webhook","notification-bot","notification-telegram-github","notifications","php","telegram","telegram-bot","telegram-bots","telegram-messages","telegram-notifications","telegram-notifier"],"latest_commit_sha":null,"homepage":"https://docs.cslant.com/telegram-git-notifier","language":"PHP","has_issues":false,"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/cslant.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["tanhongit"]}},"created_at":"2023-06-22T02:35:06.000Z","updated_at":"2025-02-25T10:07:56.000Z","dependencies_parsed_at":"2023-07-18T05:31:39.380Z","dependency_job_id":"e5cb9957-f635-480b-8800-18e140d89444","html_url":"https://github.com/cslant/telegram-git-notifier-app","commit_stats":null,"previous_names":["tanhongit/telegram-bot-github-notify","lbiltech/php-telegram-git-notifier","lbiltech/telegram-git-notifier-app","cslant/telegram-git-notifier-app"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cslant%2Ftelegram-git-notifier-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cslant%2Ftelegram-git-notifier-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cslant%2Ftelegram-git-notifier-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cslant%2Ftelegram-git-notifier-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cslant","download_url":"https://codeload.github.com/cslant/telegram-git-notifier-app/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248036063,"owners_count":21037092,"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":["action-telegram-notify","bot","cslant","github-events","github-notifications","github-telegram","github-telegram-bot","gitlab-notifier","gitlab-telegram","gitlab-webhook","notification-bot","notification-telegram-github","notifications","php","telegram","telegram-bot","telegram-bots","telegram-messages","telegram-notifications","telegram-notifier"],"created_at":"2024-12-24T08:15:29.711Z","updated_at":"2025-04-09T12:04:46.458Z","avatar_url":"https://github.com/cslant.png","language":"PHP","funding_links":["https://github.com/sponsors/tanhongit"],"categories":[],"sub_categories":[],"readme":"\u003e [!WARNING]\n\u003e ## ⚠️ This Project is Deprecated – Use the New Laravel Package  \n\u003e * This project is outdated as it is built on a pure PHP source code.  \n\u003e * Instead, we highly recommend using our latest **Laravel package**, which offers:  \n\u003e   - **Better security** with built-in authentication and protection mechanisms.  \n\u003e   - **More features** for modern web development.  \n\u003e   - **Active maintenance** and community support.  \n\u003e * 👉 [Click here to explore the new **Laravel Telegram Git Notifier** package](https://github.com/cslant/laravel-telegram-git-notifier)\n\n---\n\n# Welcome to Telegram Bot GitHub/GitLab Notify 👋\n\nThis package provides the ability to integrate the Telegram messaging service and GitHub/GitLab.\nWith this package,\nyou can create a Telegram bot to receive notifications from GitHub or GitLab events\nand manage customization through messages and buttons on Telegram.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg alt=\"GitHub and GitLab notifications to telegram php\" src=\"https://github.com/cslant/telegram-git-notifier-app/assets/35853002/5da8b972-0072-4f7e-ba4b-a341898bb959\" /\u003e\n\u003c/p\u003e\n\n![License](https://img.shields.io/github/license/cslant/telegram-git-notifier-app.svg?style=flat-square)\n[![Latest Version](https://img.shields.io/github/release/cslant/telegram-git-notifier-app.svg?style=flat-square)](https://github.com/cslant/telegram-git-notifier-app/releases)\n![Test Status](https://img.shields.io/github/actions/workflow/status/cslant/telegram-git-notifier-app/setup_test.yml?label=tests\u0026branch=main)\n![Code Style Status](https://img.shields.io/github/actions/workflow/status/cslant/telegram-git-notifier-app/php-cs-fixer.yml?label=code%20style\u0026branch=main)\n[![StyleCI](https://styleci.io/repos/656960426/shield)](https://styleci.io/repos/656960426)\n[![Quality Score](https://img.shields.io/scrutinizer/g/cslant/telegram-git-notifier-app.svg?style=flat-square)](https://scrutinizer-ci.com/g/cslant/telegram-git-notifier-app)\n[![Maintainability](https://api.codeclimate.com/v1/badges/7ccaccebe9cd58ff3df5/maintainability)](https://codeclimate.com/github/cslant/telegram-git-notifier-app/maintainability)\n\n## 📝 Information\n\n- Send notifications of your GitHub/GitLab repositories to Telegram Bots, Groups, Super Groups (Multiple Topics), and Channels.\n- The bot must be created using the [BotFather](https://core.telegram.org/bots#6-botfather)\n\n## 🎉 Features\n\n1. **GitHub/GitLab Notifications to Telegram**: The package allows you to configure a Telegram bot to receive notifications from various GitHub/GitLab events, including events like **commits, pull requests, issues, releases, and many more**.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg alt=\"GitHub/GitLab Notifications to Telegram\" src=\"https://github.com/cslant/telegram-git-notifier-app/assets/35853002/462f330f-11d3-43ef-89cf-c70ade57b654\" /\u003e\n\u003c/p\u003e\n\n2. **Customize Notifications**: You can customize the types of notifications you want to receive through options on Telegram.\n\n[//]: # (features image)\n\n3. **Interactive Buttons**: The package supports creating interactive buttons on Telegram to perform actions such as enabling or disabling notifications.\n\n[//]: # (features image)\n\n4. **Event Management**: You can manage specific events that you want to receive notifications for, allowing you to focus on what's most important for your projects.\n\n   - Support for multiple platforms: GitHub and GitLab.\n   - Manage event notifications separately between platforms.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg alt=\"Event Management to Telegram\" src=\"https://github.com/cslant/telegram-git-notifier-app/assets/35853002/e217a2ad-49b5-4936-a2cd-fe4af66e2bfb\" /\u003e\n\u003c/p\u003e\n\n5. **Easy Integration**:\n   The package provides an API and user-friendly functions\n   to create a Telegram bot and link it to your GitHub/GitLab account.\n\n[//]: # (features image)\n\n6. **Support for multiple chats**: You can add multiple chat IDs to the `.env` file. \n   These chat IDs will be the chat IDs of your groups, channels, or users.\n   Also, you can add **the chat ID of this bot** to receive incoming notifications for itself.\n\n[//]: # (features image)\n\n7. **For premium users, you can use the following features:**\n   - **Support for multiple topics**: You can add multiple topics to the `.env` file. \n     These topics will be the topics of your supergroups.\n\n[//]: # (features image)\n\n## 📋 Requirements\n\n- PHP ^8.1\n- [Composer](https://getcomposer.org/)\n- Core: [Telegram Git Notifier](https://github.com/cslant/telegram-git-notifier)\n\n## 🔧 Installation\n\nAs for the installation and configuration,\nthis project provides two different installation ways depending on your preference or suitability for your system.\n\n\u003e **Way 1:** Install by composer directly on the system (Requires the system to install composer, previous PHP version)\n\u003e \n\u003e **Way 2:** Install by Docker (Requires the system to install Docker, Docker Compose)\n\n### I. Installation and configuration 🛠\n\nPlease choose only one of the following two ways to set up the project.\n\n\u003cdetails open\u003e\n\n\u003csummary\u003e\u003cb\u003eWay 1: Install by composer directly on the system ⚙\u003c/b\u003e\u003c/summary\u003e\n\u003cbr/\u003e\n\nFirst, please clone and install this project via [Composer](https://getcomposer.org/):\n\n```bash\ncomposer create-project cslant/telegram-git-notifier-app\n```\n\nAfter running the command above, you will have the project installed under the `telegram-git-notifier-app` directory,\nand the environment file `.env` will be created automatically.\n\nSome of the JSON files will be created automatically in the `storage` directory.\nThese files are used to store the data and serve for features in this bot.\n\n#### 1. Create a New Bot\n\nTo create a new bot, you need to talk to [BotFather](https://core.telegram.org/bots#6-botfather) and follow a few simple steps.\n\n1. Open a chat with [BotFather](https://telegram.me/botfather) and send `/newbot` command.\n2. Enter a friendly name for your bot. This name will be displayed in contact details and elsewhere.\n3. Enter a unique username for your bot. It must end in `bot`. Like this, for example: `TetrisBot` or `tetris_bot`.\n4. Copy the HTTP API access token provided by [BotFather](https://telegram.me/botfather) and paste it into your `.env` file.\n\n```dotenv\nTELEGRAM_BOT_TOKEN=123456789:ABCDEFGHIJKLMNOPQRSTUVWXYZ\n```\n\n#### 2. Set up your domain and SSL certificate\n\n**We recommend that you use HTTPS to set up your domain and webhook.**\nYou can build your own server or use a service like [Heroku](https://www.heroku.com/).\n\nIn this example, we will use localhost and [ngrok](https://ngrok.com/) to set up the domain and webhook:\n1. Download and install [ngrok](https://ngrok.com/download).\n2. Go to this project directory and run the command in the terminal: `php -S localhost:8000`\n3. Continue to run the command in the terminal: `ngrok http 8000`\n4. Copy the HTTPS URL provided by ngrok and paste it into your `.env` file.\n\n```dotenv\nTGN_APP_URL=https://123456789.ngrok.io\n```\n\n#### 3. Get your Chat ID and add it to the .env file\n\n1. Open a chat with your bot.\n2. Send any message to your bot. (This handle needs to get your chat ID)\n3. Go to the following URL: `\u003cTGN_APP_URL\u003e/webhooks/getUpdate.php`\n4. Look for the `\"chat\":{\"id\":` field and copy the number after it. This is your Chat ID.\n5. Paste the Chat ID in your `.env` file.\n\n```dotenv\nTELEGRAM_BOT_CHAT_ID=123456789\n```\n\nAt this time, the source launch process is done, please skip way 2 and go to step [II. Set the webhook](#ii-set-the-webhook) to continue.\n\n\u003c/details\u003e\n\n---\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cb\u003eWay 2: Install by Docker :whale:\u003c/b\u003e\u003c/summary\u003e\n\u003cbr/\u003e\n\n\u003e **Note:** This way requires the system to install Docker and Docker Compose. \n\u003e \n\u003e ⚠ **If you set up the project by way one, please skip this way.** 🚸\n\u003e \n\u003eAnd go to step [II. Set the webhook](#ii-set-the-webhook) to continue.\n\nFirst, please clone this project and copy the environment file `.env.example` to `.env`:\n\n```bash\ngit clone git@github.com:cslant/telegram-git-notifier-app.git\ncd telegram-git-notifier-app\ncp .env.example .env\n```\n\n#### 1. Update the environment variables\n\nOpen the `.env` file and update the following variables:\n\n```dotenv\nPHP_VERSION_SELECTED=8.2\nAPP_PORT=3180\n\n# You can customize the container name to suit your needs using GitHub and GitLab\nCONTAINER_NAME=tgn-app\n```\n\n\u003e **Note:** \n\u003e \n\u003e - The `PHP_VERSION_SELECTED` variable is the PHP version you want to use in the container.\n\u003e - The `APP_PORT` variable is the port of the container. (Please don't set the same port as the host)\n\u003e - The `CONTAINER_NAME` variable is the name of the container you want to create.\n\n#### 2. Install and run the container\n\nRun the following command to install and run the container:\n\n```shell\nbash ./docker.sh\n```\n\nSome of the JSON files will be created automatically in the `storage` directory.\nThese files are used to store the data and serve for features in this bot.\n\n#### 3. Create a New Bot\n\nTo create a new bot,\nyou need to talk to [BotFather](https://core.telegram.org/bots#6-botfather) and follow a few simple steps.\n\n1. Open a chat with [BotFather](https://telegram.me/botfather) and send `/newbot` command.\n2. Enter a friendly name for your bot. This name will be displayed in contact details and elsewhere.\n3. Enter a unique username for your bot. It must end in `bot`. Like this, for example: `TetrisBot` or `tetris_bot`.\n4. Copy the HTTP API access token provided by [BotFather](https://telegram.me/botfather) and paste it into your `.env` file.\n\n```dotenv\nTELEGRAM_BOT_TOKEN=123456789:ABCDEFGHIJKLMNOPQRSTUVWXYZ\n```\n\n\n#### 4. Set up your domain and SSL certificate\n\nIn this way, we use the proxy in the container and [ngrok](https://ngrok.com/) to set up the domain and webhook:\n1. Check the proxy of the container: `docker inspect \u003cCONTAINER_NAME\u003e-nginx | grep IPAddress`\n\n\u003e **Note:** Replace `\u003cCONTAINER_NAME\u003e` with the name of the container in .env file.\n\nExample:\n\n![image](https://github.com/cslant/lemp-docker/assets/35853002/8dc8ba3f-b1e9-4bff-901d-6bb7747acda4)\n\n2. Download and install [ngrok](https://ngrok.com/download).\n2. Continue to run the command in the terminal: `ngrok http \u003cCONTAINER_IP\u003e`\n\n\u003e **Note:** Replace `\u003cCONTAINER_IP\u003e` is the IP address of the container in step 1.\n\nExample:\n\n```bash\nngrok http 172.28.0.3\n```\n\n3. Copy the HTTPS URL provided by ngrok and paste it into your `.env` file.\n\n```dotenv\nTGN_APP_URL=https://123456789.ngrok-free.app\n```\n\n#### 5. Get your Chat ID and add it to the .env file\n\n1. Open a chat with your bot.\n2. Send any message to your bot. (This handle needs to get your chat ID)\n3. Go to the following URL: `\u003cTGN_APP_URL\u003e/webhooks/getUpdate.php`\n4. Look for the `\"chat\":{\"id\":` field and copy the number after it. This is your Chat ID.\n5. Paste the Chat ID in your `.env` file.\n\n```dotenv\nTELEGRAM_BOT_CHAT_ID=123456789\n```\n\n\u003c/details\u003e\n\n### II. Set the webhook\n\nWe have two ways to set the webhook:\n\n#### 1. Set the webhook from this project\n\nAfter setting up your domain and SSL certificate, you need to set up the webhook for your bot. \n\n**Go to:**\n\n```text\n\u003cAPP_URL\u003e/webhooks/set.php\n```\n\n\u003e **Note:** Replace `\u003cAPP_URL\u003e` with your app URL in .env file.\n\nIf you see the following message, it means that the webhook has been sent successfully.\n\n```json\n{\"ok\":true,\"result\":true,\"description\":\"Webhook was set\"}\n```\n\n[//]: # (status image)\n\n#### 2. Set the webhook manually from Telegram\n\nIf you want to set the webhook manually, you can use the following URL:\n\n```url\nhttps://api.telegram.org/bot\u003cYourTelegramBotToken\u003e/setWebhook?url=\u003cAPP_URL\u003e\n```\n\n\u003e **Note:** Replace `\u003cYourTelegramBotToken\u003e` with your bot token and `\u003cAPP_URL\u003e` with your app URL in the `.env` file.\n\n### III. Add chat IDs you want to receive notifications to the .env file\n\n#### 1. Add multiple chat IDs to the `.env` file.\n\n**These chat IDs will be the chat IDs of your groups, channels, or users.**\n\nAlso, you can add **the chat ID of this bot** to receive incoming notifications for itself.\n\n```dotenv\nTELEGRAM_NOTIFY_CHAT_IDS=\"-978339113;-1001933979183\"\n```\n\n#### 2. Add a topic for supergroups with premium users (Thread ID)\n\nYou can add topic for supergroups with premium users (Thread ID).\n\n**These topics will be the topics of your supergroups.**\n\n```dotenv\nTELEGRAM_NOTIFY_CHAT_IDS=\"-978339113;-1001933979183:topic_1;\"\n```\n\n#### 3. Add multiple topics for supergroups with premium users (Thread IDs)\n\nYou can add multiple topics for each supergroup with premium users (Thread IDs).\n\n```dotenv\nTELEGRAM_NOTIFY_CHAT_IDS=\"-978339113;-1001933979183:topic_1,topic_2;\"\n```\n\n\u003e **Note:**\n\u003e \n\u003e - Please use semicolon \";\" to separate chat ids\n\u003e   - And use a colon \":\" to separate chat ID and topic\n\u003e   - And use the comma \",\" if you want to add multiple topics\n\n---\n\nNow your configuration is complete. And the `.env` file will be like this:\n\n```dotenv\nTGN_APP_NAME='Telegram GitHub/GitLab Notify Bot'\n\n# Set your app URL here (Required for the bot to work properly)\nTGN_APP_URL=https://123456789.ngrok.io\n\nTELEGRAM_BOT_TOKEN=6162840106:AAH3g20lMQIkG_wHHu8R_ngdtG541uzoq4\nTELEGRAM_BOT_CHAT_ID=6872320129\n\n# Set the chat IDs that will receive notifications here.\n# You can add the owner bot ID, group id, ...\n# -------------------------------------------------------\n# Note:\n# Please use semicolon \";\" to separate chat ids\n# And use a colon \":\" to separate chat ID and thread ID\n# And use comma \",\" if you want to add multiple thread ids\n# -------------------------------------------------------\n# The environment variable is expected to be in the format:\n# \"chat_id1;chat_id2:thread_id2;chat_id3:thread_id3_1,thread_id3_2;...\"\nTELEGRAM_NOTIFY_CHAT_IDS=\"-978339113;-1001933979183:2,13;6872320129\"\n\nTIMEZONE=Asia/Ho_Chi_Minh\n\nPHP_VERSION_SELECTED=8.2\nCONTAINER_NAME=tgn-bot\nAPP_PORT=3180\n```\n\n## 🚀 Usage\n\nNow you can send a message to your bot, and you will receive a welcome message from the bot.\n\n```text\n/start\n```\n\n[//]: # (image)\n\nIf you want to check the menu, you can send the following message to your bot.\n\n```text\n/menu\n```\n\n🎊 At this point, the configuration process for your telegram bot is completed.\nYou can use all the features of this bot.\n🎉🎉\n\n\u003cp align=\"center\"\u003e\n  \u003cimg alt=\"Menu features of this bot\" src=\"https://github.com/cslant/telegram-git-notifier-app/assets/35853002/1a725130-c7c4-4594-9669-abc6d2dc1fba\" /\u003e\n\u003c/p\u003e\n\n**To increase ease of use. Let's create a menu with a list of commands listed for you.**\n\nPlease send the following message to your bot to create a menu button.\n\n```text\n/set_menu\n```\n\n\u003cp align=\"center\"\u003e\n  \u003cimg alt=\"Set menu\" src=\"https://github.com/cslant/telegram-git-notifier-app/assets/35853002/70f79e8f-b075-455d-b928-f721ca5b11cc\" /\u003e \u003cimg alt=\"Set menu\" src=\"https://github.com/cslant/telegram-git-notifier-app/assets/35853002/53af5d51-7aa8-4dd8-99f6-3b55a9971cbe\" /\u003e\n\u003c/p\u003e\n\nNow you will need to add the Webhook for your GitHub and GitLab repository to receive notifications.\n\n## 📌 Add webhook on your GitHub repository to receive notifications\n\n1. Go to your repository settings.\n2. Go to the `Webhooks` section.\n3. Click on `Add webhook`.\n4. Set `Payload URL` to `\u003cAPP_URL\u003e`.\n5. Set `Content type` to `application/x-www-form-urlencoded`.\n6. Which events would you like to trigger this webhook? Select `Let me select individual events.`.\n7. Click on the `Active` checkbox and Add webhook button.\n8. Done. You will receive a notification when your repository has a new event.\n\nHere is the first notification you will receive:\n\n\u003cp align=\"center\"\u003e\n  \u003cimg alt=\"Github ping event notification\" src=\"https://github.com/cslant/telegram-git-notifier-app/assets/35853002/66b7fffa-d2fa-41f6-8caa-3c1ab96b63be\" /\u003e\n\u003c/p\u003e\n\n## 📌 Add a webhook on your GitLab repository to receive notifications\n\n1. Go to your repository settings.\n2. Go to the `Webhooks` section.\n3. Click on `Add new webhook`.\n4. Set `URL` to `\u003cAPP_URL\u003e`.\n5. Choose any `Trigger` you want.\n6. Click on the `Enable SSL verification` checkbox and Add webhook button.\n\n\u003e **Note: You can set up this webhook for different repositories. Please similarly set up the webhook for each repository.**\n\nThen every time one of those repositories appears an event, this telegram bot will immediately send you a notification. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcslant%2Ftelegram-git-notifier-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcslant%2Ftelegram-git-notifier-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcslant%2Ftelegram-git-notifier-app/lists"}