Telegram-bot-sdk: Inline keyboard

Created on 11 Mar 2018  ·  4Comments  ·  Source: irazasyed/telegram-bot-sdk

Hey. Could you help me. I'm trying add inline button with URL to message. In client button dosn't show. Why ?

 $keyboard = Keyboard::make()
              ->inline()
              ->row(
                  Keyboard::inlineButton(['text' => 'Test', 'url' => 'https://www.google.com'])
              );

            $response = Telegram::sendMessage([
              'chat_id' => '-XXXXXXXX',
              'text' => 'To ticket № '. $comment->ticket_id .' added comment',
              'reply_markup' => $keyboard
            ]);

Most helpful comment

Hey. Could you help me. I'm trying add inline button with URL to message. In client button dosn't show. Why ?

 $keyboard = Keyboard::make()
              ->inline()
              ->row(
                  Keyboard::inlineButton(['text' => 'Test', 'url' => 'https://www.google.com'])
              );

            $response = Telegram::sendMessage([
              'chat_id' => '-XXXXXXXX',
              'text' => 'To ticket № '. $comment->ticket_id .' added comment',
              'reply_markup' => $keyboard
            ]);
$url_arr[0]['text']='Text URL';
$url_arr[0]['url']='https://www.google.com';

$telegram_user = \Telegram::getWebhookUpdates()['message'];

$response = \Telegram::sendMessage([
            'chat_id' => $telegram_user['from']['id'], 
            'text' => 'Test text:',
            'parse_mode'=>'html',
            'reply_markup'=>json_encode(['inline_keyboard'=>array($url_arr)])
        ]);

All 4 comments

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

To help make it easier for us to investigate your issue, please follow the contributing guidelines.

Hey. Could you help me. I'm trying add inline button with URL to message. In client button dosn't show. Why ?

 $keyboard = Keyboard::make()
              ->inline()
              ->row(
                  Keyboard::inlineButton(['text' => 'Test', 'url' => 'https://www.google.com'])
              );

            $response = Telegram::sendMessage([
              'chat_id' => '-XXXXXXXX',
              'text' => 'To ticket № '. $comment->ticket_id .' added comment',
              'reply_markup' => $keyboard
            ]);
$url_arr[0]['text']='Text URL';
$url_arr[0]['url']='https://www.google.com';

$telegram_user = \Telegram::getWebhookUpdates()['message'];

$response = \Telegram::sendMessage([
            'chat_id' => $telegram_user['from']['id'], 
            'text' => 'Test text:',
            'parse_mode'=>'html',
            'reply_markup'=>json_encode(['inline_keyboard'=>array($url_arr)])
        ]);

how get $url_arr[0]['callback_query'] value ?

@CORPARU Thanks! I attach an example with callback data I did based in your solution. Thanks!! :)

    $url_arr[0]['text']='message to show';
    $url_arr[0]['callback_data']='code_to_send';


    $response = $telegram->sendMessage([
        'chat_id' => $chatId, 
        'text' => $message,
        'reply_markup' => json_encode(['inline_keyboard'=>array($url_arr)])
      ]);
Was this page helpful?
0 / 5 - 0 ratings

Related issues

maminbajand picture maminbajand  ·  4Comments

iMohammadd picture iMohammadd  ·  3Comments

Visionary89 picture Visionary89  ·  5Comments

nanangkoesharwanto picture nanangkoesharwanto  ·  3Comments

danilopinotti picture danilopinotti  ·  3Comments