Skip to content

使用api发送Telegram消息

  1. 根据官方文档创建机器人,并记录机器人token
  2. 通过以下地址获取私聊或group的chat_id https://api.telegram.org/bot<token>/getUpdates
  3. 调用api发送消息 https://api.telegram.org/bot<token>/sendMessage?chat_id=xxxx&text=YourMessage

消息markdown格式

需加上参数parse_mode=Markdown

例如
https://api.telegram.org/xx/sendMessage?chat_id=${chat_id}&text=${param}&parse_mode=Markdown

@某人
@Hanyi 或 @账号

换行 %0A
加粗 **

注:文本内容中含_字符时报错,需要转义下