Skip to content

prasaath6/telegram_bot_message_with_php_codeigniter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

telegram_bot_message

Send bot messages from php codeigniter to telegram

Step 1:Search "botfather" in telegram and enter it

Step 2:Send message "/newbot" alt text

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 image

Step 4:Search the bot username and enter it and add the bot into your group image

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.. image

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

$autoload['libraries'] = array("telegram/telegram_lib");

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

$config['bot_token'] = 'BOT_TOKEN';

$config['chat_id'] = 'CHAT_ID';

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!!!!!!

image


Thank you,
Prasaath V
ZcodiaTech

About

Send bot messages from php codeigniter to telegram

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages