Attach keyboard to html chat #460
Unanswered
christogonus
asked this question in
Q&A
Replies: 2 comments
-
Same problem |
Beta Was this translation helpful? Give feedback.
0 replies
-
This code is working: Telegraph::html('test message')
->keyboard(
\DefStudio\Telegraph\Keyboard\Keyboard::make()->buttons([
\DefStudio\Telegraph\Keyboard\Button::make('Delete')->action('delete')->param('id', 42),
\DefStudio\Telegraph\Keyboard\Button::make('Open')->url('https://test.it'),
\DefStudio\Telegraph\Keyboard\Button::make('Login Url')->loginUrl('https://loginUrl.test.it'),
])
)
->send()->dump(); the warn your button's URLs should be valid URLs, otherwise you'll obtain a 400 BOT_DOMAIN_INVALID error |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In a custom webhook response to command /start, I want to have a keyboard on the chat, like below
$this->chat->html($message) ->keyboard(Keyboard::make()->buttons([ Button::make('Delete')->action('delete')->param('id', '42'), Button::make('open')->url('https://test.it'), Button::make('Web App')->webApp('https://web-app.test.it'), Button::make('Login Url')->loginUrl('https://loginUrl.test.it'), ]))->send();
I have imported the classes as well,
use DefStudio\Telegraph\Keyboard\Button; use DefStudio\Telegraph\Keyboard\Keyboard;
But I get response as below
[2023-11-01 06:25:17] local.ERROR: Class "App\Services\Keyboard" not found {"exception":"[object] (Error(code: 0): Class \"App\\Services\\Keyboard\" not found at /home/spatryoc/tg.spatryoc.net/app/Services/CustomWebhookHandler.php:45)
I tried the following:
but none of those helped me get desired result, which is to post html content with keyboard actions.
When I remove the ->keyboard() part, the chat responds to command.
How can I get this work with ->keyboard()?
Beta Was this translation helpful? Give feedback.
All reactions