Skip to content

symfony/telegram-notifier does not support editing messages that have media #60104

@haivala

Description

@haivala

Description

I'm using telegram notifier to send messages that have photo, text and buttons.
I get the message id back from the request but I cannot use that to edit the text part of the message and getting "message text is empty" error.
This is because the text is in the image caption part of the message if there is a picture. Telegram does support editing the caption but there is another api endpoint to do it.
AI suggested I would do my own post method described in the example.
It would be nice if this notifier would do it automatically if the message has picture.

Example

            $response = $client->request('POST', 'https://api.telegram.org/bot' . $_ENV['TELEGRAM_DSN'] . '/editMessageMedia', [
                'json' => [
                    'chat_id' => $notification->getChannel(),
                    'message_id' => $notification->getMessageId(),
                    'media' => [
                        'type' => 'photo',
                        'media' => $publicUrl,
                        'caption' => $msg,
                        'parse_mode' => 'HTML'
                    ],
                    'reply_markup' => $telegramOptions->toArray()['reply_markup'] ?? null
                ]
            ]);

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions