
---
url: /mod/telegram.md
---
# x telegram

Use x telegram send messages to your Telegram group or channel. The first use requires configuring bot token.


::: tip
Instructions for get Telegram bot token:  https://core.telegram.org/bots#how-do-i-create-a-bot
- Interactive env use `x telegram init` to initialize configuration. The configure will be saved locally.
- Run command `x telegram --cfg token=<token>` to add token.
:::


## Examples

Set the group bot's token

```sh
x telegram --cfg token=<token>
```

Send text type messages to Telegram group

```sh
x telegram send --text "x-cmd v1.0 released successfully"
```

Send text type messages to Telegram channel

```sh
x telegram send --text --chatid "@channelusername" "x-cmd v1.0 released successfully"
```

Send a.png images to Telegram group

```sh
x telegram send --image --chatid "-967810017" --file_path ./a.png
```

Start interactive REPL mode, executing messages as commands and returning output

```sh
x telegram react --runner repl
```

## Usage

```sh
x telegram [OPTIONS] [FLAGS] [SUB_COMMAND]
```

## Options

| Name, Shorthand | Default | Description |
| ------- | ------- | ------- |
| `--cfg` |  | manage configuration for telegram |


## Flags

| Name, Shorthand | Description |
| ------- | ------- |
| `--cur` | current session default value management |


## Sub Commands

| Name | Description |
| ------- | ------- |
| [x telegram send](/mod/telegram/send.md) | Send messages using a Telegram group bot (equivalent to `x telegram bot send`) |
| [x telegram bot](/mod/telegram/bot.md) | Send messages using a Telegram group bot |
| [x telegram listen](/mod/telegram/listen.md) | Long-poll for Telegram messages |
| [x telegram parse](/mod/telegram/parse.md) | Parse Telegram messages, automatically download media files |
| [x telegram init](/mod/telegram/init.md) | Initialize the configuration using interactive mode |
| [x telegram react](/mod/telegram/react.md) | Listen for Telegram messages and reply automatically based on the specified mode |
