Skip to content
Advertisement

Can text in telegram bot’s text works as Html attribute?

if (update.getMessage().getText().equalsIgnoreCase("/register")) {
                    try {
                        SendMessage sendMessage = new SendMessage();
                        sendMessage.setChatId(update.getMessage().getChatId().toString());
                        sendMessage.setReplyToMessageId(update.getMessage().getMessageId());
                        sendMessage.setText("Press <a href="https://sso.***.com/account/register">" +
                                "HERE</a> to register");
                        execute(sendMessage);
                    } catch (TelegramApiException e) {
                        e.printStackTrace();
                    }
                }

I am trying to add Html button to SendMessage.setText, but this not work. Did i do it wrong somewhere?

Advertisement

Answer

Your question isn’t clear at all. But i think you can add:

sendMessage.enableHtml(true);

You can check Tabnine

Advertisement