can't parse inline keyboard button: Field "text" must be of type String
Please @SpEcHIDe, Help me
Field "text" must be of type String in inline buttons
I think incorrect request, can you check your reply markup ? 🤔
See, I have method called GetButtons this code: $buttons = []; $i = 0; foreach ($this->Questions as $question) { array_push($buttons, [['text' => $question, 'callback_data' => "answer_$i"]]); $i++; } And this is the request $this->Bot->SendMessage([ 'chat_id' => $message->chat->id, 'text' => 'These are FAQ Questions, Choose one from these questions to get answer', 'reply_markup' => ['inline_keyboard' => $this->GetButtonsByPageID(0)] ]);
$question is not a string
This is questions: [ 'How are you' => 'I am good', 'What's your name' => 'blabla' ]
foreach ($this->Questions as $question) { array_push($buttons, ['text' => $question, 'callback_data' => "answer_$i"]); $i++; } Can you try ?
This error: Array to string conversion
GetButtonsByPageID(0) is not returning a string.
Should it return string?
I am not sure of the usage of the for loop, with multi dimensionnal arrays 🙊😅😅
sorry, I misread the code. anyways, you need to look at the raw output of your code. the text field is either not being filled in, or is being filled in with something that isn't a string
Para
Обсуждают сегодня