Package com.foxinmy.weixin4j.mp.api
Class TmplApi
- java.lang.Object
-
- com.foxinmy.weixin4j.api.BaseApi
-
- com.foxinmy.weixin4j.mp.api.MpApi
-
- com.foxinmy.weixin4j.mp.api.TmplApi
-
public class TmplApi extends MpApi
模板消息相关API- Since:
- JDK 1.6
- Author:
- jinyu(foxinmy@gmail.com)
-
-
Field Summary
-
Fields inherited from class com.foxinmy.weixin4j.api.BaseApi
weixinExecutor
-
-
Constructor Summary
Constructors Constructor Description TmplApi(TokenManager tokenManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ApiResultdeleteTemplate(String templateId)删除模板List<TemplateMessageInfo>getAllTemplates()获取模板列表StringgetTemplateId(String shortId)获取模板IDIndustryType[]getTmplIndustry()获取设置的行业信息StringsendTmplMessage(TemplateMessage tplMessage)发送模板消息ApiResultsetTmplIndustry(IndustryType... industryTypes)设置所属行业(每月可修改行业1次,账号仅可使用所属行业中相关的模板)-
Methods inherited from class com.foxinmy.weixin4j.mp.api.MpApi
weixinBundle
-
Methods inherited from class com.foxinmy.weixin4j.api.BaseApi
getRequestUri
-
-
-
-
Constructor Detail
-
TmplApi
public TmplApi(TokenManager tokenManager)
-
-
Method Detail
-
setTmplIndustry
public ApiResult setTmplIndustry(IndustryType... industryTypes) throws WeixinException
设置所属行业(每月可修改行业1次,账号仅可使用所属行业中相关的模板)- Parameters:
industryTypes- 所处行业 目前不超过两个- Returns:
- 操作结果
- Throws:
WeixinException- See Also:
IndustryType, 设置所处行业
-
getTmplIndustry
public IndustryType[] getTmplIndustry() throws WeixinException
获取设置的行业信息- Returns:
- 行业信息数组 第一个元素为帐号设置的主营行业 第二个元素为帐号设置的副营行业
- Throws:
WeixinException- See Also:
IndustryType, 获取设置的行业信息
-
getTemplateId
public String getTemplateId(String shortId) throws WeixinException
获取模板ID- Parameters:
shortId- 模板库中模板的编号,有“TM**”和“OPENTMTM**”等形式- Returns:
- 模板ID
- Throws:
WeixinException- See Also:
- 获得模板ID
-
getAllTemplates
public List<TemplateMessageInfo> getAllTemplates() throws WeixinException
获取模板列表- Returns:
- 模板列表
- Throws:
WeixinException- See Also:
TemplateMessageInfo, 获取模板列表
-
deleteTemplate
public ApiResult deleteTemplate(String templateId) throws WeixinException
删除模板- Parameters:
templateId- 公众帐号下模板消息ID- Returns:
- 处理结果
- Throws:
WeixinException- See Also:
- 删除模板
-
sendTmplMessage
public String sendTmplMessage(TemplateMessage tplMessage) throws WeixinException
发送模板消息- Parameters:
tplMessage- 消息对象- Returns:
- 发送的消息ID
- Throws:
WeixinException- See Also:
- 模板消息,
运营规范,
TemplateMessage,com.foxinmy.weixin4j.msg.event.TemplatesendjobfinishMessage
-
-