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

CallBackData button inline - Driver Telegram botman #1386

Open
Raydelpq opened this issue Oct 12, 2023 · 0 comments
Open

CallBackData button inline - Driver Telegram botman #1386

Raydelpq opened this issue Oct 12, 2023 · 0 comments

Comments

@Raydelpq
Copy link

  • BotMan Version: 2.8
  • PHP Version: 8.1.23
  • Messaging Service(s): Telegram
  • Telegram Driver: 2.0

Description:

Greetings everyone, I have the following problem. I am using botman with the telegram driver. I have created a conversation that allows users in a group to request a ride. For this I want to use buttons in lines. The button is sent correctly, the problem is when you click on it, it is as if it did not send the callback and does nothing. Can you help me with this issue?

`<?php

namespace App\Http\Conversation;

use BotMan\BotMan\Messages\Incoming\Answer;
use BotMan\BotMan\Messages\Outgoing\Question;
use BotMan\BotMan\Messages\Outgoing\Actions\Button;
use BotMan\BotMan\Messages\Conversations\Conversation;
use BotMan\Drivers\Telegram\Extensions\KeyboardButton;

class SolicitarViaje extends Conversation
{

public function askSolicitarViaje()
{
$question = Question::create('Todos los datos del viaje')
->fallback('unknow')
->callbackId('solicitud_viaje')
->addButtons([
Button::create('La Quiero')->value('yo'),
]);

    $this->ask($question, function (Answer $answer) {
        // Detect if button was clicked:
        if ($answer->isInteractiveMessageReply()) {
            $selectedValue = $answer->getValue(); // will be either 'yes' or 'no'
            $selectedText = $answer->getText(); // will be either 'Of course' or 'Hell no!'
            $this->say('Captura: '.$selectedValue.' -- '.$selectedText);
        }
    });
}

public function run()
{
    // This will be called immediately
    $this->askSolicitarViaje();
}

}`

Steps To Reproduce:

Uploading Captura de pantalla 2023-10-11 220045.png…

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

1 participant