{"id":26137806,"url":"https://github.com/jaycee0610/basic-telegram-sender-php","last_synced_at":"2026-02-13T20:04:24.875Z","repository":{"id":279660859,"uuid":"939521886","full_name":"jaycee0610/Basic-Telegram-Sender-PHP","owner":"jaycee0610","description":"A simple PHP script to send messages to a Telegram group using a bot. 🤖","archived":false,"fork":false,"pushed_at":"2025-02-26T18:06:49.000Z","size":1066,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-26T18:42:50.036Z","etag":null,"topics":["rootscratch","telegram-bot","telegram-bot-api","telegram-notification-api","telegram-php","telegram-php-api","telegram-sender"],"latest_commit_sha":null,"homepage":"https://rootscratch.com","language":"PHP","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/jaycee0610.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-26T17:13:35.000Z","updated_at":"2025-02-26T18:06:52.000Z","dependencies_parsed_at":"2025-02-26T18:43:00.543Z","dependency_job_id":"87edcfba-baa3-41c7-8cf7-486a06695fd5","html_url":"https://github.com/jaycee0610/Basic-Telegram-Sender-PHP","commit_stats":null,"previous_names":["jaycee0610/basic-telegram-sender-php"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaycee0610%2FBasic-Telegram-Sender-PHP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaycee0610%2FBasic-Telegram-Sender-PHP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaycee0610%2FBasic-Telegram-Sender-PHP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaycee0610%2FBasic-Telegram-Sender-PHP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jaycee0610","download_url":"https://codeload.github.com/jaycee0610/Basic-Telegram-Sender-PHP/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242951081,"owners_count":20211572,"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":["rootscratch","telegram-bot","telegram-bot-api","telegram-notification-api","telegram-php","telegram-php-api","telegram-sender"],"created_at":"2025-03-11T01:04:01.987Z","updated_at":"2026-02-13T20:04:19.855Z","avatar_url":"https://github.com/jaycee0610.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🚀 Basic Telegram Sender PHP\n\n![GIF](https://raw.githubusercontent.com/jaycee0610/Basic-Telegram-Sender-PHP/refs/heads/main/main.gif)\n\nA simple PHP script to send messages to a Telegram group using a bot. 🤖\n\n## 📥 Installation\n\n1. **Clone the Repository:**\n   ```sh\n   git clone https://github.com/jaycee0610/Basic-Telegram-Sender-PHP.git\n   cd Basic-Telegram-Sender-PHP\n   ```\n\n2. **Install Dependencies:**\n   ```sh\n   composer require rootscratch/telegram\n   ```\n\n## 🛠️ Setup Guide\n\n### 📌 Step 1: Create a Telegram Bot\n- Open Telegram and search for `@BotFather`. 🤖\n- Start a chat with `@BotFather` and create a new bot.\n- Once created, you will receive a **bot token**. Save this token for later use. 🔑\n\n### 📌 Step 2: Create a Group and Add the Bot\n- Create a new Telegram group.\n- Add your bot to the group.\n- Send any message in the group to initialize it. 🆕\n\n### 📌 Step 3: Get the List of Updates\nTo retrieve the updates for your bot, use the following API request:\n```\nhttps://api.telegram.org/bot\u003cYourBOTToken\u003e/getUpdates\n```\n**Example:**\n```\nhttps://api.telegram.org/bot123456789:jbd78sadvbdy63d37gda37bd8/getUpdates\n```\n\n### 📌 Step 4: Find the Chat ID\nLook for the \"chat\" object in the API response:\n```json\n{\n    \"update_id\": 8393,\n    \"message\": {\n        \"message_id\": 3,\n        \"from\": {\n            \"id\": 7474,\n            \"first_name\": \"AAA\"\n        },\n        \"chat\": {\n            \"id\": -\u003cgroup_ID\u003e,\n            \"title\": \"\u003cGroup name\u003e\"\n        },\n        \"date\": 25497,\n        \"new_chat_participant\": {\n            \"id\": 71, \n            \"first_name\": \"NAME\",\n            \"username\": \"YOUR_BOT_NAME\"\n        }\n    }\n}\n```\n- The `id` inside the \"chat\" object is your **Group Chat ID** and always starts with `-`. 🆔\n- Use this ID when sending messages to the group. 📩\n\n**Note:**\nIf you created a new group and the API response only returns:\n```json\n{\"ok\": true, \"result\": []}\n```\nTry removing and re-adding the bot to the group. 🔄\n\n## 🚀 Usage\n\n1. **Modify `index.php`:**\n   ```php\n   require_once 'vendor/autoload.php';\n\n   use Rootscratch\\Telegram\\Send;\n\n   Send::telegram_token('your-bot-token-here');\n   Send::telegram_chat_id('-your-chat-id-here');\n   $message = 'Hello, Telegram!';\n\n   try {\n       $send = Send::SendGroup($message);\n       echo json_encode($send);\n   } catch (\\Exception $e) {\n       echo json_encode(['error' =\u003e $e-\u003egetMessage()]);\n   }\n   ```\n\n2. **Run the script:**\n   ```sh\n   php index.php\n   ```\n\n## 📡 API Response Example\n```json\n{\n    \"ok\": true,\n    \"result\": {\n        \"message_id\": 123,\n        \"chat\": {\n            \"id\": -1001234567890,\n            \"title\": \"My Telegram Group\"\n        },\n        \"text\": \"Hello, Telegram!\"\n    }\n}\n```\n\n## ⚠️ Troubleshooting\n- If you get `{\"ok\":true,\"result\":[]}` when retrieving updates, try removing and re-adding the bot to the group. 🔄\n- Make sure the bot has permission to send messages in the group. ✅\n\n## 📜 License\nThis project is licensed under the MIT License. 📝\n\n## 👨‍💻 Author\n[John Natividad](https://github.com/jaycee0610) ✨\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaycee0610%2Fbasic-telegram-sender-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaycee0610%2Fbasic-telegram-sender-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaycee0610%2Fbasic-telegram-sender-php/lists"}