对KeyboardButton电报机器人使用request_contact

时间:2016-06-14 12:26:06

标签: php telegram-bot

我试着通过这个php脚本将用户的电话号码保存在电报机器人中:

apiRequest("sendMessage", array(
    'chat_id' => $chat_id, 
    "text" => 'Ci vuoi inviare il tuo numero di telefono?', 
    'reply_markup' => array(
        'keyboard' => array(
            'text'=>"SHOW PHONE",
            'request_contact'=>true
        ),
        'one_time_keyboard' => true,
        'resize_keyboard' => true
    )
));

但它不起作用,可能是什么问题?

1 个答案:

答案 0 :(得分:8)

键盘必须是数组数组:

更新

apiRequest("sendMessage", array(
'chat_id' => $chat_id, 
"text" => 'Ci vuoi inviare il tuo numero di telefono?', 
'reply_markup' => array(
        'keyboard' => array(
                           array(
                                array( 
                                  'text'=>"SHOW PHONE",
                                  'request_contact'=>true
                                )
                             )
                      ),

    'one_time_keyboard' => true,
    'resize_keyboard' => true
)
));
相关问题