Skip to content

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

Open
@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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy