This project is a DingTalk robot implemented using Python's aiohttp library.
- Asynchronous message handling
- Supports all message types
import asyncio
from dtalk_robot import Robot
from dtalk_robot.request import RequestBody, TextBody
from dtalk_robot.response import ResponseBody
async def send(request_body: RequestBody) -> ResponseBody:
async with Robot(access_token="access_token", secret="secret") as robot:
return await robot.send_message(request_body)
text_msg: RequestBody = RequestBody.text_message(text=TextBody(content="Hello World!"))
response = asyncio.run(send(text_msg))
print(f"response[code={response.errcode}]: {response.errmsg}")