DigitalXP
DigitalXP

Reputation: 179

Use request_contact for KeyboardButton telegram Bot

I'm tryng to keep phonenumber of user in a telegram bot with this php script:

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
    )
));

But it is not working, what could be the problem?

Upvotes: 4

Views: 10581

Answers (1)

ariaby
ariaby

Reputation: 902

Keyboard must be array of arrays:

Update:

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
)
));

Upvotes: 11

Related Questions