欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 房产 > 建筑 > 微信公众号接入通义千问回复

微信公众号接入通义千问回复

2026/4/9 18:33:38 来源:https://blog.csdn.net/m0_57057282/article/details/142960437  浏览:    关键词:微信公众号接入通义千问回复

10分钟让微信公众号成为智能客服_大模型服务平台百炼(Model Studio)-阿里云帮助中心
步骤很详细,一步一步的走就行,难的是个人服务器部署,响应token
这里我用的是flask框架,代码如下
 

from flask import Flask, request
import hashlibapp = Flask(__name__)# Token used for verification
TOKEN = "cxh"def sha1_hash(data):"""Generates SHA1 hash of the given data."""return hashlib.sha1(data.encode('utf-8')).hexdigest()@app.route('/checkUrl', methods=['GET'])
def check_url():# Fetch parameters from the requestnonce = request.args.get('nonce')timestamp = request.args.get('timestamp')signature = request.args.get('signature')echostr = request.args.get('echostr')# Create a list of parametersparam_list = [nonce, timestamp, TOKEN]# Sort the parametersparam_list.sort()# Concatenate the sorted parametersconcat_str = ''.join(param_list)# Generate SHA1 hashencode = sha1_hash(concat_str)print(f"WeChat message received: {echostr}")print(echostr)return echostr# Compare the generated hash with the signature# if encode == signature:#     return echostr# else:#     return ''if __name__ == '__main__':app.run(debug=True,port=80,host='0.0.0.0')

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词