"How to send welcome greetings message using Bot, in Telegram"? Acctually i create new bot in telegram. and now i want , when new user start my bot, my bot send him Welcome greetings message? is it possible with "getupdates" method or i should use "webhooks" for it? pls guide me.
I have create one bot like @mak_tech_bot. and join it with my other telegram accout, but it not send any welcome message. i have also use /command.
I also tried one example in localhost
<?php
ini_set('error_reporting',E_ALL);
$botToken = "TOKEN";
$website = "https://api.telegram.org/bot".$botToken;
$update = file_get_contents('php://input');
$update = json_decode($update,TRUE);
$chatId = $update["message"]["chat"]["id"];
$message = $update["message"]["text"];
switch($message){
case "/test":
sendMessage($chatId,"test123");
break;
case "/hi":
sendMessage($chatId,"Hello123");
break;
default:
sendMessage($chatId,"default");
}
function sendMessage($chatId,$message){
$url = $GLOBALS[website]."/sendMessage?chat_id=".$chatId."$text=".urlencode($message);
file_get_contents($url);
}
?>
When you click
START
button, you will send/start
command to bot, just addcase '/start':
to your code to send greeting message.