php - How to use TYPEs in Telegram Bot API? -


i'm new telegram bot. know how use methods send message or others file_get_contents method in php or curl, don't know enough types. although read in telegram page, misunderstood. don't know how use types in bot. want create keyboard bot, think when use curl, should send types parameters. wrote code below :

$params = array (     'chat_id' => $chatid,     'text' => 'hello !',     'replykeyboardmarkup' => array (         'keyboard' =>  array(array('hello', 'hi'))     ) ); 

it sends me message when use curl :

$curl = curl_init("https://api.telegram.org/bot".$apitoken."/sendmessage"); curl_setopt($curl, curlopt_header, true); curl_setopt($curl, curlopt_returntransfer, 1); curl_setopt($curl, curlopt_post, 1); curl_setopt($curl, curlopt_postfields, ($params)); curl_setopt($curl, curlopt_ssl_verifypeer, false); curl_exec($curl); curl_close($curl); 

but doesn't show me keyboards ..., mistake ?

you need add key reply_markup format of replykeyboardmarkup

$replykeyboardmarkup = array(     "keyboard" => array(         array("1st row left", "1st row right"),          array("2nd row left", "2nd row right")     ) );  $params = array (     'chat_id' => $chatid,     'text' => 'hello !',     'reply_markup' => json_encode($replykeyboardmarkup) ); 

Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -