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

How to get or read messages send by user? #23

Open
yogeshgalav opened this issue May 15, 2024 · 1 comment
Open

How to get or read messages send by user? #23

yogeshgalav opened this issue May 15, 2024 · 1 comment

Comments

@yogeshgalav
Copy link

I cannot find method or way from which I can get messages send by user in chat or group?
Is it even possible?
if yes can you provide me an example?

@Mirmuxsin
Copy link
Owner

write any route which accepts webhooks from telegram. For example, lets create route 'bot' inside api.php and use FSM:

use Milly\Laragram\FSM\FSM;

Route::post('/bot', function () {
    FSM::route('', function (Message $message) {
        Laragram::sendMessage(
            $message->chat->id,
            null,
            "Your message is: ".$message->text;
        );
    });
}

set your telegram bot webhook to yoursite.com/api/bot and thats it. Bot will reply you with message that you sent

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

2 participants