PHPackages                             rootscratch/telegram - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. rootscratch/telegram

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

rootscratch/telegram
====================

Telegram Group Message Sender PHP

v1.0.0(1y ago)02MITPHP

Since Feb 26Pushed 1y ago1 watchersCompare

[ Source](https://github.com/jaycee0610/Basic-Telegram-Sender-PHP)[ Packagist](https://packagist.org/packages/rootscratch/telegram)[ RSS](/packages/rootscratch-telegram/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

🚀 Basic Telegram Sender PHP
===========================

[](#-basic-telegram-sender-php)

[![GIF](https://raw.githubusercontent.com/jaycee0610/Basic-Telegram-Sender-PHP/refs/heads/main/main.gif)](https://raw.githubusercontent.com/jaycee0610/Basic-Telegram-Sender-PHP/refs/heads/main/main.gif)

A simple PHP script to send messages to a Telegram group using a bot. 🤖

📥 Installation
--------------

[](#-installation)

1. **Clone the Repository:**

    ```
    git clone https://github.com/jaycee0610/Basic-Telegram-Sender-PHP.git
    cd Basic-Telegram-Sender-PHP
    ```
2. **Install Dependencies:**

    ```
    composer require rootscratch/telegram
    ```

🛠️ Setup Guide
--------------

[](#️-setup-guide)

### 📌 Step 1: Create a Telegram Bot

[](#-step-1-create-a-telegram-bot)

- Open Telegram and search for `@BotFather`. 🤖
- Start a chat with `@BotFather` and create a new bot.
- Once created, you will receive a **bot token**. Save this token for later use. 🔑

### 📌 Step 2: Create a Group and Add the Bot

[](#-step-2-create-a-group-and-add-the-bot)

- Create a new Telegram group.
- Add your bot to the group.
- Send any message in the group to initialize it. 🆕

### 📌 Step 3: Get the List of Updates

[](#-step-3-get-the-list-of-updates)

To retrieve the updates for your bot, use the following API request:

```
https://api.telegram.org/bot/getUpdates

```

**Example:**

```
https://api.telegram.org/bot123456789:jbd78sadvbdy63d37gda37bd8/getUpdates

```

### 📌 Step 4: Find the Chat ID

[](#-step-4-find-the-chat-id)

Look for the "chat" object in the API response:

```
{
    "update_id": 8393,
    "message": {
        "message_id": 3,
        "from": {
            "id": 7474,
            "first_name": "AAA"
        },
        "chat": {
            "id": -,
            "title": ""
        },
        "date": 25497,
        "new_chat_participant": {
            "id": 71,
            "first_name": "NAME",
            "username": "YOUR_BOT_NAME"
        }
    }
}
```

- The `id` inside the "chat" object is your **Group Chat ID** and always starts with `-`. 🆔
- Use this ID when sending messages to the group. 📩

**Note:**If you created a new group and the API response only returns:

```
{"ok": true, "result": []}
```

Try removing and re-adding the bot to the group. 🔄

🚀 Usage
-------

[](#-usage)

1. **Modify `index.php`:**

    ```
    require_once 'vendor/autoload.php';

    use Rootscratch\Telegram\Send;

    Send::telegram_token('your-bot-token-here');
    Send::telegram_chat_id('-your-chat-id-here');
    $message = 'Hello, Telegram!';

    try {
        $send = Send::SendGroup($message);
        echo json_encode($send);
    } catch (\Exception $e) {
        echo json_encode(['error' => $e->getMessage()]);
    }
    ```
2. **Run the script:**

    ```
    php index.php
    ```

📡 API Response Example
----------------------

[](#-api-response-example)

```
{
    "ok": true,
    "result": {
        "message_id": 123,
        "chat": {
            "id": -1001234567890,
            "title": "My Telegram Group"
        },
        "text": "Hello, Telegram!"
    }
}
```

⚠️ Troubleshooting
------------------

[](#️-troubleshooting)

- If you get `{"ok":true,"result":[]}` when retrieving updates, try removing and re-adding the bot to the group. 🔄
- Make sure the bot has permission to send messages in the group. ✅

📜 License
---------

[](#-license)

This project is licensed under the MIT License. 📝

👨‍💻 Author
----------

[](#‍-author)

[John Natividad](https://github.com/jaycee0610) ✨

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance43

Moderate activity, may be stable

Popularity2

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

446d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/96e7723302f2828740841377232dddee236a773b0873fbe7a3a90aed929e6de5?d=identicon)[jaycee0610](/maintainers/jaycee0610)

---

Top Contributors

[![jaycee0610](https://avatars.githubusercontent.com/u/120337618?v=4)](https://github.com/jaycee0610 "jaycee0610 (6 commits)")

---

Tags

rootscratchtelegram-bottelegram-bot-apitelegram-notification-apitelegram-phptelegram-php-apitelegram-sender

### Embed Badge

![Health badge](/badges/rootscratch-telegram/health.svg)

```
[![Health](https://phpackages.com/badges/rootscratch-telegram/health.svg)](https://phpackages.com/packages/rootscratch-telegram)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
