Closed niulinlnc closed 5 years ago
以下代码有误,根据钉钉对该接口的规定,dept_id_list 与 userid_list 可不传,若传不能为空: 文档链接:https://open-doc.dingtalk.com/microapp/serverapi2/pgoxpy def asyncsend(self, msg_body, agent_id, userid_list=(), dept_id_list=(), to_all_user=False): """ 企业会话消息异步发送
:param msg_body: BodyBase 消息体 :param agent_id: 微应用的id :param userid_list: 接收者的用户userid列表 :param dept_id_list: 接收者的部门id列表 :param to_all_user: 是否发送给企业全部用户 :return: 任务id """ userid_list = ",".join(map(to_text, userid_list)) dept_id_list = ",".join(map(to_text, dept_id_list)) if isinstance(msg_body, BodyBase): msg_body = msg_body.get_dict() msgtype = msg_body['msgtype'] msgcontent = json.dumps(msg_body[msgtype]) return self._top_request( 'dingtalk.corp.message.corpconversation.asyncsend', { 'msgtype': msgtype, 'agent_id': agent_id, 'msgcontent': msgcontent, 'userid_list': userid_list, 'dept_id_list': dept_id_list, 'to_all_user': to_all_user }, result_processor=lambda x: x['task_id'] )
所以给dept_id_list=()会报错
我也遇到了这个问题,代码该更新了
以下代码有误,根据钉钉对该接口的规定,dept_id_list 与 userid_list 可不传,若传不能为空: 文档链接:https://open-doc.dingtalk.com/microapp/serverapi2/pgoxpy def asyncsend(self, msg_body, agent_id, userid_list=(), dept_id_list=(), to_all_user=False): """ 企业会话消息异步发送
所以给dept_id_list=()会报错