0

I'm using this and works. But how to put a button blew the message? I tried a lot and still got no idea.

Sorry i forgot to tell it's about Telegram bot api. I want to send a message with button blew.

function sendadmin(){
    if [ "$admin_id" -ne "$chat_id" ]; then
        curl -s \
        -d parse_mode="MarkdownV2" \
        -d text="$stext" \
        -d chat_id="$admin_id" \
        -d -sendChatAction="videos" \
        -d reply_markup="" \
        https://api.telegram.org/bot$bot_token/sendMessage
    fi
}

stext="||Hello darling||"
sendadmin

I tried solution of this. And it's return Bad Request: can't parse reply keyboard markup JSON object error.

Luca Kiebel
  • 9,790
  • 7
  • 29
  • 44
叶诗剑
  • 9
  • 4
  • In order to put a button you would need to use a GUI generating library – Vulwsztyn Feb 22 '22 at 13:53
  • 1
    Does this answer your question? [How to show a GUI message box from a bash script in linux?](https://stackoverflow.com/questions/7035/how-to-show-a-gui-message-box-from-a-bash-script-in-linux) – Nic3500 Feb 22 '22 at 13:58
  • Does this answer your question? [How to send a message via url with inline buttons](https://stackoverflow.com/questions/70997956/how-to-send-a-message-via-url-with-inline-buttons) – Ali Padida Feb 22 '22 at 16:49
  • This would help you: https://stackoverflow.com/questions/70997956/how-to-send-a-message-via-url-with-inline-buttons/71005858#71005858 – Ali Padida Feb 22 '22 at 16:49
  • Please don't add an answer to your question by editing it in. If your question has been solved by an answer, you can accept it, if you solved the problem yourself you can [write your own answer](https://stackoverflow.com/help/self-answer) and accept that. – Luca Kiebel Feb 23 '22 at 09:06

1 Answers1

0
reply=$(cat <<-EOF
{
    "inline_keyboard": [
        [
            {
                "text": "Button1",
                "callback_data": "lt"
            },
            {
                "text": "Button1",
                "callback_data": "rt"
            }
        ],
        [
            {
                "text": "Button3",
                "callback_data": "ls"
            }
        ]
    ]
}
EOF
)

Using car <<EOF EOF to give that json format to a variable and then use it like reply_markup="$reply" . I just found out this way.

叶诗剑
  • 9
  • 4