telegram-bot-sdk
telegram-bot-sdk copied to clipboard
Referral link /start and passing param
@irazasyed How can i create a Telegram Referral Link like t.me/abcdbot?start=123 and getting 123 value in the bot?! can we use Telegram deep links?
I think u cant, becouse the comand /start type only from app.
@irazasyed How can i create a Telegram Referral Link like t.me/abcdbot?start=123 and getting 123 value in the bot?! can we use Telegram deep links?
here is my working Laravel code example if anyone needs this: `<?php
namespace App\TelegramCommands;
use Telegram\Bot\Actions; use Telegram\Bot\Commands\Command;
class StartCommand extends Command {
/**
* Command name
*
* @var string
*/
protected $name = 'start';
/**
* Command description
*
* @var string
*/
protected $description = 'Your description';
/**
* Command arguments object decoding pattern (/start {variable}) that can be later accessed and processed
* This will work both with /start variable and https://t.me/your_bot?start=variable
*
* @var string
*/
protected $pattern = '{variable}';
/**
* Process command
*
* @return void
*/
public function handle()
{
//get arguments sent with command
$arguments = (object) $this->getArguments();
//check for arguments defined in $pattern
if (isset($arguments->variable)) {
Log::debug($arguments->variable)
} else {
Log::debug('no variable was passed')
}
}
}`