Webhook 消息推送

Webhook 消息推送 #

## Telegram ### POST > https://core.telegram.org/bots/api#sendmessage 获取 Telegram Bot 相关 `chat_id` ``` https://api.telegram.org/bot{token}/getUpdates ``` URL ``` https://api.telegram.org/bot{token}/ ``` body ``` json { "method":"sendMessage", "chat_id":{chat_id}, "text":"", "parse_mode":"Markdown", "disable_web_page_preview":true } ``` ### Python > https://python-telegram-bot.org/ 安装 Python Telegram Bot API ``` console pip install python-telegram-bot ``` 发送信息 ``` python 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="") if __name__ == '__main__': main() ```
## Lark > [https://open.larksuite.com/document/](https://open.larksuite.com/document/uAjLw4CM/ukTMukTMukTM/bot-v3/use-custom-bots-in-a-group) URL ``` https://open.larksuite.com/open-apis/bot/v2/hook/{token} ``` head ``` Content-Type: application/json ``` body *text* ``` json { "msg_type":"text", "content":{ "text":"" } } ``` *rich text* ``` json { "msg_type": "post", "content": { "post": { "zh-CN": { "title": "", "content": [ [ { "tag": "text", "text": "<Text Content>" }, { "tag": "a", "text": "<Text Content>", "href": "<URL>" } ] ] } } } } ``` curl ``` console 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}​ ``` </div> <input type="radio" class="toggle" name="tabs-0" id="tabs-0-2" /> <label for="tabs-0-2">Dingtalk</label> <div class="book-tabs-content markdown-inner"> ## Dingtalk > https://www.dingtalk.com/qidian/help-detail-20781541.html URL ``` https://oapi.dingtalk.com/robot/send?access_token={token} ``` head ``` Content-Type: application/json;charset=utf-8 ``` body ``` json { "msgtype":"text", "text":{ "content":"Message Content" } } ``` </div> </div> </article> <footer class="book-footer"> <div class="flex flex-wrap justify-between"> <div><a class="flex align-center" href="https://github.com/Monopink/Strange-Book/commit/cc866cf9bf6e9084ed368eae3fc842e0ddbe4aba" title='Last modified by Monopink | December 20, 2024' target="_blank" rel="noopener"> <img src="/svg/calendar.svg" class="book-icon" alt="" /> <span>December 20, 2024</span> </a> </div> <div> <a class="flex align-center" href="https://github.com/Monopink/Strange-Book/blob/master/content.zh/note/webhook%20push.md" target="_blank" rel="noopener"> <img src="/svg/edit.svg" class="book-icon" alt="" /> <span>Edit this page</span> </a> </div> </div> </footer> <div class="book-comments"> </div> <label for="close-control" class="hidden book-menu-overlay"></label> <label for="close-control" class="hidden book-toc-overlay"></label> </div> <aside class="book-toc"> <div class="book-toc-content"> <nav id="TableOfContents"> <ul> <li><a href="#webhook-消息推送">Webhook 消息推送</a></li> </ul> </nav> </div> </aside> </main> </body> <script src="https://cdn.jsdelivr.net/npm/@docsearch/js@3"></script> <script type="text/javascript"> docsearch({ appId: "TR1JS5XUQQ", apiKey: "65b41088a6c64941a701a3170fee3899", indexName: "jhcom", insights: true , container: "#docsearch", debug: true }); </script> </html>