com.foxinmy.weixin4j.mp.api
Class TmplApi

java.lang.Object
  extended by com.foxinmy.weixin4j.api.BaseApi
      extended by com.foxinmy.weixin4j.mp.api.MpApi
          extended by com.foxinmy.weixin4j.mp.api.TmplApi

public class TmplApi
extends MpApi

模板消息相关API

Since:
JDK 1.6
Author:
jinyu(foxinmy@gmail.com)
See Also:

Constructor Summary
TmplApi(TokenManager tokenManager)
           
 
Method Summary
 ApiResult deleteTemplate(String templateId)
          删除模板
 List<TemplateMessageInfo> getAllTemplates()
          获取模板列表
 String getTemplateId(String shortId)
          获取模板ID
 IndustryType[] getTmplIndustry()
          获取设置的行业信息
 String sendTmplMessage(TemplateMessage tplMessage)
          发送模板消息
 ApiResult setTmplIndustry(IndustryType... industryTypes)
          设置所属行业(每月可修改行业1次,账号仅可使用所属行业中相关的模板)
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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


Copyright © 2014–2017. All rights reserved.