如何将参数传递给webhook telegram bot PHP

时间:2016-06-16 13:38:46

标签: php telegram-bot

是否可以使用sendMessage方法将其他变量发送到webhook?

例如设置todo变量:

function processMessage($message) {
  // process incoming message
  $message_id = $message['message_id'];
  $azione = $message['todo'];
  $chat_id = $message['chat']['id'];
  $firstname = isset($message['chat']['first_name']) ? $message['chat']['first_name'] : "";
  $lastname = isset($message['chat']['last_name']) ? $message['chat']['last_name'] : "";

  if (isset($message['text'])) {
    $text = $message['text'];
    if (strpos($text, "/start") === 0) {
    apiRequestJson("sendMessage", array('chat_id' => $chat_id, "text" => 'Benvenuto '.$firstname.' '.$lastname.' sul BOT di MIMANCHITU, dimmi cosa vuoi fare ['.$azione.']?', 'todo' => "fai qualcosa", 'reply_markup' => array(
        'keyboard' => array(array('/consulta', '/guide')),
        'one_time_keyboard' => true,
        'resize_keyboard' => true)));
    } 
}

1 个答案:

答案 0 :(得分:0)

除了文档中定义的内容之外,您不能发送任何其他变量。