Skip to main content

WeCom/Work WeChat API helpers (external contact, groupchat, etc.)

Project description

目录

版本更新

ver desc date
1.0.4 完成电子发票的接口 20210530
1.0.5 完成日历日程 20210702

计划

  • 完成客户联系、身份验证、应用管理等未完成模块
  • 补充单元测试覆盖
  • 提供更多使用示例与文档

pywxwork

  • python wxwork server api(企业微信自建应用服务端)
  • version==1.0.1

企微 python 接口

  • 写一个企微的 python 库,开箱即用。

  • 这个接口库完全用于企微的服务端接口。

  • 接口应当包括两部分

    • 直接调用企微的接口,这里做一个 pip 库上传到 pypi。
    • 用 fastapi 起服务,来做回调服务。
  • 企微接口地址

框架结构

接口

接口列表

status name mod_name
完成 通讯录管理 contact
未完成 客户联系 customer
未完成 身份验证
未完成 应用管理
完成 消息推送 message
完成 素材管理 media
部分完成 OA 日历,日程已完成
未完成 效率工具
未完成 企业支付
未完成 企业互联
未完成 会话内容存档
已完成 电子发票 invoice
未完成 家校沟通
未完成 家校应用
未完成 政民沟通
未完成 邮件 exmail

新版

状态 name mod_name
完成 通讯录管理 contact
未完成 客户联系 customer
未完成 身份验证
未完成 应用管理
完成 消息推送 message
完成 素材管理 media
部分完成 OA 日历,日程已完成
未完成 效率工具
未完成 企业支付
未完成 企业互联
未完成 会话内容存档
已完成 电子发票 invoice
未完成 家校沟通
未完成 家校应用
未完成 政民沟通
未完成 邮件 exmail

功能包括

  • 内部开发接口-服务端
    • 回调的事件
    • 主动查询接口
  • 第三方开发接口-服务端
  • 单元测试

how to use

install pywxwork

pip install pywxwork

get token

from pywxwork.token import token

corpid = "wxaadfasdfasdfasdfas"
corpsecret = "asdfasdfasdfasfasdfasdfasdf"

t = token(corpid=corpid, corpsecret=corpsecret)
t.token

get user list

from pywxwork.contact.user import user

u = user(token)
response = u.list(department_id=1, fetch_child=1)
user_list = response.get("userlist")
for row in user_list:
  print(row)

20240617 更新

新增获客链接接口封装:

  • customer_acquisition.list_link - 获取获客链接列表
  • customer_acquisition.get - 获取获客链接详情
  • customer_acquisition.create_link - 创建获客链接
  • customer_acquisition.update_link - 更新获客链接
  • customer_acquisition.delete_link - 删除获客链接
  • customer_acquisition_quota.get_quota - 查询剩余使用量
  • customer_acquisition_quota.statistic - 查询链接使用详情

接口文档参考: https://developer.work.weixin.qq.com/document/path/97297 https://developer.work.weixin.qq.com/document/path/97375

20240619 新增

新增客户群管理接口:

  • groupchat.list - 获取客户群列表
  • groupchat.get - 获取客户群详情
  • groupchat.add_join_way - 创建群链接
  • groupchat.get_join_way - 获取群链接详情
  • groupchat.update_join_way - 更新群链接
  • groupchat.del_join_way - 删除群链接

接口文档参考: https://developer.work.weixin.qq.com/document/path/92120

20240620 新增

新增欢迎语和群欢迎语接口:

  • customer.send_welcome_msg - 发送新客户欢迎语
  • group_welcome_template.add - 创建群欢迎语模板
  • group_welcome_template.edit - 编辑群欢迎语模板
  • group_welcome_template.get - 获取群欢迎语模板详情
  • group_welcome_template.delete - 删除群欢迎语模板

接口文档参考: https://developer.work.weixin.qq.com/document/path/92134

20240621 新增

新增客户和群聊继承接口:

  • customer.transfer_customer - 在职成员分配客户
  • customer.transfer_result - 查询客户分配结果
  • customer.resigned_transfer_customer - 离职成员客户继承
  • customer.resigned_transfer_result - 查询离职客户继承结果
  • groupchat.transfer - 离职成员群聊继承
  • groupchat.transfer_result - 查询群聊继承结果

接口文档参考: https://developer.work.weixin.qq.com/document/path/92125

20240622 新增

新增电子发票接口封装:

  • invoice.get_invoice_info - 查询单张电子发票
  • invoice.get_invoice_info_batch - 批量查询电子发票
  • invoice.update_invoice_status - 更新单张发票状态
  • invoice.update_invoice_status_batch - 批量更新发票状态

接口文档参考: https://developer.work.weixin.qq.com/document/path/90664

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pywxwork-1.0.18.tar.gz (24.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pywxwork-1.0.18-py3-none-any.whl (31.6 kB view details)

Uploaded Python 3

File details

Details for the file pywxwork-1.0.18.tar.gz.

File metadata

  • Download URL: pywxwork-1.0.18.tar.gz
  • Upload date:
  • Size: 24.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.12

File hashes

Hashes for pywxwork-1.0.18.tar.gz
Algorithm Hash digest
SHA256 9434abcf0f087c473273d3b9f2097fae42cd627641ad5dd5027b591c9d39f6c4
MD5 cbc637ebee10a3fe8b9bb36262c0fdd3
BLAKE2b-256 594edb2043d036b5550bea4aba50c29ec27e72d8c11c32c4bad5fdfa7fd722d6

See more details on using hashes here.

File details

Details for the file pywxwork-1.0.18-py3-none-any.whl.

File metadata

  • Download URL: pywxwork-1.0.18-py3-none-any.whl
  • Upload date:
  • Size: 31.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.12

File hashes

Hashes for pywxwork-1.0.18-py3-none-any.whl
Algorithm Hash digest
SHA256 da5ffcbfb7f5ee8ce5ed2b7a186d8f0b81fd61811f06d3dc2bec72e8d51e8647
MD5 0530d3e4930e0dad950d8f0a53940aea
BLAKE2b-256 4f9be88eef924e399ddf89d957337eb617b6c4ef0be69ee39fbbed6c2e2b8e86

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page