# Telegram Bot
URL: https://usememos.com/docs/integrations/telegram-bot

Memogram is the Telegram integration for Memos. It syncs text and images from a Telegram bot into your Memos instance.

Repository and releases:

```text
https://github.com/usememos/telegram-integration
https://github.com/usememos/telegram-integration/releases
```

## Prerequisites [#prerequisites]

* A running Memos instance
* A Telegram bot token

## Configuration [#configuration]

Create a `.env` file and set:

```text
SERVER_ADDR=dns:localhost:5230
BOT_TOKEN=your_telegram_bot_token
BOT_PROXY_ADDR=https://api.your_proxy_addr.com
ALLOWED_USERNAMES=user1,user2,user3
```

### Configuration options [#configuration-options]

* `SERVER_ADDR`: gRPC address where Memos is running.
* `BOT_TOKEN`: Telegram bot token.
* `BOT_PROXY_ADDR`: Optional proxy for Telegram API.
* `ALLOWED_USERNAMES`: Optional comma-separated list of allowed usernames (without `@`).

When `ALLOWED_USERNAMES` is set, only those users can use the bot.

## Run Memogram [#run-memogram]

### Binary [#binary]

1. Download the release binary.
2. Put `.env` next to the binary.
3. Run:

```sh
./memogram
```

### Docker [#docker]

```sh
docker build -t memogram .
docker run -d --name memogram \
  -e SERVER_ADDR=dns:localhost:5230 \
  -e BOT_TOKEN=your_telegram_bot_token \
  memogram
```

### Docker Compose [#docker-compose]

```yaml
services:
  memogram:
    env_file: .env
    build: memogram
    container_name: memogram
```

## Commands [#commands]

* `/start <access_token>`: Authenticate with your Memos access token.
* Send text: Saves the message as a memo.
* Send files: Saves files as resources attached to a memo.
* `/search <words>`: Search your memos.
