{"id":24502553,"url":"https://github.com/zxj17815/wechatwork-tool","last_synced_at":"2026-05-17T15:32:42.157Z","repository":{"id":57422653,"uuid":"282820462","full_name":"zxj17815/wechatwork-tool","owner":"zxj17815","description":"Django module for quick access and development of WeChatWork","archived":false,"fork":false,"pushed_at":"2020-10-27T05:25:30.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-26T07:43:45.289Z","etag":null,"topics":["django","wechatwork"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zxj17815.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-07-27T07:06:45.000Z","updated_at":"2020-10-27T05:25:33.000Z","dependencies_parsed_at":"2022-09-10T21:31:41.097Z","dependency_job_id":null,"html_url":"https://github.com/zxj17815/wechatwork-tool","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/zxj17815/wechatwork-tool","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zxj17815%2Fwechatwork-tool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zxj17815%2Fwechatwork-tool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zxj17815%2Fwechatwork-tool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zxj17815%2Fwechatwork-tool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zxj17815","download_url":"https://codeload.github.com/zxj17815/wechatwork-tool/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zxj17815%2Fwechatwork-tool/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267341702,"owners_count":24071765,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-27T02:00:11.917Z","response_time":82,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["django","wechatwork"],"created_at":"2025-01-21T23:12:23.208Z","updated_at":"2025-10-13T03:19:18.169Z","avatar_url":"https://github.com/zxj17815.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"#### WeChatWorkTool\nWechatworktool is a Django app,which is used to facilitate the internal application development of enterprise wechat and call enterprise wechat interface faster\n#### Quick start\nInstall `pip install django-wechatwork-tool`\n1. Add \"WeChatWorkTool\" to your INSTALLED_APPS setting like this:\n    ```python \n    # setting.py\n    INSTALLED_APPS = [\n        ...\n        'WeChatWorkTool',\n        ...\n    ]\n    ```\n2. Run python manage.py migrate to create the AccessToken models.\n3. Start the development server and visit http://127.0.0.1:8000/admin/ to create a AccessToken (need WeChatWork's corpid and an app secret of WeChatWork)\n4. Call where needed:\n    ```python\n    ...\n    from WeChatWorkTool import tool\n    ...\n    app=tool.CorpApp('sap')\n    print(app.app_info())\n    # Details of WeChatWork internal applications\n    print(app.get_user('FS0397'))\n    # Get employee details through employee ID\n    ```\n5. Application verification and callback example\n    ```python\n    import json\n    from django.http import HttpResponse\n    from django.views.decorators.csrf import csrf_exempt\n    \n    from WeChatWorkTool import tool\n    \n    \n    @csrf_exempt\n    def call_back(request):\n        \"\"\"WeChatWork messqge callback Simple Example\"\"\"\n        if request.method == 'GET':\n            # Authentication  url\n            data = request.GET.dict()\n            return HttpResponse(tool.call_back_verify(data, 'sap'))\n    \n        if request.method == 'POST':\n            url_data = request.GET.dict()\n            cb = tool.CorpApp('sap').call_back_data(url_data, request.body)\n            return HttpResponse(json.dumps(cb), content_type=\"application/json\")\n    ```\n   \n#### WeChatWorkTool\nCorpApp: WeChatWorks custom application\n```python\ndef app_info(self):\n    \"\"\"\n    get this app info\n    :return: App Info\n    \"\"\"\n\ndef get_userid_by_code(self, code):\n    \"\"\"get userid by code，It's just for webpage authorization link\n\n    :param code: in webpage authorization link\n    :return:UserId\n    \"\"\"\n\ndef get_user(self, userid):\n    \"\"\"get user info\n\n    :param userid: WeChatWork user's id\n    :return: a dict that user info\n    \"\"\"\n\ndef get_user_tag_list(self):\n    \"\"\"get user tag list\n\n    :return: user tag list\n    \"\"\"\n\ndef get_department_user_simplelist(self, department_id, fetch_child=False):\n    \"\"\"get user simplelist by department id\n\n    :param department_id:\n    :param fetch_child:\n    :return\n        For success example:\n            {\n                \"errcode\" : 0,\n                \"errmsg\" : \"ok\",\n                \"invaliduser\" :\"\",\n                \"invalidparty\" : \"\",\n                \"invalidtag\": \"\"\n            }\n\n        For error example:\n            {\n                \"errcode\" : 0,\n                \"errmsg\" : \"ok\",\n                \"invaliduser\" : [userid1,userid2],\n                \"invalidparty\" : [partyid1,partyid2],\n                \"invalidtag\": [tagid1,tagid2]\n            }\n    \"\"\"\n\ndef get_department_user_list(self, department_id, fetch_child=False):\n    \"\"\"get user list by department id\n\n    :param department_id:\n    :param fetch_child:\n    :return:\n    \"\"\"\n\ndef get_department(self, id):\n    \"\"\"get department info list\n\n    :param id: WeChatWork department's id\n    :return:\n    \"\"\"\n\ndef SendMsg(self, msgobj, touser: list = [], toparty: list = [], totag: list = [],\n            safe=0, enable_id_trans=0,\n            enable_duplicate_check=0,\n            duplicate_check_interval=1800):\n    \"\"\"\n\n    :param touser:\n    :param toparty:\n    :param totag:\n    :param msgobj:\n    :param safe:\n    :param enable_id_trans:\n    :param enable_duplicate_check:\n    :param duplicate_check_interval:\n    :return:\n    \"\"\"\n```\n#### Massage object\nThe message type corresponds to the message type of WeChatWork\n1. TextMessageObject\n2. MediaMessageObject\n3. TextCardMessageObject \n4. NewsMessageObject\n5. MarkDownMessageObject\n6. TaskCardBtnTemplate\n7. TaskCardMessageObject\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzxj17815%2Fwechatwork-tool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzxj17815%2Fwechatwork-tool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzxj17815%2Fwechatwork-tool/lists"}