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)
 
- 
- 
Constructor SummaryConstructors Constructor Description TmplApi(com.foxinmy.weixin4j.token.TokenManager tokenManager)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description com.foxinmy.weixin4j.http.weixin.ApiResultdeleteTemplate(String templateId)删除模板List<TemplateMessageInfo>getAllTemplates()获取模板列表StringgetTemplateId(String shortId)获取模板IDIndustryType[]getTmplIndustry()获取设置的行业信息StringsendTmplMessage(TemplateMessage tplMessage)发送模板消息com.foxinmy.weixin4j.http.weixin.ApiResultsetTmplIndustry(IndustryType... industryTypes)设置所属行业(每月可修改行业1次,账号仅可使用所属行业中相关的模板)- 
Methods inherited from class com.foxinmy.weixin4j.mp.api.MpApiweixinBundle
 
- 
 
- 
- 
- 
Method Detail- 
setTmplIndustrypublic com.foxinmy.weixin4j.http.weixin.ApiResult setTmplIndustry(IndustryType... industryTypes) throws com.foxinmy.weixin4j.exception.WeixinException 设置所属行业(每月可修改行业1次,账号仅可使用所属行业中相关的模板)- Parameters:
- industryTypes- 所处行业 目前不超过两个
- Returns:
- 操作结果
- Throws:
- com.foxinmy.weixin4j.exception.WeixinException
- See Also:
- IndustryType, 设置所处行业
 
 - 
getTmplIndustrypublic IndustryType[] getTmplIndustry() throws com.foxinmy.weixin4j.exception.WeixinException 获取设置的行业信息- Returns:
- 行业信息数组 第一个元素为帐号设置的主营行业 第二个元素为帐号设置的副营行业
- Throws:
- com.foxinmy.weixin4j.exception.WeixinException
- See Also:
- IndustryType, 获取设置的行业信息
 
 - 
getTemplateIdpublic String getTemplateId(String shortId) throws com.foxinmy.weixin4j.exception.WeixinException 获取模板ID- Parameters:
- shortId- 模板库中模板的编号,有“TM**”和“OPENTMTM**”等形式
- Returns:
- 模板ID
- Throws:
- com.foxinmy.weixin4j.exception.WeixinException
- See Also:
- 获得模板ID
 
 - 
getAllTemplatespublic List<TemplateMessageInfo> getAllTemplates() throws com.foxinmy.weixin4j.exception.WeixinException 获取模板列表- Returns:
- 模板列表
- Throws:
- com.foxinmy.weixin4j.exception.WeixinException
- See Also:
- TemplateMessageInfo, 获取模板列表
 
 - 
deleteTemplatepublic com.foxinmy.weixin4j.http.weixin.ApiResult deleteTemplate(String templateId) throws com.foxinmy.weixin4j.exception.WeixinException 删除模板- Parameters:
- templateId- 公众帐号下模板消息ID
- Returns:
- 处理结果
- Throws:
- com.foxinmy.weixin4j.exception.WeixinException
- See Also:
- 删除模板
 
 - 
sendTmplMessagepublic String sendTmplMessage(TemplateMessage tplMessage) throws com.foxinmy.weixin4j.exception.WeixinException 发送模板消息- Parameters:
- tplMessage- 消息对象
- Returns:
- 发送的消息ID
- Throws:
- com.foxinmy.weixin4j.exception.WeixinException
- See Also:
- 模板消息, 
运营规范, 
TemplateMessage,com.foxinmy.weixin4j.msg.event.TemplatesendjobfinishMessage
 
 
- 
 
-