{"id":27584,"library":"alibabacloud-dingtalk","title":"Alibaba Cloud DingTalk SDK for Python","description":"Alibaba Cloud DingTalk SDK for Python provides APIs to integrate with DingTalk (DingDing) services, including authentication, messaging, and workflow automation. Current version 2.2.45, supports Python >=3.6. Released via PyPI with regular updates.","status":"active","version":"2.2.45","language":"python","source_language":"en","source_url":"https://github.com/aliyun/alibabacloud-sdk","tags":["dingtalk","dingding","alibaba","sdk","messaging"],"install":[{"cmd":"pip install alibabacloud-dingtalk","lang":"bash","label":"Install DingTalk SDK"}],"dependencies":[{"reason":"Required for authentication (AccessKey or STS token).","package":"alibabacloud_credentials","optional":false},{"reason":"Transport layer for API calls.","package":"alibabacloud_gateway_spi","optional":true}],"imports":[{"note":"Package renamed to avoid conflict with other DingTalk libraries","wrong":"from dingtalk import Client","symbol":"Client","correct":"from alibabacloud_dingtalk.client import Client"},{"note":"From DingTalk Robot API v1.0","symbol":"SendMessageRequest","correct":"from alibabacloud_dingtalk.robot_1_0 import SendMessageRequest"}],"quickstart":{"code":"import os\nfrom alibabacloud_dingtalk.client import Client\nfrom alibabacloud_dingtalk.robot_1_0 import SendMessageRequest\nfrom alibabacloud_tea_openapi.models import Config\n\nconfig = Config(\n    protocol='https',\n    access_key_id=os.environ.get('ALIBABA_CLOUD_ACCESS_KEY_ID', ''),\n    access_key_secret=os.environ.get('ALIBABA_CLOUD_ACCESS_KEY_SECRET', ''),\n    region_id='central'\n)\nclient = Client(config)\nreq = SendMessageRequest(\n    robot_code='your_robot_code',\n    open_ids=['user_id'],\n    msg_key='sampleText',\n    msg_param='{\"content\":\"Hello from SDK\"}'\n)\ntry:\n    resp = client.send_message_in_robot(req)\n    print(f'Response: {resp.body}')\nexcept Exception as e:\n    print(f'Error: {e}')","lang":"python","description":"Initialize DingTalk client with credentials and send a robot message."},"warnings":[{"fix":"Change import to `from alibabacloud_dingtalk.client import Client`","message":"Package renamed from `dingtalk` to `alibabacloud_dingtalk` in v1.x. Old imports break completely.","severity":"breaking","affected_versions":"<1.0.0"},{"fix":"Set `region_id='central'` in Config.","message":"Region ID must be set to 'central' for DingTalk API. Using 'cn-hangzhou' or other regions causes failures.","severity":"gotcha","affected_versions":"all"},{"fix":"Use `from alibabacloud_dingtalk.robot_1_0 import Client as RobotClient` and call `RobotClient(config).send_message(req)`.","message":"The `send_message_in_robot` method is deprecated in favor of `robot_1_0.Client.send_message` in newer versions.","severity":"deprecated","affected_versions":">=2.0.0"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Use `from alibabacloud_dingtalk.client import Client`","cause":"Incorrect import path; submodule not imported.","error":"AttributeError: module 'alibabacloud_dingtalk' has no attribute 'client'"},{"fix":"Set `ALIBABA_CLOUD_ACCESS_KEY_ID` and `ALIBABA_CLOUD_ACCESS_KEY_SECRET` with valid credentials.","cause":"Missing or incorrect environment variables for credentials.","error":"AuthenticationError: invalid access key id"},{"fix":"Add `region_id='central'` to Config.","cause":"Config object missing region_id parameter.","error":"TypeError: __init__() missing required positional argument: 'region_id'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}