sendMessage to any bot user

 ̄綄美尐妖づ 提交于 2019-12-25 06:33:03

问题


I have a server bot (made with cronjobs and PHP): if a condition is met, the bot sends a mail containing a specific message. I noticed any person receiving the mail message has a Telegram account too. What I want to do is the following: I create a bot and, instead of sending mails, the bot posts the message users generally receive by mail.

I tried the following using the command line:

curl -s -X POST https://api.telegram.org/botToken/sendMessage -d text=”hello from the bot” -d chat_id=0000000

My bot receives the message but what I don't understand well is: will this message reach ANY other bot user?

Any suggestion is appreciated.

Thanks in advance


回答1:


due to Bots FAQ in telegram website :

How can I message all of my bot's subscribers at once?
Unfortunately, at this moment we don't have methods for sending bulk messages, e.g. notifications. We may add something along these lines in the future.




回答2:


sendMessage will send a message to a user specified by unique identifier chat_id.

Keep in mind that a bot can't initiate a conversation with a user. Users must contact a bot first in order to receive any messages by the bot.



来源:https://stackoverflow.com/questions/37388414/sendmessage-to-any-bot-user

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!