> ## 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.

# Send messages

> Send text, inline keyboards, contacts, locations, and chat actions.

## Text messages

```python theme={null}
telegram.send_message(
    chat_id = 'YOUR_CHAT_ID',
    text = 'You can visit my GitHub profile: github.com/mishka',
    no_webpage = True,
    disable_notification = True
)
```

`parse_mode` accepts `'Markdown'`, `'MarkdownV2'`, or `'HTML'`. You can pass `entities` or `link_preview_options` directly instead of relying on parse mode:

```python theme={null}
telegram.send_message(
    chat_id = 'YOUR_CHAT_ID',
    text = 'Hello, World!',
    parse_mode = 'HTML',
    link_preview_options = {'is_disabled': True}
)
```

Use `reply_to_message_id` to reply to a message, `message_thread_id` for forum topics, and `protect_content = True` to prevent forwarding and saving.

## Inline keyboards

`reply_markup` accepts a dictionary or a JSON string:

```python theme={null}
telegram.send_message(
    chat_id = 'YOUR_CHAT_ID',
    text = 'Choose an option:',
    reply_markup = {
        'inline_keyboard': [
            [
                {'text': 'Open GitHub', 'url': 'https://github.com/mishka'},
                {'text': 'Say hello', 'callback_data': 'hello'}
            ]
        ]
    }
)
```

When a user presses a button with `callback_data`, Telegram sends a callback query update. Read the callback data from the raw update and acknowledge it with `answer_callback_query()`:

```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
    )
```

See [message actions](https://n-a-818b4087.mintlify.site/guides/message-actions.md) for editing keyboards after a callback.

## Contacts

```python theme={null}
telegram.send_contact(
    chat_id = 'YOUR_CHAT_ID',
    first_name = 'First name of the contact',
    last_name = 'Last name of the contact',
    phone_number = '+1234567890'
)
```

`vcard` is also supported for a full contact card.

## Locations

```python theme={null}
telegram.send_location(
    chat_id = 'YOUR_CHAT_ID',
    latitude = 29.9792,
    longitude = 31.1342,
    horizontal_accuracy = 50,
    heading = 90
)
```

For live locations, set `live_period`. `proximity_alert_radius` controls proximity alerts.

## Chat actions

`send_chat_action()` shows a status such as "typing" or "uploading photo" in the chat:

```python theme={null}
telegram.send_chat_action(chat_id = 'YOUR_CHAT_ID', action = 'typing')
```

Useful actions include `'typing'`, `'upload_photo'`, `'upload_video'`, `'record_voice'`, `'upload_document'`, and `'find_location'`.

> [!NOTE]
>
> Sending methods return a parsed `Message` object. Methods that only confirm success, such as `send_chat_action()`, return Telegram's raw result, usually `True`.


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