# Telegram

> Send Telegram messages, manage chat pins, and generate invite links.

App · Messaging · 6 actions · 1 trigger. Web page: https://docs.lodol.com/docs/integrations/telegram

## Triggers

Start a workflow when something happens in Telegram. See [how triggers work](https://docs.lodol.com/docs/concepts/triggers.md).

### New Telegram message

Starts the workflow when your Telegram bot receives a new message.

**Filters**: Narrow which events start a run.

- `chat_id`

**Event fields**: What a run starts with. Later steps read each field with an @ reference.

- `message_id` (number)
- `chat_id` (number)
- `text` (text)
- `from_user_id` (number)
- `from_username` (text)
- `date` (number)

## Actions

### Create an invite link

Generate a new join link for a chat.

**Inputs**

- Chat ID (`chat_id`, text, required): The chat to create an invite link for.
- Name (`name`, text): Optional label to help you recognize this link, up to 32 characters.
- Expiration date (`expire_date`, date and time): Optional. When the link should expire. Leave blank for a link that never expires.
- Member limit (`member_limit`, number): Optional. The maximum number of people who can join using this link, between 1 and 99999. From 1 to 99999.

**Outputs**

- `expire_date` (number): Link expiration timestamp.
- `invite_link` (text): Telegram invite link URL.
- `member_limit` (number): Maximum users allowed.
- `status` (text): Action execution status.

**Example output**

```json
{
  "expire_date": 1706745600,
  "invite_link": "https://t.me/+abcdef123456",
  "member_limit": 100,
  "status": "success"
}
```

### Forward a message

Forward a message from one chat to another.

**Inputs**

- Destination chat (`chat_id`, text, required): The chat to forward the message to.
- Source chat (`from_chat_id`, text, required): The chat that currently has the message.
- Message ID (`message_id`, number, required): The ID of the message to forward.

**Outputs**

- `chat_id` (number): Destination chat ID.
- `message_id` (number): Forwarded message ID.
- `status` (text): Action execution status.

**Example output**

```json
{
  "chat_id": 123456789,
  "message_id": 12347,
  "status": "success"
}
```

### Get chat member count

Retrieve the number of members in a chat.

**Inputs**

- Chat ID (`chat_id`, text, required): The chat to count members in.

**Outputs**

- `count` (number): Member count.
- `status` (text): Action execution status.

**Example output**

```json
{
  "count": 147,
  "status": "success"
}
```

### Pin a chat message

Pin a message in a chat with optional silent notification.

**Inputs**

- Chat ID (`chat_id`, text, required): The chat that has the message.
- Message ID (`message_id`, number, required): The ID of the message to pin.
- Disable notification (`disable_notification`, true/false): Set to true to pin the message without notifying members.

**Outputs**

- `status` (text): Action execution status.

**Example output**

```json
{
  "status": "success"
}
```

### Send a message

Send a text message to a Telegram chat.

**Inputs**

- Chat ID (`chat_id`, text, required): Which chat to send to. Pick it from the list, or switch to manual entry to type a numeric chat ID.
- Text (`text`, text, required): The text of the message to send.
- Text formatting (`parse_mode`, text): Optional. How to format the message text. Leave blank for plain text. Prefer MarkdownV2 over Markdown, which Telegram keeps only for backward compatibility. One of: `HTML`, `MarkdownV2`, `Markdown` (Markdown (legacy)).

**Outputs**

- `chat_id` (number): Telegram chat ID.
- `message_id` (number): Telegram message ID.
- `status` (text): Action execution status.

**Example output**

```json
{
  "chat_id": 987654321,
  "message_id": 12345,
  "status": "success"
}
```

### Send a photo

Send a photo to a Telegram chat, with an optional caption.

**Inputs**

- Chat ID (`chat_id`, text, required): Which chat to send to. Pick it from the list, or switch to manual entry to type a numeric chat ID.
- Photo URL (`photo_url`, text, required): A link to the photo you want to send.
- Caption (`caption`, text): Optional caption to show below the photo, up to 1024 characters.

**Outputs**

- `chat_id` (number): Telegram chat ID.
- `message_id` (number): Telegram message ID.
- `status` (text): Action execution status.

**Example output**

```json
{
  "chat_id": 987654321,
  "message_id": 12346,
  "status": "success"
}
```
