Class WeixinProxy
- java.lang.Object
-
- com.foxinmy.weixin4j.mp.WeixinProxy
-
-
Constructor Summary
Constructors Constructor Description WeixinProxy()微信接口实现(使用weixin4j.properties配置的account账号信息, 使用FileCacheStorager文件方式缓存TOKEN)WeixinProxy(CacheStorager<Token> cacheStorager)微信接口实现(使用weixin4j.properties配置的account账号信息)WeixinProxy(WeixinAccount weixinAccount, CacheStorager<Token> cacheStorager)微信接口实现WeixinProxy(PerTicketManager perTicketManager, TokenManager componentTokenManager)第三方组件方式创建微信接口实现(永久刷新令牌机制)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringaddGiftCardPage(GiftCardPage page)微信礼品卡货架创建接口,开发者可以通过该接口创建一个礼品卡货架并且用于公众号、门店的礼品卡售卖。StringaddGiftCardPayWhitelist(String subMchId)申请礼品卡的微信支付权限ApiResultbatchBlacklist(boolean blacklist, String... openIds)黑名单操作List<ChangeOpenidResult>batchChangeOpenid(String fromAppid, List<String> openIds)公众号迁移批量转换openidApiResultbindGiftCardPaySubMch(String wxaAppid, String subMchId)绑定商户号到礼品卡小程序List<ChangeOpenidResult>changeAllOpenid(String fromAppid)公众号迁移转换所有openidApiResultclearQuota()接口调用次数调用清零:公众号调用接口并不是无限制的。为了防止公众号的程序错误而引发微信服务器负载异常,默认情况下, 每个公众号调用接口都不能超过一定限制 ,当超过一定限制时,调用对应接口会收到{"errcode":45009,"errmsg":"api freq out of limit" }错误返回码。ApiResultcloseKfSession(String userOpenId, String kfAccount, String text)关闭客服会话ApiResultconsumeGiftCard(String code, String cardId)当礼品卡被使用完毕或者发生转存、绑定等操作后,开发者可以通过该接口核销用户的礼品卡,使礼品卡在列表中沉底并不再被使用。 注意:需在礼品卡核销前调用,否则会报40099 已核销的错误MediaCountercountMaterialMedia()获取永久媒体素材的总数 .图片和图文消息素材(包括单图文和多图文)的总数上限为5000,其他素材的总数上限为1000StringcreateCardCoupon(CardCoupon cardCoupon)创建卡券:创建卡券接口是微信卡券的基础接口,用于创建一类新的卡券,获取card_id,创建成功并通过审核后, 商家可以通过文档提供的其他接口将卡券下发给用户,每次成功领取,库存数量相应扣除。 1.需自定义Code码的商家必须在创建卡券时候,设定use_custom_code为true,且在调用投放卡券接口时填入指定的Code码。 指定OpenID同理。特别注意:在公众平台创建的卡券均为非自定义Code类型。 2.can_share字段指领取卡券原生页面是否可分享,建议指定Code码、指定OpenID等强限制条件的卡券填写false。 3.创建成功后该卡券会自动提交审核 ,审核结果将通过事件通知商户。开发者可调用设置白名单接口设置用户白名单,领取未通过审核的卡券,测试整个卡券的使用流程。QRResultcreateCardQR(Integer expireSeconds, CardQR... cardQRs)创建卡券二维码: 开发者可调用该接口生成一张卡券二维码供用户扫码后添加卡券到卡包。StringcreateCustomMenu(List<Button> buttons, MenuMatchRule matchRule)创建个性化菜单GroupcreateGroup(String name)创建分组ApiResultcreateKfAccount(String id, String name)新增客服账号ApiResultcreateKfSession(String userOpenId, String kfAccount, String text)创建客服会话ApiResultcreateMenu(List<Button> buttons)自定义菜单QRResultcreateQR(QRParameter parameter)生成带参数的二维码TagcreateTag(String name)创建标签List<?>datacube(DatacubeType datacubeType, int offset, Date endDate)数据统计List<?>datacube(DatacubeType datacubeType, Date date)查询日期跨度为0的统计数据(当天)List<?>datacube(DatacubeType datacubeType, Date beginDate, int offset)数据统计List<?>datacube(DatacubeType datacubeType, Date beginDate, Date endDate)数据统计ApiResultdeleteComment(String msgid, int index, String commentId)删除评论ApiResultdeleteCommentReply(String msgid, int index, String commentId)删除回复ApiResultdeleteCustomMenu(String menuId)删除个性化菜单ApiResultdeleteGroup(int groupId)删除用户分组,所有该分组内的用户自动进入默认分组.ApiResultdeleteKfAccount(String id)删除客服账号ApiResultdeleteMassNews(String msgid)删除群发消息ApiResultdeleteMassNews(String msgid, int articleIndex)删除群发消息ApiResultdeleteMaterialMedia(String mediaId)删除永久媒体素材ApiResultdeleteMenu()删除菜单ApiResultdeleteTag(int tagId)删除标签ApiResultdeleteTemplate(String templateId)删除模板List<MpArticle>downloadArticle(String mediaId)下载永久图文素材MediaDownloadResultdownloadMedia(String mediaId, boolean isMaterial)下载媒体文件List<String>getAllBalcklistOpenIds()获取公众号全部的黑名单列表 请慎重使用List<User>getAllFollowing()获取公众号全部的关注者列表 请慎重使用List<String>getAllFollowingOpenIds()获取公众号全部的关注者列表 请慎重使用List<Menu>getAllMenu()查询全部菜单(包含个性化菜单)List<User>getAllTagFollowing(int tagId)获取标签下全部的粉丝列表 请慎重使用List<String>getAllTagFollowingOpenIds(int tagId)获取标签下全部的粉丝列表 请慎重使用List<TemplateMessageInfo>getAllTemplates()获取模板列表AutoReplySettinggetAutoReplySetting()获取公众号当前使用的自动回复规则,包括关注后自动回复、消息自动回复(60分钟内触发一次)、关键词自动回复。FollowinggetBalcklistOpenIds(String nextOpenId)获取公众号的黑名单列表com.alibaba.fastjson.JSONObjectgetCardInfo(String cardId)查询某个card_id的创建信息、审核状态以及库存数量。FollowinggetFollowing(String nextOpenId)获取公众号一定数量(10000)的关注者列表 请慎重使用FollowinggetFollowingOpenIds(String nextOpenId)获取公众号一定数量(10000)的关注者列表com.alibaba.fastjson.JSONObjectgetGiftCardInfo(String code, String cardId)开发者可以通过该接口查询到code对应的信息,如余额、有效期、订单号等,主要用于防止在交易完成后丢单的情况下,用于核销/余额变动时兜底处理。com.alibaba.fastjson.JSONObjectgetGiftCardOrderInfo(String orderId)查询某个订单号对应的订单详情com.alibaba.fastjson.JSONObjectgetGiftCardOrders(long beginTime, long endTime, String sortType, int offset, int limit)批量查询礼品卡订单信息接口com.alibaba.fastjson.JSONObjectgetGiftCardPage(String pageId)查询礼品卡货架信息接口String[]getGiftCardPageIdList()查询当前商户下所有的礼品卡货架idintgetGroupByOpenId(String openId)查询用户所在分组List<Group>getGroups()查询所有分组List<KfChatRecord>getKfChatRecord(Date startTime, Date endTime, int number)客服聊天记录KfSessiongetKfSession(String userOpenId)获取客户的会话状态:获取客户当前的会话状态。StringgetMassNewStatus(String msgId)查询群发发送状态List<Button>getMenu()查询菜单MenuSettinggetMenuSetting()获取公众号当前使用的自定义菜单的配置,如果公众号是通过API调用设置的菜单,则返回菜单的开发配置, 而如果公众号是在公众平台官网通过网站功能发布菜单,则本接口返回运营者设置的菜单配置。OauthApigetOauthApi()获取oauth授权APIStringgetShorturl(String url)长链接转短链接FollowinggetTagFollowing(int tagId, String nextOpenId)获取标签下粉丝列表 请慎重使用FollowinggetTagFollowingOpenIds(int tagId, String nextOpenId)获取标签下粉丝列表StringgetTemplateId(String shortId)获取模板IDTokenManagergetTicketManager(TicketType ticketType)获取JSSDK Ticket的tokenManagerTokenManagergetTokenManager()token管理UsergetUser(String openId)获取用户信息UsergetUser(String openId, Lang lang)获取用户信息List<User>getUsers(Lang lang, String... openIds)批量获取用户信息List<User>getUsers(String... openIds)批量获取用户信息Integer[]getUserTags(String openId)获取用户身上的标签列表List<String>getWechatServerIp()获取微信服务器IP地址WeixinAccountgetWeixinAccount()获取微信账号信息ApiResultgiftCardOrderRefund(String orderId)对一笔礼品卡订单操作退款ApiResultinviteKfAccount(String kfAccount, String inviteAccount)邀请绑定客服帐号 新添加的客服帐号是不能直接使用的,只有客服人员用微信号绑定了客服账号后,方可登录Web客服进行操作。此接口发起一个绑定邀请到客服人员微信号 ,客服人员需要在微信客户端上用该微信号确认后帐号才可用。尚未绑定微信号的帐号可以进行绑定邀请操作,邀请未失效时不能对该帐号进行再次绑定微信号邀请。List<ArticleComment>listAllArticleComments(ArticleComment.ArticleCommentType commentType, String msgid, int index)获取评论列表List<MediaItem>listAllMaterialMedia(MediaType mediaType)获取全部的媒体素材Pagedata<ArticleComment>listArticleComments(Pageable page, ArticleComment.ArticleCommentType commentType, String msgid, int index)获取评论列表List<KfAccount>listKfAccount()获取公众号中所设置的客服基本信息,包括客服工号、客服昵称、客服登录账号List<KfSession>listKfSession(String kfAccount)获取客服的会话列表:获取某个客服正在接待的会话列表。KfSession.KfSessionCounterlistKfWaitSession()获取未接入会话列表:获取当前正在等待队列中的会话列表,此接口最多返回最早进入队列的100个未接入会话MediaRecordlistMaterialMedia(MediaType mediaType, Pageable pageable)获取媒体素材记录列表List<KfOnlineAccount>listOnlineKfAccount()获取在线客服在线状态(手机在线、PC客户端在线、手机和PC客户端全都在线)、客服自动接入最大值、 客服当前接待客户数List<Tag>listTags()获取标签ApiResultmaintainAllGiftCardPage()下架所有礼品卡货架ApiResultmaintainGiftCardPage(String pageId)下架一个礼品卡货架ApiResultmarkelectComment(boolean markelect, String msgid, int index, String commentId)评论标记/取消精选String[]massArticleByGroupId(List<MpArticle> articles, int groupId)分组ID群发图文消息String[]massArticleByOpenIds(List<MpArticle> articles, boolean ignoreReprint, String... openIds)openid群发图文消息String[]massArticleByTagId(List<MpArticle> articles, int tagId, boolean ignoreReprint)标签群发图文消息String[]massByGroupId(MassTuple tuple, boolean isToAll, int groupId)群发消息String[]massByOpenIds(MassTuple tuple, String... openIds)openId群发消息String[]massByTagId(MassTuple tuple, int tagId)标签群发消息String[]massToAll(MassTuple tuple)群发消息给所有粉丝List<Button>matchCustomMenu(String userId)测试个性化菜单匹配结果ApiResultmodifyGroup(int groupId, String name)修改分组名ApiResultmoveGroup(int groupId, String openId)移动用户到分组ApiResultmoveGroup(int groupId, String... openIds)批量移动分组ApiResultopenComment(boolean open, String msgid, int index)打开/关闭已群发文章评论ApiResultpreviewMassNews(String toUser, String toWxName, MassTuple tuple)预览群发消息 开发者可通过该接口发送消息给指定用户,在手机端查看消息的样式和排版ApiResultremarkUserName(String openId, String remark)设置用户备注名ApiResultreplyComment(String msgid, int index, String commentId, String content)回复评论SemResultsemantic(SemQuery semQuery)语义理解ApiResultsendNotify(NotifyMessage notify)发送客服消息(在48小时内不限制发送次数)ApiResultsendNotify(NotifyMessage notify, String kfAccount)发送客服消息(在48小时内不限制发送次数)StringsendTmplMessage(TemplateMessage tplMessage)发送模板消息ApiResultsetCardPayCell(String cardId, boolean isOpen)设置卡券买单:创建卡券之后,开发者可以通过设置微信买单接口设置该card_id支持微信买单功能。值得开发者注意的是, 设置买单的card_id必须已经配置了门店,否则会报错。ApiResultsetCardSelfConsumeCell(String cardId, boolean isOpen)设置自助核销:创建卡券之后,开发者可以通过设置微信买单接口设置该card_id支持自助核销功能。值得开发者注意的是, 设置自助核销的card_id必须已经配置了门店,否则会报错。ApiResultsetGiftCardWxaCode(String wxaAppid, String pageId)上传礼品卡小程序代码 (提供小程序APPID及货架ID,由微信平台为你小程序帐号上传一套现成的礼品卡小程序,直接用于礼品卡售卖)ApiResultsetTmplIndustry(IndustryType... industryTypes)设置所属行业(每月可修改行业1次,账号仅可使用所属行业中相关的模板)ApiResulttaggingUsers(int tagId, String... openIds)批量为用户打标签:标签功能目前支持公众号为用户打上最多三个标签ApiResultuntaggingUsers(int tagId, String... openIds)批量为用户取消标签ApiResultupdateGiftCardPage(GiftCardPage page)修改礼品卡货架信息接口com.alibaba.fastjson.JSONObjectupdateGiftCardUserBalance(CardInfo cardInfo)更新用户礼品卡信息 当礼品卡被使用后,可以通过该接口变更某个礼品卡的余额信息。ApiResultupdateKfAccount(String id, String name)更新客服账号ApiResultupdateMaterialArticle(String mediaId, int index, MpArticle article)更新永久图文素材ApiResultupdateTag(Tag tag)更新标签StringuploadImage(InputStream is, String fileName)上传图文消息内的图片获取URL 请注意,本接口所上传的图片不占用公众号的素材库中图片数量的5000个的限制。图片仅支持jpg/png格式,大小必须在1MB以下。ApiResultuploadKfAvatar(String accountId, InputStream is, String fileName)上传客服头像StringuploadMassArticle(List<MpArticle> articles)上传群发的图文消息,一个图文消息支持1到10条图文StringuploadMaterialArticle(List<MpArticle> articles)上传永久图文素材StringuploadMaterialVideo(InputStream is, String fileName, String title, String introduction)上传永久视频素材MediaUploadResultuploadMedia(boolean isMaterial, InputStream is, String fileName)上传媒体文件 此接口只包含图片、语音、缩略图、视频(临时)四种媒体类型的上传MpVideouploadVideo(InputStream is, String fileName, String title, String description)上传群发中的视频素材
-
-
-
Field Detail
-
VERSION
public static final String VERSION
-
-
Constructor Detail
-
WeixinProxy
public WeixinProxy()
微信接口实现(使用weixin4j.properties配置的account账号信息, 使用FileCacheStorager文件方式缓存TOKEN)
-
WeixinProxy
public WeixinProxy(CacheStorager<Token> cacheStorager)
微信接口实现(使用weixin4j.properties配置的account账号信息)- Parameters:
cacheStorager- token管理
-
WeixinProxy
public WeixinProxy(WeixinAccount weixinAccount, CacheStorager<Token> cacheStorager)
微信接口实现- Parameters:
weixinAccount- 账号信息cacheStorager- token管理
-
WeixinProxy
public WeixinProxy(PerTicketManager perTicketManager, TokenManager componentTokenManager)
第三方组件方式创建微信接口实现(永久刷新令牌机制)- Parameters:
perTicketManager- 第三方组件永久刷新tokencomponentTokenManager- 第三方组件凭证token- See Also:
ComponentApi,ComponentApi.getPreCodeManager(),ComponentApi.getTokenManager()
-
-
Method Detail
-
getWeixinAccount
public WeixinAccount getWeixinAccount()
获取微信账号信息- Returns:
-
getTokenManager
public TokenManager getTokenManager()
token管理- Returns:
-
getTicketManager
public TokenManager getTicketManager(TicketType ticketType)
获取JSSDK Ticket的tokenManager- Parameters:
ticketType- 票据类型- Returns:
-
uploadImage
public String uploadImage(InputStream is, String fileName) throws WeixinException
上传图文消息内的图片获取URL 请注意,本接口所上传的图片不占用公众号的素材库中图片数量的5000个的限制。图片仅支持jpg/png格式,大小必须在1MB以下。- Parameters:
is- 图片数据流fileName- 文件名 为空时将自动生成- Returns:
- 图片URL 可用于后续群发中,放置到图文消息中
- Throws:
WeixinException- See Also:
MediaApi
-
uploadVideo
public MpVideo uploadVideo(InputStream is, String fileName, String title, String description) throws WeixinException
上传群发中的视频素材- Parameters:
is- 图片数据流fileName- 文件名 为空时将自动生成title- 视频标题 非空description- 视频描述 可为空- Returns:
- 群发视频消息对象
- Throws:
WeixinException- See Also:
MediaApi, 高级群发,MpVideo
-
uploadMedia
public MediaUploadResult uploadMedia(boolean isMaterial, InputStream is, String fileName) throws WeixinException
上传媒体文件 此接口只包含图片、语音、缩略图、视频(临时)四种媒体类型的上传- Parameters:
isMaterial- 是否永久上传is- 媒体数据流fileName- 文件名 为空时将自动生成- Returns:
- 上传到微信服务器返回的媒体标识
- Throws:
WeixinException- See Also:
-
上传临时素材,
上传永久素材,
MediaUploadResult,MediaType,MediaApi
-
downloadMedia
public MediaDownloadResult downloadMedia(String mediaId, boolean isMaterial) throws WeixinException
下载媒体文件- Parameters:
mediaId- 媒体IDisMaterial- 是否永久素材- Returns:
- 媒体文件下载结果
- Throws:
WeixinException- See Also:
MediaApi,MediaDownloadResult, 下载临时媒体素材, 下载永久媒体素材
-
uploadMaterialArticle
public String uploadMaterialArticle(List<MpArticle> articles) throws WeixinException
上传永久图文素材、新增的永久素材也可以在公众平台官网素材管理模块中看到,永久素材的数量是有上限的,请谨慎新增。图文消息素材和图片素材的上限为5000, 其他类型为1000
- Parameters:
articles- 图文列表- Returns:
- 上传到微信服务器返回的媒体标识
- Throws:
WeixinException- See Also:
MediaApi,MpArticle, 上传永久媒体素材
-
downloadArticle
public List<MpArticle> downloadArticle(String mediaId) throws WeixinException
下载永久图文素材- Parameters:
mediaId- 媒体ID- Returns:
- 图文列表
- Throws:
WeixinException- See Also:
MpArticle,MediaApi
-
updateMaterialArticle
public ApiResult updateMaterialArticle(String mediaId, int index, MpArticle article) throws WeixinException
更新永久图文素材- Parameters:
mediaId- 要修改的图文消息的idindex- 要更新的文章在图文消息中的位置(多图文消息时,此字段才有意义),第一篇为0article- 图文对象- Returns:
- 处理结果
- Throws:
WeixinException- See Also:
MediaApi,MpArticle, 更新永久图文素材
-
deleteMaterialMedia
public ApiResult deleteMaterialMedia(String mediaId) throws WeixinException
删除永久媒体素材- Parameters:
mediaId- 媒体素材的media_id- Returns:
- 处理结果
- Throws:
WeixinException- See Also:
MediaApi, 删除永久媒体素材
-
uploadMaterialVideo
public String uploadMaterialVideo(InputStream is, String fileName, String title, String introduction) throws WeixinException
上传永久视频素材- Parameters:
is- 大小不超过1M且格式为MP4的视频文件fileName- 文件名 为空时将自动生成title- 视频标题introduction- 视频描述- Returns:
- 上传到微信服务器返回的媒体标识
- Throws:
WeixinException- See Also:
-
上传永久媒体素材,
MediaApi
-
countMaterialMedia
public MediaCounter countMaterialMedia() throws WeixinException
获取永久媒体素材的总数 .图片和图文消息素材(包括单图文和多图文)的总数上限为5000,其他素材的总数上限为1000- Returns:
- 总数对象
- Throws:
WeixinException- See Also:
MediaCounter, 获取素材总数,MediaApi
-
listMaterialMedia
public MediaRecord listMaterialMedia(MediaType mediaType, Pageable pageable) throws WeixinException
获取媒体素材记录列表- Parameters:
mediaType- 素材的类型,图片(image)、视频(video)、语音 (voice)、图文(news)pageable- 分页数据- Returns:
- 媒体素材的记录对象
- Throws:
WeixinException- See Also:
MediaApi,MediaRecord,MediaType,MediaItem,Pageable,Pagedata, 获取素材列表
-
listAllMaterialMedia
public List<MediaItem> listAllMaterialMedia(MediaType mediaType) throws WeixinException
获取全部的媒体素材- Parameters:
mediaType- 媒体类型- Returns:
- 素材列表
- Throws:
WeixinException- See Also:
MediaApi
-
sendNotify
public ApiResult sendNotify(NotifyMessage notify) throws WeixinException
发送客服消息(在48小时内不限制发送次数)- Parameters:
notify- 客服消息对象- Returns:
- 处理结果
- Throws:
WeixinException
-
sendNotify
public ApiResult sendNotify(NotifyMessage notify, String kfAccount) throws WeixinException
发送客服消息(在48小时内不限制发送次数)
-
getKfChatRecord
public List<KfChatRecord> getKfChatRecord(Date startTime, Date endTime, int number) throws WeixinException
客服聊天记录- Parameters:
startTime- 查询开始时间endTime- 查询结束时间 每次查询不能跨日查询number- 最多10000条- Throws:
WeixinException- See Also:
KfChatRecord,CustomApi, 查询客服聊天记录, 查询客服聊天记录
-
listKfAccount
public List<KfAccount> listKfAccount() throws WeixinException
获取公众号中所设置的客服基本信息,包括客服工号、客服昵称、客服登录账号- Returns:
- 多客服信息列表
- Throws:
WeixinException- See Also:
KfAccount,CustomApi, 获取客服基本信息
-
listOnlineKfAccount
public List<KfOnlineAccount> listOnlineKfAccount() throws WeixinException
获取在线客服在线状态(手机在线、PC客户端在线、手机和PC客户端全都在线)、客服自动接入最大值、 客服当前接待客户数- Returns:
- 多客服在线信息列表
- Throws:
WeixinException- See Also:
KfOnlineAccount,CustomApi, 获取客服在线信息
-
createKfAccount
public ApiResult createKfAccount(String id, String name) throws WeixinException
新增客服账号- Parameters:
id- 完整客服账号,格式为:账号前缀@公众号微信号,账号前缀最多10个字符,必须是英文或者数字字符。如果没有公众号微信号, 请前往微信公众平台设置。name- 客服昵称,最长6个汉字或12个英文字符- Returns:
- 处理结果
- Throws:
WeixinException- See Also:
客服管理接口返回码, 新增客服账号
-
updateKfAccount
public ApiResult updateKfAccount(String id, String name) throws WeixinException
更新客服账号- Parameters:
id- 完整客服账号,格式为:账号前缀@公众号微信号,账号前缀最多10个字符,必须是英文或者数字字符。如果没有公众号微信号, 请前往微信公众平台设置。name- 客服昵称,最长6个汉字或12个英文字符- Returns:
- 处理结果
- Throws:
WeixinException- See Also:
CustomApi, 更新客服账号
-
inviteKfAccount
public ApiResult inviteKfAccount(String kfAccount, String inviteAccount) throws WeixinException
邀请绑定客服帐号 新添加的客服帐号是不能直接使用的,只有客服人员用微信号绑定了客服账号后,方可登录Web客服进行操作。此接口发起一个绑定邀请到客服人员微信号 ,客服人员需要在微信客户端上用该微信号确认后帐号才可用。尚未绑定微信号的帐号可以进行绑定邀请操作,邀请未失效时不能对该帐号进行再次绑定微信号邀请。- Parameters:
kfAccount- 完整客服帐号,格式为:帐号前缀@公众号微信号inviteAccount- 接收绑定邀请的客服微信号- Returns:
- 处理结果
- Throws:
WeixinException- See Also:
CustomApi, 邀请绑定客服帐号
-
uploadKfAvatar
public ApiResult uploadKfAvatar(String accountId, InputStream is, String fileName) throws WeixinException
上传客服头像- Parameters:
accountId- 完整客服账号,格式为:账号前缀@公众号微信号is- 头像图片文件必须是jpg格式,推荐使用640*640大小的图片以达到最佳效果fileName- 文件名 为空时将自动生成- Returns:
- 处理结果
- Throws:
WeixinException- See Also:
CustomApi, 上传客服头像
-
deleteKfAccount
public ApiResult deleteKfAccount(String id) throws WeixinException
删除客服账号- Parameters:
id- 完整客服账号,格式为:账号前缀@公众号微信号- Returns:
- 处理结果
- Throws:
WeixinException- See Also:
CustomApi, 删除客服账号
-
createKfSession
public ApiResult createKfSession(String userOpenId, String kfAccount, String text) throws WeixinException
创建客服会话开发者可以使用本接口,为多客服的客服工号创建会话,将某个客户直接指定给客服工号接待,需要注意此接口不会受客服自动接入数以及自动接入开关限制。 只能为在线的客服(PC客户端在线,或者已绑定多客服助手)创建会话。
- Parameters:
userOpenId- 用户的userOpenIdkfAccount- 完整客服账号,格式为:账号前缀@公众号微信号text- 附加信息,文本会展示在客服人员的多客服客户端- Returns:
- 处理结果
- Throws:
WeixinException- See Also:
CustomApi, 创建会话
-
closeKfSession
public ApiResult closeKfSession(String userOpenId, String kfAccount, String text) throws WeixinException
关闭客服会话- Parameters:
userOpenId- 用户的userOpenIdkfAccount- 完整客服账号,格式为:账号前缀@公众号微信号text- 附加信息,文本会展示在客服人员的多客服客户端- Returns:
- 处理结果
- Throws:
WeixinException- See Also:
CustomApi, 关闭会话
-
getKfSession
public KfSession getKfSession(String userOpenId) throws WeixinException
获取客户的会话状态:获取客户当前的会话状态。- Parameters:
userOpenId- 用户的openid- Returns:
- 会话对象
- Throws:
WeixinException- See Also:
CustomApi,KfSession, 获取会话状态
-
listKfSession
public List<KfSession> listKfSession(String kfAccount) throws WeixinException
获取客服的会话列表:获取某个客服正在接待的会话列表。- Parameters:
kfAccount- 完整客服账号,格式为:账号前缀@公众号微信号,账号前缀最多10个字符,必须是英文或者数字字符。- Returns:
- 会话列表
- Throws:
WeixinException- See Also:
CustomApi,KfSession, 获取客服的会话列表
-
listKfWaitSession
public KfSession.KfSessionCounter listKfWaitSession() throws WeixinException
获取未接入会话列表:获取当前正在等待队列中的会话列表,此接口最多返回最早进入队列的100个未接入会话- Returns:
- 会话列表
- Throws:
WeixinException- See Also:
CustomApi,KfSession,KfSession.KfSessionCounter, 获取客服的会话列表
-
uploadMassArticle
public String uploadMassArticle(List<MpArticle> articles) throws WeixinException
上传群发的图文消息,一个图文消息支持1到10条图文- Parameters:
articles- 图片消息- Returns:
- 媒体ID
- Throws:
WeixinException- See Also:
-
上传图文素材,
MpArticle,MassApi
-
massByGroupId
public String[] massByGroupId(MassTuple tuple, boolean isToAll, int groupId) throws WeixinException
群发消息在返回成功时,意味着群发任务提交成功,并不意味着此时群发已经结束,所以,仍有可能在后续的发送过程中出现异常情况导致用户未收到消息, 如消息有时会进行审核、服务器不稳定等,此外,群发任务一般需要较长的时间才能全部发送完毕
- Parameters:
tuple- 消息元件isToAll- 用于设定是否向全部用户发送,值为true或false,选择true该消息群发给所有用户, 选择false可根据group_id发送给指定群组的用户groupId- 分组ID- Returns:
- 第一个元素为消息发送任务的ID,第二个元素为消息的数据ID,该字段只有在群发图文消息时,才会出现,可以用于在图文分析数据接口中
- Throws:
WeixinException- See Also:
Group,Text,Image,Voice,MpVideo,MpNews,MassApi,MassTuple, 根据分组群发
-
massArticleByGroupId
public String[] massArticleByGroupId(List<MpArticle> articles, int groupId) throws WeixinException
分组ID群发图文消息- Parameters:
articles- 图文列表groupId- 分组ID- Returns:
- 第一个元素为消息发送任务的ID,第二个元素为消息的数据ID,该字段只有在群发图文消息时,才会出现,可以用于在图文分析数据接口中
- Throws:
WeixinException- See Also:
-
根据分组群发,
MpArticle
-
massToAll
public String[] massToAll(MassTuple tuple) throws WeixinException
群发消息给所有粉丝- Parameters:
tuple- 消息元件- Returns:
- 第一个元素为消息发送任务的ID,第二个元素为消息的数据ID,该字段只有在群发图文消息时,才会出现,可以用于在图文分析数据接口中
- Throws:
WeixinException- See Also:
MassApi, 根据标签群发
-
massByTagId
public String[] massByTagId(MassTuple tuple, int tagId) throws WeixinException
标签群发消息- Parameters:
tuple- 消息元件tagId- 标签ID- Returns:
- 第一个元素为消息发送任务的ID,第二个元素为消息的数据ID,该字段只有在群发图文消息时,才会出现,可以用于在图文分析数据接口中
- Throws:
WeixinException- See Also:
Tag,MassApi, 根据标签群发
-
massArticleByTagId
public String[] massArticleByTagId(List<MpArticle> articles, int tagId, boolean ignoreReprint) throws WeixinException
标签群发图文消息- Parameters:
articles- 图文列表tagId- 标签IDignoreReprint- 图文消息被判定为转载时,是否继续群发- Returns:
- 第一个元素为消息发送任务的ID,第二个元素为消息的数据ID,该字段只有在群发图文消息时,才会出现。
- Throws:
WeixinException- See Also:
-
根据标签群发,
MpArticle,MassApi
-
massByOpenIds
public String[] massByOpenIds(MassTuple tuple, String... openIds) throws WeixinException
openId群发消息- Parameters:
tuple- 消息元件openIds- openId列表- Returns:
- 第一个元素为消息发送任务的ID,第二个元素为消息的数据ID,该字段只有在群发图文消息时,才会出现,可以用于在图文分析数据接口中
- Throws:
WeixinException- See Also:
-
根据openid群发,
MassApi
-
massArticleByOpenIds
public String[] massArticleByOpenIds(List<MpArticle> articles, boolean ignoreReprint, String... openIds) throws WeixinException
openid群发图文消息- Parameters:
articles- 图文列表ignoreReprint- 图文消息被判定为转载时,是否继续群发openIds- openId列表- Returns:
- 第一个元素为消息发送任务的ID,第二个元素为消息的数据ID,该字段只有在群发图文消息时,才会出现,可以用于在图文分析数据接口中.
- Throws:
WeixinException- See Also:
-
根据openid群发,
MpArticle,MassApi
-
deleteMassNews
public ApiResult deleteMassNews(String msgid) throws WeixinException
删除群发消息- Parameters:
msgid- 发送出去的消息ID- Throws:
WeixinException- See Also:
-
删除群发,
deleteMassNews(String, int),MassApi
-
deleteMassNews
public ApiResult deleteMassNews(String msgid, int articleIndex) throws WeixinException
删除群发消息请注意,只有已经发送成功的消息才能删除删除消息只是将消息的图文详情页失效,已经收到的用户,还是能在其本地看到消息卡片
- Parameters:
msgid- 发送出去的消息IDarticleIndex- 要删除的文章在图文消息中的位置,第一篇编号为1,该字段不填或填0会删除全部文章- Throws:
WeixinException- See Also:
-
删除群发,
MassApi
-
previewMassNews
public ApiResult previewMassNews(String toUser, String toWxName, MassTuple tuple) throws WeixinException
预览群发消息 开发者可通过该接口发送消息给指定用户,在手机端查看消息的样式和排版- Parameters:
toUser- 接收用户的openIDtoWxName- 接收用户的微信号 towxname和touser同时赋值时,以towxname优先tuple- 消息元件- Returns:
- 处理结果
- Throws:
WeixinException- See Also:
MassApi,MassTuple, 预览群发消息
-
getMassNewStatus
public String getMassNewStatus(String msgId) throws WeixinException
查询群发发送状态- Parameters:
msgId- 消息ID- Returns:
- 消息发送状态
- Throws:
WeixinException- See Also:
MassApi, 查询群发状态
-
getUser
public User getUser(String openId) throws WeixinException
获取用户信息- Parameters:
openId- 用户对应的ID- Returns:
- 用户对象
- Throws:
WeixinException- See Also:
-
获取用户信息,
User,UserApi
-
getUser
public User getUser(String openId, Lang lang) throws WeixinException
获取用户信息在关注者与公众号产生消息交互后,公众号可获得关注者的OpenID(加密后的微信号,每个用户对每个公众号的OpenID是唯一的,对于不同公众号, 同一用户的openid不同),公众号可通过本接口来根据OpenID获取用户基本信息,包括昵称、头像、性别、所在城市、语言和关注时间
- Parameters:
openId- 用户对应的IDlang- 国家地区语言版本- Returns:
- 用户对象
- Throws:
WeixinException- See Also:
-
获取用户信息,
Lang,User,UserApi
-
getUsers
public List<User> getUsers(String... openIds) throws WeixinException
批量获取用户信息- Parameters:
openIds- 用户ID- Returns:
- 用户列表
- Throws:
WeixinException- See Also:
-
获取用户信息,
User,UserApi
-
getUsers
public List<User> getUsers(Lang lang, String... openIds) throws WeixinException
批量获取用户信息- Parameters:
lang- 国家地区语言版本openIds- 用户ID- Returns:
- 用户列表
- Throws:
WeixinException- See Also:
-
获取用户信息,
Lang,User,UserApi
-
getFollowing
public Following getFollowing(String nextOpenId) throws WeixinException
获取公众号一定数量(10000)的关注者列表 请慎重使用
-
getFollowingOpenIds
public Following getFollowingOpenIds(String nextOpenId) throws WeixinException
获取公众号一定数量(10000)的关注者列表- Parameters:
nextOpenId- 下一次拉取数据的openid 不填写则默认从头开始拉取- Returns:
- 关注者信息 不包含用户的详细信息
- Throws:
WeixinException- See Also:
-
获取关注者列表,
UserApi,Following
-
getAllFollowing
public List<User> getAllFollowing() throws WeixinException
获取公众号全部的关注者列表 请慎重使用当公众号关注者数量超过10000时,可通过填写next_openid的值,从而多次拉取列表的方式来满足需求, 将上一次调用得到的返回中的next_openid值,作为下一次调用中的next_openid值
- Returns:
- 用户对象集合
- Throws:
WeixinException- See Also:
-
获取关注者列表,
批量获取用户信息,
UserApi,Following,User,getFollowing(String)
-
getAllFollowingOpenIds
public List<String> getAllFollowingOpenIds() throws WeixinException
获取公众号全部的关注者列表 请慎重使用当公众号关注者数量超过10000时,可通过填写next_openid的值,从而多次拉取列表的方式来满足需求, 将上一次调用得到的返回中的next_openid值,作为下一次调用中的next_openid值
- Returns:
- 用户openid集合
- Throws:
WeixinException- See Also:
-
获取关注者列表,
UserApi,getFollowingOpenIds(String)
-
remarkUserName
public ApiResult remarkUserName(String openId, String remark) throws WeixinException
设置用户备注名- Parameters:
openId- 用户IDremark- 备注名- Throws:
WeixinException- See Also:
-
设置用户备注名,
UserApi
-
batchChangeOpenid
public List<ChangeOpenidResult> batchChangeOpenid(String fromAppid, List<String> openIds) throws WeixinException
公众号迁移批量转换openid- Parameters:
fromAppid- 原账号IDopenIds- 原账号openid列表,最多不能超过100个- Returns:
- 转换后的openid
- Throws:
WeixinException- See Also:
- openid转换,
ChangeOpenidResult,UserApi
-
changeAllOpenid
public List<ChangeOpenidResult> changeAllOpenid(String fromAppid) throws WeixinException
公众号迁移转换所有openid- Parameters:
fromAppid- 新appid- Returns:
- 转换后的openid
- Throws:
WeixinException- See Also:
- openid转换,
ChangeOpenidResult,UserApi
-
createGroup
public Group createGroup(String name) throws WeixinException
创建分组- Parameters:
name- 组名称- Returns:
- group对象
- Throws:
WeixinException- See Also:
-
创建分组,
Group,Group.toCreateJson(),GroupApi
-
getGroups
public List<Group> getGroups() throws WeixinException
查询所有分组- Returns:
- 组集合
- Throws:
WeixinException- See Also:
-
查询所有分组,
Group,GroupApi
-
getGroupByOpenId
public int getGroupByOpenId(String openId) throws WeixinException
查询用户所在分组- Parameters:
openId- 用户对应的ID- Returns:
- 组ID
- Throws:
WeixinException- See Also:
-
查询用户所在分组,
Group,GroupApi
-
modifyGroup
public ApiResult modifyGroup(int groupId, String name) throws WeixinException
修改分组名- Parameters:
groupId- 组IDname- 组名称- Throws:
WeixinException- See Also:
-
修改分组名,
Group,GroupApi
-
moveGroup
public ApiResult moveGroup(int groupId, String openId) throws WeixinException
移动用户到分组- Parameters:
groupId- 组IDopenId- 用户对应的ID- Throws:
WeixinException- See Also:
-
移动分组,
Group,GroupApi
-
moveGroup
public ApiResult moveGroup(int groupId, String... openIds) throws WeixinException
批量移动分组- Parameters:
groupId- 组IDopenIds- 用户ID列表(不能超过50个)- Throws:
WeixinException- See Also:
-
批量移动分组,
Group,GroupApi
-
deleteGroup
public ApiResult deleteGroup(int groupId) throws WeixinException
删除用户分组,所有该分组内的用户自动进入默认分组.- Parameters:
groupId- 组ID- Throws:
WeixinException- See Also:
-
删除用户分组,
Group,GroupApi
-
createMenu
public ApiResult createMenu(List<Button> buttons) throws WeixinException
自定义菜单- Parameters:
buttons- 菜单列表- Throws:
WeixinException- See Also:
-
创建自定义菜单,
Button,ButtonType,MenuApi
-
getMenu
public List<Button> getMenu() throws WeixinException
查询菜单- Returns:
- 菜单集合
- Throws:
WeixinException- See Also:
-
查询菜单,
Button,MenuApi
-
getAllMenu
public List<Menu> getAllMenu() throws WeixinException
查询全部菜单(包含个性化菜单)
-
deleteMenu
public ApiResult deleteMenu() throws WeixinException
删除菜单- Returns:
- 处理结果
- Throws:
WeixinException- See Also:
-
删除菜单,
MenuApi
-
createCustomMenu
public String createCustomMenu(List<Button> buttons, MenuMatchRule matchRule) throws WeixinException
创建个性化菜单- Parameters:
buttons- 菜单列表matchRule- 匹配规则 至少要有一个匹配信息是不为空- Returns:
- 菜单ID
- Throws:
WeixinException- See Also:
-
创建个性化菜单,
MenuApi,Button
-
deleteCustomMenu
public ApiResult deleteCustomMenu(String menuId) throws WeixinException
删除个性化菜单- Returns:
- 处理结果
- Throws:
WeixinException- See Also:
-
删除个性化菜单,
MenuApi
-
matchCustomMenu
public List<Button> matchCustomMenu(String userId) throws WeixinException
测试个性化菜单匹配结果- Parameters:
userId- 可以是粉丝的OpenID,也可以是粉丝的微信号。- Returns:
- 匹配到的菜单配置
- Throws:
WeixinException- See Also:
-
测试个性化菜单,
Button,MenuApi
-
createQR
public QRResult createQR(QRParameter parameter) throws WeixinException
生成带参数的二维码- Parameters:
parameter- 二维码参数- Returns:
- 二维码结果对象
- Throws:
WeixinException- See Also:
QRResult,QRParameter,QrApi, 生成二维码
-
setTmplIndustry
public ApiResult setTmplIndustry(IndustryType... industryTypes) throws WeixinException
设置所属行业(每月可修改行业1次,账号仅可使用所属行业中相关的模板)- Parameters:
industryTypes- 所处行业 目前不超过两个- Returns:
- 操作结果
- Throws:
WeixinException- See Also:
IndustryType,TmplApi, 设置所处行业
-
getTemplateId
public String getTemplateId(String shortId) throws WeixinException
获取模板ID- Parameters:
shortId- 模板库中模板的编号,有“TM**”和“OPENTMTM**”等形式- Returns:
- 模板ID
- Throws:
WeixinException- See Also:
-
获得模板ID,
TmplApi
-
getAllTemplates
public List<TemplateMessageInfo> getAllTemplates() throws WeixinException
获取模板列表- Returns:
- 模板列表
- Throws:
WeixinException- See Also:
TemplateMessageInfo, 获取模板列表,TmplApi
-
deleteTemplate
public ApiResult deleteTemplate(String templateId) throws WeixinException
删除模板- Parameters:
templateId- 公众帐号下模板消息ID- Returns:
- 处理结果
- Throws:
WeixinException- See Also:
-
删除模板,
TmplApi
-
sendTmplMessage
public String sendTmplMessage(TemplateMessage tplMessage) throws WeixinException
发送模板消息- Parameters:
tplMessage- 模板消息主体- Returns:
- 发送的消息ID
- Throws:
WeixinException- See Also:
-
模板消息,
运营规范,
TemplateMessage,TmplApi
-
getShorturl
public String getShorturl(String url) throws WeixinException
长链接转短链接- Parameters:
url- 待转换的链接- Returns:
- 短链接
- Throws:
WeixinException- See Also:
-
长链接转短链接,
HelperApi
-
semantic
public SemResult semantic(SemQuery semQuery) throws WeixinException
语义理解- Parameters:
semQuery- 语义理解协议- Returns:
- 语义理解结果
- Throws:
WeixinException- See Also:
SemQuery,SemResult, 语义理解,HelperApi
-
getWechatServerIp
public List<String> getWechatServerIp() throws WeixinException
获取微信服务器IP地址- Returns:
- IP地址
- Throws:
WeixinException- See Also:
-
获取IP地址,
HelperApi
-
clearQuota
public ApiResult clearQuota() throws WeixinException
接口调用次数调用清零:公众号调用接口并不是无限制的。为了防止公众号的程序错误而引发微信服务器负载异常,默认情况下, 每个公众号调用接口都不能超过一定限制 ,当超过一定限制时,调用对应接口会收到{"errcode":45009,"errmsg":"api freq out of limit" }错误返回码。- Returns:
- 操作结果
- Throws:
WeixinException- See Also:
-
接口清零,
HelperApi
-
getMenuSetting
public MenuSetting getMenuSetting() throws WeixinException
获取公众号当前使用的自定义菜单的配置,如果公众号是通过API调用设置的菜单,则返回菜单的开发配置, 而如果公众号是在公众平台官网通过网站功能发布菜单,则本接口返回运营者设置的菜单配置。- Returns:
- 菜单集合
- Throws:
WeixinException- See Also:
-
获取自定义菜单配置,
Button,MpArticle,HelperApi
-
getAutoReplySetting
public AutoReplySetting getAutoReplySetting() throws WeixinException
获取公众号当前使用的自动回复规则,包括关注后自动回复、消息自动回复(60分钟内触发一次)、关键词自动回复。- Throws:
WeixinException- See Also:
AutoReplySetting,HelperApi, 获取自动回复规则
-
datacube
public List<?> datacube(DatacubeType datacubeType, Date beginDate, Date endDate) throws WeixinException
数据统计- Parameters:
datacubeType- 数据统计类型beginDate- 获取数据的起始日期,begin_date和end_date的差值需小于“最大时间跨度”(比如最大时间跨度为1时, begin_date和end_date的差值只能为0,才能小于1),否则会报错endDate- 获取数据的结束日期,end_date允许设置的最大值为昨日- Returns:
- 统计结果
- Throws:
WeixinException- See Also:
DataApi,UserSummary,ArticleSummary,ArticleTotal,ArticleDatacubeShare,UpstreamMsg,UpstreamMsgDist,InterfaceSummary, 用户分析, 图文分析, 消息分析, 接口分析
-
datacube
public List<?> datacube(DatacubeType datacubeType, Date beginDate, int offset) throws WeixinException
数据统计- Parameters:
datacubeType- 统计类型beginDate- 开始日期offset- 增量 表示向前几天 比如 offset=1 则查询 beginDate的后一天之间的数据- Throws:
WeixinException- See Also:
DataApi
-
datacube
public List<?> datacube(DatacubeType datacubeType, int offset, Date endDate) throws WeixinException
数据统计- Parameters:
datacubeType- 统计类型offset- 增量 表示向后几天 比如 offset=1 则查询 beginDate的前一天之间的数据endDate- 截至日期- Throws:
WeixinException- See Also:
DataApi
-
datacube
public List<?> datacube(DatacubeType datacubeType, Date date) throws WeixinException
查询日期跨度为0的统计数据(当天)- Parameters:
datacubeType- 统计类型date- 统计日期- Throws:
WeixinException- See Also:
DataApi
-
createTag
public Tag createTag(String name) throws WeixinException
创建标签- Parameters:
name- 标签名(30个字符以内)- Returns:
- 标签对象
- Throws:
WeixinException- See Also:
TagApi,Tag, 创建标签
-
listTags
public List<Tag> listTags() throws WeixinException
获取标签- Returns:
- 标签列表
- Throws:
WeixinException- See Also:
TagApi,Tag, 获取标签
-
updateTag
public ApiResult updateTag(Tag tag) throws WeixinException
更新标签- Parameters:
tag- 标签对象- Returns:
- 操作结果
- Throws:
WeixinException- See Also:
TagApi,Tag, 更新标签
-
deleteTag
public ApiResult deleteTag(int tagId) throws WeixinException
删除标签- Parameters:
tagId- 标签id- Returns:
- 操作结果
- Throws:
WeixinException- See Also:
TagApi, 删除标签
-
taggingUsers
public ApiResult taggingUsers(int tagId, String... openIds) throws WeixinException
批量为用户打标签:标签功能目前支持公众号为用户打上最多三个标签- Parameters:
tagId- 标签IDopenIds- 用户ID- Returns:
- 操作结果
- Throws:
WeixinException- See Also:
TagApi, 批量为用户打标签
-
untaggingUsers
public ApiResult untaggingUsers(int tagId, String... openIds) throws WeixinException
批量为用户取消标签- Parameters:
tagId- 标签IDopenIds- 用户ID- Returns:
- 操作结果
- Throws:
WeixinException- See Also:
TagApi, 批量为用户取消标签
-
getTagFollowingOpenIds
public Following getTagFollowingOpenIds(int tagId, String nextOpenId) throws WeixinException
获取标签下粉丝列表- Parameters:
tagId- 标签IDnextOpenId- 第一个拉取的OPENID,不填默认从头开始拉取- Returns:
- 用户openid列表
- Throws:
WeixinException- See Also:
TagApi, 获取标签下粉丝列表
-
getTagFollowing
public Following getTagFollowing(int tagId, String nextOpenId) throws WeixinException
获取标签下粉丝列表 请慎重使用- Parameters:
tagId- 标签IDnextOpenId- 第一个拉取的OPENID,不填默认从头开始拉取- Returns:
- 被打标签者信息 包含用户的详细信息
- Throws:
WeixinException- See Also:
TagApi, 获取标签下粉丝列表
-
getAllTagFollowingOpenIds
public List<String> getAllTagFollowingOpenIds(int tagId) throws WeixinException
获取标签下全部的粉丝列表 请慎重使用- Parameters:
tagId- 标签ID- Returns:
- 用户openid列表
- Throws:
WeixinException- See Also:
TagApi,getTagFollowingOpenIds(int,String), 获取标签下粉丝列表
-
getAllTagFollowing
public List<User> getAllTagFollowing(int tagId) throws WeixinException
获取标签下全部的粉丝列表 请慎重使用- Parameters:
tagId- 标签ID- Returns:
- 被打标签者信息 包含用户的详细信息
- Throws:
WeixinException- See Also:
TagApi,getTagFollowing(int,String), 获取标签下粉丝列表
-
getUserTags
public Integer[] getUserTags(String openId) throws WeixinException
获取用户身上的标签列表- Parameters:
openId- 用户ID- Returns:
- 标签ID集合
- Throws:
WeixinException- See Also:
TagApi, 获取用户身上的标签列表
-
getBalcklistOpenIds
public Following getBalcklistOpenIds(String nextOpenId) throws WeixinException
获取公众号的黑名单列表- Parameters:
nextOpenId- 下一次拉取数据的openid 不填写则默认从头开始拉取- Returns:
- 拉黑用户列表 不包含用户的详细信息
- Throws:
WeixinException- See Also:
- 获取黑名单列表,
TagApi,Following
-
getAllBalcklistOpenIds
public List<String> getAllBalcklistOpenIds() throws WeixinException
获取公众号全部的黑名单列表 请慎重使用当公众号关注者数量超过10000时,可通过填写next_openid的值,从而多次拉取列表的方式来满足需求, 将上一次调用得到的返回中的next_openid值,作为下一次调用中的next_openid值
- Returns:
- 用户openid集合
- Throws:
WeixinException- See Also:
TagApi, 获取黑名单列表,getFollowingOpenIds(String)
-
batchBlacklist
public ApiResult batchBlacklist(boolean blacklist, String... openIds) throws WeixinException
黑名单操作- Parameters:
blacklist- true=拉黑用户,false=取消拉黑用户openIds- 用户ID列表- Returns:
- 操作结果
- Throws:
WeixinException- See Also:
TagApi, 黑名单操作
-
createCardCoupon
public String createCardCoupon(CardCoupon cardCoupon) throws WeixinException
创建卡券:创建卡券接口是微信卡券的基础接口,用于创建一类新的卡券,获取card_id,创建成功并通过审核后, 商家可以通过文档提供的其他接口将卡券下发给用户,每次成功领取,库存数量相应扣除。- 1.需自定义Code码的商家必须在创建卡券时候,设定use_custom_code为true,且在调用投放卡券接口时填入指定的Code码。 指定OpenID同理。特别注意:在公众平台创建的卡券均为非自定义Code类型。
- 2.can_share字段指领取卡券原生页面是否可分享,建议指定Code码、指定OpenID等强限制条件的卡券填写false。
- 3.创建成功后该卡券会自动提交审核 ,审核结果将通过事件通知商户。开发者可调用设置白名单接口设置用户白名单,领取未通过审核的卡券,测试整个卡券的使用流程。
- Parameters:
cardCoupon- 卡券对象- Returns:
- 卡券ID
- Throws:
WeixinException- See Also:
-
创建卡券,
CardCoupons,MediaApi.uploadImage(java.io.InputStream, String),CardApi
-
getCardInfo
public com.alibaba.fastjson.JSONObject getCardInfo(String cardId) throws WeixinException
查询某个card_id的创建信息、审核状态以及库存数量。- Parameters:
cardId-- Returns:
- Throws:
WeixinException
-
setCardPayCell
public ApiResult setCardPayCell(String cardId, boolean isOpen) throws WeixinException
设置卡券买单:创建卡券之后,开发者可以通过设置微信买单接口设置该card_id支持微信买单功能。值得开发者注意的是, 设置买单的card_id必须已经配置了门店,否则会报错。- Parameters:
cardId- 卡券IDisOpen- 是否开启买单功能,填true/false- Returns:
- 操作结果
- Throws:
WeixinException- See Also:
createCardCoupon(CardCoupon),CardApi
-
setCardSelfConsumeCell
public ApiResult setCardSelfConsumeCell(String cardId, boolean isOpen) throws WeixinException
设置自助核销:创建卡券之后,开发者可以通过设置微信买单接口设置该card_id支持自助核销功能。值得开发者注意的是, 设置自助核销的card_id必须已经配置了门店,否则会报错。- Parameters:
cardId- 卡券IDisOpen- 是否开启买单功能,填true/false- Returns:
- 操作结果
- Throws:
WeixinException- See Also:
createCardCoupon(CardCoupon),CardApi
-
createCardQR
public QRResult createCardQR(Integer expireSeconds, CardQR... cardQRs) throws WeixinException
创建卡券二维码: 开发者可调用该接口生成一张卡券二维码供用户扫码后添加卡券到卡包。- Parameters:
expireSeconds- 指定二维码的有效时间,范围是60 ~ 1800秒。不填默认为365天有效cardQRs- 二维码参数:二维码领取单张卡券/多张卡券- Returns:
- 二维码结果对象
- Throws:
WeixinException- See Also:
QRResult,QRParameter,CardApi, 投放卡券
-
addGiftCardPage
public String addGiftCardPage(GiftCardPage page) throws WeixinException
微信礼品卡货架创建接口,开发者可以通过该接口创建一个礼品卡货架并且用于公众号、门店的礼品卡售卖。- Parameters:
page- 货架对象- Returns:
- 货架ID
- Throws:
WeixinException- See Also:
- 微信礼品卡
-
getGiftCardPage
public com.alibaba.fastjson.JSONObject getGiftCardPage(String pageId) throws WeixinException
查询礼品卡货架信息接口- Parameters:
pageId- 货架ID- Returns:
- Throws:
WeixinException
-
maintainGiftCardPage
public ApiResult maintainGiftCardPage(String pageId) throws WeixinException
下架一个礼品卡货架- Parameters:
pageId-- Returns:
- Throws:
WeixinException
-
maintainAllGiftCardPage
public ApiResult maintainAllGiftCardPage() throws WeixinException
下架所有礼品卡货架- Returns:
- Throws:
WeixinException
-
getGiftCardPageIdList
public String[] getGiftCardPageIdList() throws WeixinException
查询当前商户下所有的礼品卡货架id- Returns:
- Throws:
WeixinException
-
updateGiftCardPage
public ApiResult updateGiftCardPage(GiftCardPage page) throws WeixinException
修改礼品卡货架信息接口- Parameters:
page- 货架对象- Returns:
- Throws:
WeixinException
-
addGiftCardPayWhitelist
public String addGiftCardPayWhitelist(String subMchId) throws WeixinException
申请礼品卡的微信支付权限- Parameters:
subMchId- 子商户号- Returns:
- 微信支付商户平台确认地址
- Throws:
WeixinException
-
bindGiftCardPaySubMch
public ApiResult bindGiftCardPaySubMch(String wxaAppid, String subMchId) throws WeixinException
绑定商户号到礼品卡小程序- Parameters:
wxaAppid- 微信小程序IDsubMchId- 微信支付商户号- Returns:
- Throws:
WeixinException
-
setGiftCardWxaCode
public ApiResult setGiftCardWxaCode(String wxaAppid, String pageId) throws WeixinException
上传礼品卡小程序代码 (提供小程序APPID及货架ID,由微信平台为你小程序帐号上传一套现成的礼品卡小程序,直接用于礼品卡售卖)- Parameters:
wxaAppid- 微信小程序APPIDpageId- 礼品卡货架ID- Returns:
- Throws:
WeixinException
-
consumeGiftCard
public ApiResult consumeGiftCard(String code, String cardId) throws WeixinException
当礼品卡被使用完毕或者发生转存、绑定等操作后,开发者可以通过该接口核销用户的礼品卡,使礼品卡在列表中沉底并不再被使用。 注意:需在礼品卡核销前调用,否则会报40099 已核销的错误- Parameters:
code- 卡券Code码。cardId- 卡券ID,自定义code卡券必填,否则非必填。- Returns:
- Throws:
WeixinException
-
getGiftCardInfo
public com.alibaba.fastjson.JSONObject getGiftCardInfo(String code, String cardId) throws WeixinException
开发者可以通过该接口查询到code对应的信息,如余额、有效期、订单号等,主要用于防止在交易完成后丢单的情况下,用于核销/余额变动时兜底处理。- Parameters:
code- 卡券Code码cardId- 卡券ID,自定义code卡券必填,否则非必填。- Returns:
- Throws:
WeixinException
-
getGiftCardOrderInfo
public com.alibaba.fastjson.JSONObject getGiftCardOrderInfo(String orderId) throws WeixinException
查询某个订单号对应的订单详情- Parameters:
orderId- 礼品卡订单号,商户可以通过购买成功的事件推送或者批量查询订单接口获得- Returns:
- Throws:
WeixinException
-
getGiftCardOrders
public com.alibaba.fastjson.JSONObject getGiftCardOrders(long beginTime, long endTime, String sortType, int offset, int limit) throws WeixinException批量查询礼品卡订单信息接口- Parameters:
beginTime- 查询的时间起点,十位时间戳(utc+8)endTime- 查询的时间终点,十位时间戳(utc+8)sortType- 填"ASC" / "DESC",表示对订单创建时间进行“升 / 降”排序offset- 查询的订单偏移量,如填写100则表示从第100个订单开始拉取limit- 查询订单的数量,如offset填写100,count填写10,则表示查询第100个到第110个订单- Returns:
- Throws:
WeixinException
-
updateGiftCardUserBalance
public com.alibaba.fastjson.JSONObject updateGiftCardUserBalance(CardInfo cardInfo) throws WeixinException
更新用户礼品卡信息 当礼品卡被使用后,可以通过该接口变更某个礼品卡的余额信息。- Parameters:
cardInfo-- Returns:
- Throws:
WeixinException
-
giftCardOrderRefund
public ApiResult giftCardOrderRefund(String orderId) throws WeixinException
对一笔礼品卡订单操作退款- Parameters:
orderId- 订单ID- Returns:
- Throws:
WeixinException
-
openComment
public ApiResult openComment(boolean open, String msgid, int index) throws WeixinException
打开/关闭已群发文章评论- Parameters:
open- true为打开,false为关闭msgid- 群发返回的msg_data_idindex- 多图文时,用来指定第几篇图文,从0开始,不带默认操作该msg_data_id的第一篇图文- Returns:
- 操作结果
- Throws:
WeixinException- See Also:
ComponentApi
-
listArticleComments
public Pagedata<ArticleComment> listArticleComments(Pageable page, ArticleComment.ArticleCommentType commentType, String msgid, int index) throws WeixinException
获取评论列表- Parameters:
page- 分页信息commentType- 评论类型 为空获取全部类型msgid- 群发返回的msg_data_idindex- 多图文时,用来指定第几篇图文,从0开始,不带默认操作该msg_data_id的第一篇图文- Returns:
- 分页数据
- Throws:
WeixinException- See Also:
ArticleComment,ArticleComment.ArticleCommentType,ComponentApi
-
listAllArticleComments
public List<ArticleComment> listAllArticleComments(ArticleComment.ArticleCommentType commentType, String msgid, int index) throws WeixinException
获取评论列表- Parameters:
commentType- 评论类型 为空获取全部类型msgid- 群发返回的msg_data_idindex- 多图文时,用来指定第几篇图文,从0开始,不带默认操作该msg_data_id的第一篇图文- Returns:
- 分页数据
- Throws:
WeixinException- See Also:
ComponentApi,listArticleComments(Pageable, ArticleCommentType, String, int)
-
markelectComment
public ApiResult markelectComment(boolean markelect, String msgid, int index, String commentId) throws WeixinException
评论标记/取消精选- Parameters:
markelect- true为标记,false为取消msgid- 群发返回的msg_data_idindex- 多图文时,用来指定第几篇图文,从0开始,不带默认操作该msg_data_id的第一篇图文commentId- 用户评论ID- Returns:
- 操作结果
- Throws:
WeixinException- See Also:
ComponentApi,listArticleComments(Pageable, ArticleCommentType, String, int)
-
deleteComment
public ApiResult deleteComment(String msgid, int index, String commentId) throws WeixinException
删除评论- Parameters:
msgid- 群发返回的msg_data_idindex- 多图文时,用来指定第几篇图文,从0开始,不带默认操作该msg_data_id的第一篇图文commentId- 用户评论ID- Returns:
- 操作结果
- Throws:
WeixinException- See Also:
ComponentApi,listArticleComments(Pageable, ArticleCommentType, String, int)
-
replyComment
public ApiResult replyComment(String msgid, int index, String commentId, String content) throws WeixinException
回复评论- Parameters:
msgid- 群发返回的msg_data_idindex- 多图文时,用来指定第几篇图文,从0开始,不带默认操作该msg_data_id的第一篇图文commentId- 用户评论IDcontent- 回复内容- Returns:
- 操作结果
- Throws:
WeixinException- See Also:
ComponentApi,listArticleComments(Pageable, ArticleCommentType, String, int)
-
deleteCommentReply
public ApiResult deleteCommentReply(String msgid, int index, String commentId) throws WeixinException
删除回复- Parameters:
msgid- 群发返回的msg_data_idindex- 多图文时,用来指定第几篇图文,从0开始,不带默认操作该msg_data_id的第一篇图文commentId- 用户评论ID- Returns:
- 操作结果
- Throws:
WeixinException- See Also:
ComponentApi,listArticleComments(Pageable, ArticleCommentType, String, int)
-
-