Skip to content

CallBackData button inline - Driver Telegram botman #1386

Open
@Raydelpq

Description

@Raydelpq
  • 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…

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions