1

I would like to put image(link) inside html and send it over with Telegram. But when I try to put image inside html body it stops to work, that message won't be delivered after execution. I tried the approaches from this SO post: How to send an Embedded Image along with text in a Message via Telegram Bot API . Sending html without image works. But it doesnt work with image, neither disableWebPagePreview() or ‍ solves the problem. How to fix it?

SendMessage sendMessage = new SendMessage();
        sendMessage.setParseMode(ParseMode.HTML);
        sendMessage.disableWebPagePreview();
        sendMessage.setChatId(chatId);
        sendMessage.enableHtml(true);
        String html = "<a href=\"https://www.carspecs.us/photos/c8447c97e355f462368178b3518367824a757327-2000.jpg\">&#8205;</a>";
        sendMessage.setText(html);
        executeAsync(message);

pom.xml

    <dependency>
        <groupId>org.telegram</groupId>
        <artifactId>telegrambots</artifactId>
        <version>5.3.0</version>
    </dependency>
leonaugust
  • 186
  • 1
  • 4
  • 15

0 Answers0