Skip to main content

NoneBot-Adapter-WXMP

✨ 微信公众平台客服 协议适配 ✨

license pypi pypi download python

安装

适配器安装

nb adapter install nonebot-adapter-wxmp

从PyPI 安装

pip install nonebot-adapter-wxmp

或从 GitHub 仓库安装

pip install git+https://github.com/YangRucheng/nonebot-adapter-wxmp.git#egg=nonebot-adapter-wxmp

加载适配器

import nonebot
from nonebot.adapters.wxmp import Adapter as WxmpAdapter

nonebot.init()

driver = nonebot.get_driver()
driver.register_adapter(WxmpAdapter)

配置 .env 文件

配置 Driver

DRIVER=~fastapi+~httpx

配置 Bot

WXMP_BOTS='
[
    {
        "appid": "", # 小程序 AppID 或 公众号开发者 ID,以 wx 开头
        "token": "", # 服务器验证时需要
        "secret": "", # 小程序或公众号的密钥
        "type": "miniprogram", # 填 miniprogram / official
        "callback": "" # 转发到其他 URL
    },
    {
        "appid": "", # 小程序 AppID 或 公众号开发者 ID,以 wx 开头
        "token": "", # 服务器验证时需要
        "secret": "", # 小程序或公众号的密钥
        "type": "official", # 填 miniprogram / official
        "approve": false, # 公众号是否微信认证
        "callback": ""
    }
]

WXMP_OFFICIAL_TIMEOUT=4  # 公众号被动回复超时时间,请根据服务器响应速度填写,必须小于5
WXMP_VERIFY=true  # 是否响应签名验证
'

配置消息推送

  • URL(服务器地址): https://example.com/wxmp/revice/<app_id> 或 https://example.com/wxmp/revice/<app_id>/
  • 消息加密方式:明文模式
  • 数据格式:推荐 JSON (公众号为 XML)

适配情况

小程序(事件推送) 小程序(发送客服消息) 公众号(事件推送) 公众号(发送客服消息) 公众号(被动回复消息)
文字消息 ✅ ✅ ✅ ✅ ✅
图片消息 ✅ ✅ ✅ ✅ ✅
图文链接 ❌ ✅ ✅ ❌ ❌
小程序卡片 ✅ ✅ ❌ ❔ ❌
语音消息 ❌ ❌ ✅ ✅ ✅
音乐消息 ❌ ❌ ❌
视频消息 ❌ ❌ ✅ ✅ ✅
小视频消息 ❌ ❌ ❌ ❌ ❌
地理位置消息 ❌ ❌ ✅ ❌ ❌
图文消息 ❌ ❌ ❌
菜单消息 ❌ ❌ ❌ ❌

✅已适配 · ❌官方不支持或疑似不支持 · ❔暂未测试或暂未适配

参考文档

微信开发文档

其他补充信息

一些注意事项

  • 公众号未微信认证时,不能发送客服消息,只能使用被动回复。
  • 被动回复必须在5秒内响应,超时自动回复空内容。

开源协议

MIT LICENSE

Metadata

Release files for nonebot-adapter-wxmp 0.1.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nonebot-adapter-wxmp 0.1.8
File Size Uploaded
nonebot_adapter_wxmp-0.1.8.tar.gz 19.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nonebot-adapter-wxmp 0.1.8
File Interpreter ABI Platform
nonebot_adapter_wxmp-0.1.8-py3-none-any.whl Python 3 none any Details

Total release size: 42.3 kB

Release files / nonebot_adapter_wxmp-0.1.8.tar.gz

Download URL nonebot_adapter_wxmp-0.1.8.tar.gz
Size 19.9 kB
Tags Source
SHA-256 checksum
How to use checksums
d2eafb8ee42a18bc967cd179d0a0c8aa63104d4effeb2e5ed08b76a379c318dd
BLAKE2b-256 checksum
How to use checksums
d8eebc1b18da3418cac036e08a19ea32e91741b9c061c58fc0b47b6ea5bd9b88
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / nonebot_adapter_wxmp-0.1.8-py3-none-any.whl

Download URL nonebot_adapter_wxmp-0.1.8-py3-none-any.whl
Size 22.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
898c88bd22a0100fa6522286a761ac4b6b7b2881a80f132746fb0844796b547d
BLAKE2b-256 checksum
How to use checksums
62074578480bc7ee97b507b70f4467ee26c19966f90827dd9e2e42e310350451
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release history Release notifications | RSS feed

This release

0.1.8 This release

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page