Event

Event 公共属性

除了 UnknownEvent, 每一种 Event 都包括以下属性:

name value
message_id 消息id
target 开发者账号( OpenID )
source 发送方账号( OpenID )
time 信息发送的时间,一个UNIX时间戳
raw 信息的原始 XML 格式

SubscribeEvent

SubscribeEvent 的属性:

name value
type ‘subscribe_event’
key 事件 key 值。 当且仅当未关注公众号扫描二维码时存在
ticket 二维码的 ticket。 当且仅当未关注公众号扫描二维码时存在

UnSubscribeEvent

UnSubscribeEvent 的属性:

name value
type ‘unsubscribe_event’

ScanEvent

ScanEvent 的属性:

name value
type ‘scan_event’
key 事件KEY值,是一个32位无符号整数,即创建二维码时的二维码 scene_id
ticket 二维码的 ticket,可用来换取二维码图片

ScanCodePushEvent

ScanCodePushEvent 的属性:

name value
type ‘scancode_push_event’
scan_type 扫描类型,一般是qrcode
scan_result 扫描结果,即二维码对应的字符串信息

ScanCodeWaitMsgEvent

ScanCodeWaitMsgEvent 的属性:

name value
type ‘scancode_waitmsg_event’
scan_type 扫描类型,一般是qrcode
scan_result 扫描结果,即二维码对应的字符串信息

PicSysphotoEvent

弹出系统拍照发图的事件推送的 Event。属性:

name value
type ‘pic_sysphoto_event’
key 事件KEY值,由开发者在创建菜单时设定
count 发送的图片数量
pic_list 图片列表,例如 [{‘pic_md5_sum’: ‘123’}]

PicPhotoOrAlbumEvent

弹出拍照或者相册发图的事件推送的 Event。属性:

name value
type ‘pic_photo_or_album_event’
key 事件KEY值,由开发者在创建菜单时设定
count 发送的图片数量
pic_list 图片列表,例如 [{‘pic_md5_sum’: ‘123’}]

PicWeixinEvent

弹出微信相册发图器的事件推送的 Event。属性:

name value
type ‘pic_weixin_event’
key 事件KEY值,由开发者在创建菜单时设定
count 发送的图片数量
pic_list 图片列表,例如 [{‘pic_md5_sum’: ‘123’}]

LocationSelectEvent

弹出地理位置选择器的事件推送的 Event。属性:

name value
type ‘location_select_event’
key 事件KEY值,由开发者在创建菜单时设定
location_x X坐标信息
location_y Y坐标信息
scale 精度,可理解为精度或者比例尺、越精细的话 scale 越高
label 地理位置的字符串信息
poi_name 朋友圈POI的名字,可能为 None

ClickEvent

ClickEvent 的属性:

name value
type ‘click_event’
key 事件 key 值。

ViewEvent

ViewEvent 的属性:

name value
type ‘view_event’
key 事件 key 值。

LocationEvent

LocationEvent 的属性:

name value
type ‘location_event’
latitude 地理位置纬度
longitude 地理位置经度
precision 地理位置精度

TemplateSendJobFinishEvent

模版消息发送任务完成后的 Event 通知。 属性:

name value
status 发送是否成功。为 ‘success’ 或失败原因

UserScanProductEvent

打开商品主页事件推送的 Event。属性:

name value
type ‘user_scan_product_event’
key_standard 商品编码标准。
key_str 商品编码内容。
country 用户在微信内设置的国家。
province 用户在微信内设置的省份。
city 用户在微信内设置的城市。
sex 用户的性别,1为男性,2为女性,0代表未知。
scene 打开商品主页的场景,1为扫码,2为其他打开场景(如会话、收藏或朋友圈)。
ext_info 调用“获取商品二维码接口”时传入的 extinfo,为标识参数。

UserScanProductEnterSessionEvent

当用户从商品主页进入公众号会话时推送的 Event。属性:

name value
type ‘user_scan_product_enter_session_event’
key_standard 商品编码标准。
key_str 商品编码内容。
ext_info 调用“获取商品二维码接口”时传入的 extinfo,为标识参数。

UserScanProductAsyncEvent

当用户打开商品主页,微信会将该用户实时的地理位置信息以异步事件的形式推送的 Event。属性:

name value
type ‘user_scan_product_async_event’
key_standard 商品编码标准。
key_str 商品编码内容。
ext_info 调用“获取商品二维码接口”时传入的 extinfo,为标识参数。
region_code 用户的实时地理位置信息(目前只精确到省一级),可在国家统计局网站查到对应明细: http://www.stats.gov.cn/tjsj/tjbz/xzqhdm/201504/t20150415_712722.html

UserScanProductVerifyActionEvent

提交审核的商品,完成审核后,微信会将审核结果以事件的形式推送的 Event。属性:

name value
type ‘user_scan_product_verify_action_event’
key_standard 商品编码标准。
key_str 商品编码内容。
result 审核结果。verify_ok表示审核通过,verify_not_pass表示审核未通过。
reason_msg 审核未通过的原因。

CardPassCheckEvent

生成的卡券通过审核时,微信推送的 Event。属性:

name value
type ‘card_pass_check_event’
card_id 卡券 ID。
refuse_reason 审核不通过原因。

CardNotPassCheckEvent

生成的卡券未通过审核时,微信推送的 Event。属性:

