应用配置到「客户联系 可调用接口的应用」中。调用接口返回 api forbidden,错误码48002。
代码源码:
url = f"https://qyapi.weixin.qq.com/cgi-bin/externalcontact/message/send?access_token={access_token}"
payload = {
"touser": external_userid,
"msgtype": "text",
"agentid": AGENT_ID,
"text": {"content": content}
}
response = requests.post(url, data=json.dumps(payload))
