> ## Documentation Index
> Fetch the complete documentation index at: https://n-a-818b4087.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Message actions

> Forward, copy, delete, edit, pin, and answer callback queries.

## Forward and copy

```python theme={null}
telegram.forward_message(
    chat_id = 'DESTINATION_CHAT_ID',
    from_chat_id = 'SOURCE_CHAT_ID',
    message_id = 12345
)

new_message = telegram.copy_message(
    chat_id = 'DESTINATION_CHAT_ID',
    from_chat_id = 'SOURCE_CHAT_ID',
    message_id = 12345,
    caption = 'Copied!'
)
```

`forward_message()` returns the new `Message` object. `copy_message()` returns a dictionary such as `{'message_id': 123}`.

## Delete messages

```python theme={null}
telegram.delete_message(chat_id = 'YOUR_CHAT_ID', message_id = 1235)
telegram.delete_messages(chat_id = 'YOUR_CHAT_ID', message_ids = [1235, 1236])
```

## Edit text and captions

```python theme={null}
telegram.edit_message(
    chat_id = 'YOUR_CHAT_ID',
    message_id = 1235,
    text = 'This is an updated text!',
    parse_mode = 'Markdown'
)

telegram.edit_message_caption(
    chat_id = 'YOUR_CHAT_ID',
    message_id = 1235,
    caption = 'This is an updated caption!'
)
```

`edit_message()` accepts the same parse mode, entity, and link-preview options as `send_message()`.

## Replace or remove an inline keyboard

```python theme={null}
telegram.edit_message_reply_markup(
    chat_id = 'YOUR_CHAT_ID',
    message_id = 1235,
    reply_markup = {'inline_keyboard': []}
)
```

An empty inline keyboard removes the existing buttons. Pass a new keyboard to replace them.

## Pin and unpin

```python theme={null}
telegram.pin_chat_message(
    chat_id = 'YOUR_CHAT_ID',
    message_id = 1235,
    disable_notification = True
)

telegram.unpin_chat_message(chat_id = 'YOUR_CHAT_ID', message_id = 1235)

# Unpin the most recent pinned message.
telegram.unpin_chat_message(chat_id = 'YOUR_CHAT_ID')
```

## Answer callback queries

Always acknowledge callback queries so the client stops showing a loading state:

```python theme={null}
for message in telegram.poll_updates(allowed_updates = ['callback_query']):
    callback = message.raw.get('callback_query')
    if not callback:
        continue

    telegram.answer_callback_query(
        callback_query_id = callback['id'],
        text = 'Done!',
        show_alert = False
    )
```

Set `show_alert = True` to show the message as a modal alert. Pass `url` to open a link, or `cache_time` to control client-side caching.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.