Webhook 消息推送 #
Telegram #
POST #
获取 Telegram Bot 相关 chat_id
https://api.telegram.org/bot{token}/getUpdates
URL
https://api.telegram.org/bot{token}/
body
{
"method":"sendMessage",
"chat_id":{chat_id},
"text":"<Message Content>",
"parse_mode":"Markdown",
"disable_web_page_preview":true
}
Python #
安装 Python Telegram Bot API
pip install python-telegram-bot
发送信息
import telegram
def main():
# 代理请求
proxy = telegram.utils.request.Request(proxy_url='socks5://127.0.0.1:1080')
bot = telegram.Bot({token}, request=proxy)
bot.send_message(chat_id={chat_id}, text="<Message Content>")
if __name__ == '__main__':
main()
Lark #
URL
https://open.larksuite.com/open-apis/bot/v2/hook/{token}
head
Content-Type: application/json
body
text
{
"msg_type":"text",
"content":{
"text":"<Message Content>"
}
}
rich text
{
"msg_type": "post",
"content": {
"post": {
"zh-CN": {
"title": "<Title>",
"content": [
[
{
"tag": "text",
"text": "<Text Content>"
},
{
"tag": "a",
"text": "<Text Content>",
"href": "<URL>"
}
]
]
}
}
}
}
curl
curl -X POST -H "Content-Type: application/json" \
-d '{"msg_type":"text","content":{"text":"<Message Content>"}}' \
https://open.larksuite.com/open-apis/bot/v2/hook/{token}
Dingtalk #
URL
https://oapi.dingtalk.com/robot/send?access_token={token}
head
Content-Type: application/json;charset=utf-8
body
{
"msgtype":"text",
"text":{
"content":"Message Content"
}
}