Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working callback_data in menu #104

Open
falur opened this issue Jun 10, 2022 · 3 comments
Open

Not working callback_data in menu #104

falur opened this issue Jun 10, 2022 · 3 comments

Comments

@falur
Copy link

falur commented Jun 10, 2022

  • BotMan Version: 2.0.0
  • PHP Version: 8.0.17
  • Messaging Service(s): Telegram
  • Cache Driver: Laravel

Description:

Not working callback_data
bot sends text

Steps To Reproduce:

$bot->reply(
    "👉🏼 Menu👇🏽",
    [
            'reply_markup' => json_encode([
                'keyboard' => [
                    [
                        [
                            'text' => 'Фотогалерея 🖼',
                            'callback_data' => '/photos',
                        ],
                        [
                            'text' => 'Планировки 📐',
                            'callback_data' => 'plans',
                        ],
                    ],
                    [
                        [
                            'text' => 'Характеристики ЖК 🏣',
                            'callback_data' => 'characteristics',
                        ],
                        [
                            'text' => 'Расположение ⛳️',
                            'callback_data' => 'place',
                        ],
                    ],
                    [
                        [
                            'text' => "Скачать прайс  ₽",
                            'callback_data' => 'price',
                        ],
                        [
                            'text' => 'Записаться на показ 📞',
                            'callback_data' => 'write-on-show',
                        ],
                    ],
                    [
                        [
                            'text' => 'Получить консультацию 📞',
                            'callback_data' => 'consultation',
                        ],
                        [
                            'text' => 'Акции  %',
                            'callback_data' => 'sales',
                        ],
                    ],
                ],
            ]),
        ]
 )```
@Darkrogua
Copy link

faced the same problem did you find a solution?

@falur
Copy link
Author

falur commented Sep 8, 2023

I did not find solution (

@antimech
Copy link
Contributor

antimech commented Oct 27, 2023

Learn the difference between the two types of Telegram Bot Keyboards:
https://core.telegram.org/bots/api#keyboardbutton
https://core.telegram.org/bots/api#inlinekeyboardbutton

What you want is probably to replace 'keyboard' with 'inline_keyboard'.
If not, then delete 'callback_data' and catch the 'text' with $botman->hears('Фотогалерея 🖼') at the webhook. In case you use Laravel it's a good idea to use the internal __('') method to avoid text duplication.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants