我是靠谱客的博主 迷你云朵,这篇文章主要介绍微信企业号开发:开启回调模式/Python判断信息-回复指定内容示例代码,现在分享给大家,希望可以做个参考。

1 注册微信企业号的步骤就省略了。很简单。

选择下面的应用中心,企业小助手,选择回调模式。

微信企业号开发:开启回调模式/Python判断信息-回复指定内容示例代码

选择随机生成token AESKEY。地址输入你的服务器地址。

微信企业号开发:开启回调模式/Python判断信息-回复指定内容示例代码

选择设置,新建管理组,然后就能看到COPID和Secret

微信企业号开发:开启回调模式/Python判断信息-回复指定内容示例代码

把上面的4个参数,写到下面的文件里面。

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
python3 -m pip install itchatmp ###python3安装模块 具体可百度itchatmp官方文档 vim main.py import itchatmp from itchatmp.content import TEXT itchatmp.update_config(itchatmp.WechatConfig( token='xxxxxxxxxxxx', copId = 'xxxxxxxxxxxxx', appSecret = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', encryptMode=itchatmp.content.SAFE, encodingAesKey='xxxxxxxxxxxxxxxxxxxxxxxxxxxx',)) i='何全' @itchatmp.msg_register(itchatmp.content.TEXT) def text_reply(msg): if msg['Content'] == i : msg['Content'] = '姓名:{}'.format(i) return msg['Content'] else: print(23333) itchatmp.run()
登录后复制
复制代码
1
python main.py ##运行测试了。。。。
登录后复制
复制代码
1
2
3
4
5
修改端口号:itchatmp.run(port=8888) 记得修改防火墙,这里我就被坑了。 微信回调模式支持 x.x.x.x:8888 iptable -A INPUT -p tcp -m tcp --dport 8888 -j ACCEPT
登录后复制

结果:

当微信企业号,收到回复何全,返回 姓名:何全

以上就是微信企业号开发:开启回调模式/Python判断信息-回复指定内容示例代码的详细内容,更多请关注靠谱客其它相关文章!

最后

以上就是迷你云朵最近收集整理的关于微信企业号开发:开启回调模式/Python判断信息-回复指定内容示例代码的全部内容,更多相关微信企业号开发内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(140)

评论列表共有 0 条评论

立即
投稿
返回
顶部