Send bot messages from php codeigniter to telegram
Step 1:Search "botfather" in telegram and enter it
Step 3:So it will ask bot name type the bot name (eg:"telegram_bot_message") after that it will ask username of bot it should end with _bot eg:example_php_tele_bot, after that it will give you the bot token as like below
Step 4:Search the bot username and enter it and add the bot into your group
Step 5:Enter /start that group and HIT this url
https://api.telegram.org/bot<bot_token>/getUpdates
bot_token which we git while creating the bot
In that URL you will find the group chat_id note that too..
Step 6:Get the lib telegram in the location "telegram_bot_message/application/libraries/"
and get the config file "telegram.php" from the location "telegram_bot_message/application/config/"
and place into your codeigniter setup and autoload the lib in autoload.php in config folder
Step 7:Config the bot_token and chat_id in telegram config file
chat_id will your group id or any user id in that JSON image
Step 8:Start use the below lib functions in all your controller
- $this->telegram_lib->sendmsg("test")
- $this->telegram_lib->sendlocation("12.114","72.100")@lat,@long
- $this->telegram_lib->sendimg("/path/to/img","img caption")@img path,@caption=optional
- $this->telegram_lib->sendaudio("/path/to/audio","audio caption")@audio path,@caption=optional
- $this->telegram_lib->senddoc("/path/to/doc","doc caption")@doc path,@caption=optional
- $this->telegram_lib->sendvenue("12.114","72.100","title","address")@lat,@long,@title,@address
- $this->telegram_lib->sendcontact("9874651230","first name","last name")@phone,@first_name,@last_name=optional
it works!!!!!!
Thank you,
Prasaath V
ZcodiaTech