# Forum Topics & Supergroups (message_thread_id)

> Create, edit, close, and organize Telegram Forum topics, manage custom icon colors, and route updates via message_thread_id.

**Category:** Telegram Bot API — Methods (A-Z)  
**URL:** https://docs.botlify.cloud/forum-topics  
**Platform:** Botlify Cloud (https://botlify.cloud)  

---

## Telegram Forum Supergroups Overview

   

Telegram allows large supergroups to enable **Topics**, transforming single chat streams into threaded sub-forums (e.g. *#General*, *#Announcements*, *#Support*). Every topic has a unique `message_thread_id` (which equals the `message_id` of the topic creation action).

   
> [!TIP]
> **How Thread Routing Works**
> To send or reply to a message inside a specific topic, you simply supply 'message_thread_id' => $threadId in your sendMessage, sendPhoto, or sendDocument payload. If omitted, messages are posted to the General topic.

   

## 1. Creating Forum Topics Programmatically (createForumTopic)

   

Bots can programmatically spawn new discussion topics for customer tickets, project alerts, or product categories:

   
```php

```

   

## 2. Routing Incoming Messages Within Forum Threads

   

When users post messages in a forum supergroup, Telegram includes `message_thread_id` in the incoming webhook. Always capture and preserve this ID when responding:

   
```php

```

   

## 3. Editing, Closing, Reopening & Deleting Topics

   

When tickets are resolved or projects complete, bots can close or archive the topic:

   
```php

```

> [!TIP]
> **Botlify Cloud Runtime**
> Credentials are auto-injected in .env — always load them with getenv(): BOT_TOKEN, ADMIN_CHAT_ID, BOT_USERNAME. Main database: database.db (SQLite, WAL mode). Runtime errors: error.log. Quick test: send to $ADMIN_CHAT_ID. Full details: Runtime Reference.
