1. Go to this page and download the library: Download 3neti/messaging-bot library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
3neti / messaging-bot example snippets
use LBHurtado\MessagingBot\Drivers\Telegram\TelegramDriver;
$driver = app(TelegramDriver::class);
$driver->setWebhook('https://yourdomain.com/messaging/telegram/webhook');
namespace LBHurtado\MessagingBot\Handlers;
use LBHurtado\MessagingBot\Data\NormalizedResponse;
use LBHurtado\MessagingBot\Data\NormalizedUpdate;
class MyHandler extends BaseMessagingHandler
{
protected function process(NormalizedUpdate $update): NormalizedResponse
{
return NormalizedResponse::text('Hello from MyHandler!');
}
// Optional:
bash
# Simulate a message
php artisan test:messaging "/redeem"
# Continue the conversation
php artisan test:messaging "VOUCHER-CODE"
# Simulate contact sharing (phone number)
php artisan test:messaging "" --contact
# Test deep link (as if user clicked t.me/bot?start=redeem_CODE)
php artisan test:messaging "/start redeem_ABCD"
# Use different chat ID (for separate conversation state)
php artisan test:messaging "/redeem" --chat-id=99999
# Specify mobile number for contact sharing
php artisan test:messaging "" --contact --mobile=09181234567
bash
php artisan messaging:poll
bash
# Test the full redemption flow
php artisan cache:clear
php artisan test:messaging "/start redeem_VOUCHER-CODE"
php artisan test:messaging "" --contact
php artisan test:messaging "accept"
# Test returning user (with cached phone)
php artisan tinker --execute="Cache::put('messaging:phone:12345', '+639173011987', now()->addDays(30));"
php artisan test:messaging "/start redeem_ANOTHER-CODE"
php artisan test:messaging "accept"
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.