Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why telegram bot doesn't respond to messages in channel? #18

Closed
patzu opened this issue Jun 2, 2016 · 3 comments
Closed

Why telegram bot doesn't respond to messages in channel? #18

patzu opened this issue Jun 2, 2016 · 3 comments

Comments

@patzu
Copy link

patzu commented Jun 2, 2016

I have created a channel in telegram and I added a bot as an administrator of the channel, when I send a message to channel the bot doesn't answer, why?

I can send a message with /sendmessage

https://api.telegram.org/bot[key]/sendmessage?chat_id=@MyChannelID&text=This text is from bot to channel.

In the code below when I send a text " call " nothing happens.

<?php 

 include 'connection.php';
 include("Telegram.php");
 define('bot_id', 'key');
 $telegram = new Telegram(bot_id);

 $text = $telegram->Text();
 $chat_id = $telegram->ChatID();

 if ($text == "call") {
 $content = array('chat_id' => $chat_id, 'text' => "This is test     message!!!");
 $telegram->sendMessage($content);   
  }

 ?>

Thank you my friend for your patience in answering my questions.

@Eleirbag89
Copy link
Owner

for sending a message in a channel i use this:

if ($text == "/channel") {
    $reply = "Chat id " . $chat_id;
    $chat_id = "@testmiobot";
    $content = array('chat_id' => $chat_id, 'text' => $reply);
    $telegram->sendMessage($content);
}

BTW the bot don't respond to messages sended in a channel, could be a bug

@patzu
Copy link
Author

patzu commented Jun 2, 2016

Thanks, I tried a lot but no result,

I found a similar question here:
https://stackoverflow.com/questions/35022211/send-message-to-telegram-channel-by-bot

Do you know where should we use this code?

curl has this problem for SSL. add this code to Solve problem :
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);

@Eleirbag89
Copy link
Owner

Eleirbag89 commented Jun 2, 2016

it's already present.
You could try to log what telegram send to the bot when someone sends a message on the channel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants