C
C
cannabioid13372021-03-11 19:25:27
PHP
cannabioid1337, 2021-03-11 19:25:27

How to make buttons under the message in telegram?

function message_to_telegram($message)
  {
   global $tg_token;
   global $encodedMarkup;
    $ch = curl_init();
    curl_setopt_array(
      $ch,
      array(
        CURLOPT_URL => 'https://api.telegram.org/bot' . $tg_token . '/sendMessage',
        CURLOPT_POST => TRUE,
        CURLOPT_RETURNTRANSFER => TRUE,
        CURLOPT_TIMEOUT => 10,
        CURLOPT_POSTFIELDS => array(
          'chat_id' => "-540033367",
          'text' => $message,
          'InlineMarkup' => $encodedMarkup,
          'parse_mode' => 'Markdown',             
        ),
      )
    );
    curl_exec($ch);
  }
  $replyMarkup = array(
    'keyboard' => array(
        array("Одобрено", "не Одобрено")
    )
);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
Timur Boyko, 2021-03-11
@klardak

Instead of "InlineMarkup" you need "reply_markup". The value is an array "inline_keyboard" with arrays of buttons.
More details here - https://core.telegram.org/bots/api#inlinekeyboardmarkup

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question