name value
type ‘card_not_pass_check_event’
card_id 卡券 ID。
refuse_reason 审核不通过原因。

UserGetCardEvent

用户在领取卡券时,微信推送的 Event。属性:

name value
type ‘user_get_card_event’
card_id 卡券 ID。
user_card_code code 序列号。
is_give_by_friend 是否为转赠领取,1 代表是,0 代表否。
friend_user_name 当 is_give_by_friend 为 1 时填入的字段,表示发起转赠用户的 openid。
outer_id 未知。
old_user_card_code 为保证安全,微信会在转赠发生后变更该卡券的 code 号,该字段表示转赠前的 code。
outer_str 领取场景值,用于领取渠道数据统计。可在生成二维码接口及添加 Addcard 接口中自定义该字段的字符串值。
is_restore_member_card 用户删除会员卡后可重新找回,当用户本次操作为找回时,该值为 1,否则为 0。
is_recommend_by_friend 未知。

UserGiftingCardEvent

用户在转赠卡券时,微信推送的 Event。属性:

name value
type ‘user_gifting_card_event’
card_id 卡券 ID。
user_card_code code 序列号。
friend_user_name 接收卡券用户的openid。
is_return_back 是否转赠退回,0 代表不是,1 代表是。
is_chat_room 是否是群转赠。

UserDelCardEvent

用户在删除卡券时,微信推送的 Event。属性:

name value
type ‘user_del_card_event’
card_id 卡券 ID。
user_card_code code 序列号。自定义 code 及非自定义 code 的卡券被领取后都支持事件推送。

UserConsumeCardEvent

卡券被核销时,微信推送的 Event。属性:

name value
type ‘user_consume_card_event’
card_id 卡券 ID。
user_card_code code 序列号。
consume_source 核销来源。
location_name 门店名称,当前卡券核销的门店名称(只有通过自助核销和买单核销时才会出现该字段)。
staff_open_id 核销该卡券核销员的 openid(只有通过卡券商户助手核销时才会出现)。
verify_code 自助核销时,用户输入的验证码。
remark_amount 自助核销时 ,用户输入的备注金额。
outer_str 开发者发起核销时传入的自定义参数,用于进行核销渠道统计。

UserPayFromPayCellEvent

用户微信买单完成时,微信推送的 Event。属性:

name value
type ‘user_pay_from_pay_cell_event’
card_id 卡券 ID。
user_card_code code 序列号。
trans_id 微信支付交易订单号(只有使用买单功能核销的卡券才会出现)。
location_id 门店 ID,当前卡券核销的门店 ID(只有通过卡券商户助手和买单核销时才会出现)。
fee 实付金额,单位为分。
original_fee 应付金额,单位为分。

UserViewCardEvent

用户在进入会员卡时,微信推送的 Event。属性:

name value
type ‘user_view_card_event’
card_id 卡券 ID。
user_card_code code 序列号。
outer_str 商户自定义二维码渠道参数,用于标识本次扫码打开会员卡来源来自于某个渠道值的二维码。

UserEnterSessionFromCardEvent

用户在卡券里点击查看公众号进入会话时(需要用户已经关注公众号),微信推送的 Event。属性:

name value
type ‘user_enter_session_from_card_event’
card_id 卡券 ID。
user_card_code code 序列号。

UpdateMemberCardEvent

用户的会员卡积分余额发生变动时,微信推送的 Event。属性:

name value
type ‘update_member_card_event’
card_id 卡券 ID。
user_card_code code 序列号。
modify_bonus 变动的积分值。
modify_balance 变动的余额值。

CardSkuRemindEvent

当某个card_id的初始库存数大于200且当前库存小于等于100时,用户尝试领券,微信推送的 Event。属性:

name value
type ‘card_sku_remind_event’
card_id 卡券 ID。
detail 报警详细信息。

CardPayOrderEvent

用户的会员卡积分余额发生变动时,微信推送的 Event。属性:

name value
type ‘card_pay_order_event’
card_id 卡券 ID。
user_card_code code 序列号。
order_id 本次推送对应的订单号。
status 本次订单号的状态。
create_order_time 购买券点时,支付二维码的生成时间。
pay_finish_time 购买券点时,实际支付成功的时间。
desc 支付方式,一般为微信支付充值。
free_coin_count 剩余免费券点数量。
pay_coin_count 剩余付费券点数量。
refund_free_coin_count 本次变动的免费券点数量。
refund_pay_coin_count 本次变动的付费券点数量
order_type 所要拉取的订单类型。
memo 系统备注,说明此次变动的缘由,如开通账户奖励、门店奖励、核销奖励以及充值、扣减。
receipt_info 所开发票的详情。

SubmitMembercardUserInfoEvent

用户通过一键激活的方式提交信息并点击激活或者用户修改会员卡信息时,微信推送的 Event。属性:

name value
type ‘submit_membercard_user_info_event’
card_id 卡券 ID。
user_card_code code 序列号。

UnknownEvent

UnknownEvent 的属性:

name value
type ‘unknown_event’
raw 请求的正文部分。标准的XML格式。

注解

如果你不为 WeRoBot 贡献代码,你完全可以无视掉 UnknownEvent 。在正常的使用中,WeRoBot应该不会收到 UnknownEvent ——除非 WeRoBot 停止开发。