# Connect Telegram

> Connect a Telegram bot to a sender. Provide the bot token from @BotFather; Zavu validates it, registers the webhook, and routes the sender's Telegram messages through it.

`POST https://api.zavu.dev/v1/senders/{senderId}/telegram`

Connect a Telegram bot to a sender. Provide the bot token from @BotFather; Zavu validates it, registers the webhook, and routes the sender's Telegram messages through it.

## Parameters

- `senderId` (path, string, required)

## Body

- `botToken` (string, required): Bot token from @BotFather.

## Responses

### 200

Telegram connected.

- `telegram` (object, required)
  - `connected` (boolean, required)
  - `botUsername` (string)
  - `botId` (string)

### 400

Invalid bot token or request.

- `code` (string, required)
- `message` (string, required)
- `details` (object)

### 401

Unauthorized.

- `code` (string, required)
- `message` (string, required)
- `details` (object)

### 404

Sender not found.

- `code` (string, required)
- `message` (string, required)
- `details` (object)

## Example

```bash
curl -X POST "https://api.zavu.dev/v1/senders/sender_abc123/telegram" \
  -H "Authorization: Bearer $ZAVUDEV_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "botToken": "string"
}'
```

```typescript
import Zavudev from "@zavudev/sdk";

const zavu = new Zavudev({ apiKey: process.env.ZAVUDEV_API_KEY });

const result = await zavu.senders.telegram.connect("sender_abc123", {
  botToken: "string",
});

console.log(result);
```
