windkh / node-red-contrib-telegrambot

Telegram bot nodes for node-red.
Other
256 stars 116 forks source link

editMessageReplyMarkup - Add photo? #309

Closed FullDad closed 10 months ago

FullDad commented 1 year ago

greetings!. I've been pretty stuck on this one. How can i take a text message and add a photo into it on telegram?

Below is the code. All i want to do is add a caption and local image that i have to the message. Is this possible?

// This is the message id of the initial keyboard that is simply exchanged by a new one.
var messageId = context.global.keyboard.messageId;

// This is a sample of how to send a second inline keyboard with modified buttons
var reply_markup = JSON.stringify({
    "inline_keyboard": [[
        {
            "text": "Are you really sure?",
            "callback_data": "FOO YES REALLY"
        },
        {
            "text": "No",
            "callback_data": "FOO NO"
        }]
    ]
});

var options = {
    chat_id: msg.payload[0].chatId,
    reply_markup: reply_markup,
    message_id: msg.payload[0].messageId
};

msg.payload.type = 'editMessageReplyMarkup';
msg.payload.content = reply_markup;
msg.payload.options = options;

return [msg];
windkh commented 1 year ago

I do not fully understand your problem. In your code you want to add an image underneath the two keyboard buttons? Within the same message?

well first of all I thought: why do you not simply send two messages after each other: the keyboard and then a second message with the photo?

windkh commented 10 months ago

@FullDad can I close this issue?