I also tested the way that explained in this link
https://www.botpress.org/docs/telegram/reply-markup-keyboard-inline-keyboard/
But it does not work for me!
Anyway I need to know how to use it in my custom plugin!
I’ve just changed your code like this!
function telegram_get_inline_keyboard_layout($template) {
//return (array)json_decode( $template );
return [[ [ ‘text’ => ‘Some button text 1’, ‘callback_data’ => ‘1’ ], [ ‘text’ => ‘Some button text 2’, ‘callback_data’ => ‘2’ ] ]];
}
and it worked for me! But when i used “return (array)json_decode( $template );”
with this sample:
“[[{“text”:”Text 1″,”callback_data”:”1″},{“text”:”Link 1″,”url”:”https://botpress.org”}],[{“text”:”Text2″,”callback_data”:”2″}]]”
nothing happened!
I test your sample code with ” instead of “
[[{“text”:”text 1″,”callback_data”:”1″},{“text”:”Some button text 2″,”url”:”https://botpress.org”},{“text”:”Some button text 3″,”callback_data”:”3″}]]
and its working now!
that was because of ” and “
your code is:
“[[{“text”:”Text 1″,”callback_data”:”1″},{“text”:”Link 1″,”url”:”https://botpress.org”}],[{“text”:”Text2″,”callback_data”:”2″}]]”
-
This reply was modified 9 years, 1 month ago by
AmirHossein.