Package com.foxinmy.weixin4j.wxa.api
Class TemplateMessageApi
- java.lang.Object
-
- com.foxinmy.weixin4j.api.BaseApi
-
- com.foxinmy.weixin4j.wxa.api.TemplateMessageApi
-
public class TemplateMessageApi extends com.foxinmy.weixin4j.api.BaseApi
发送模板消息。- Since:
- 1.8
- See Also:
- 发送模板消息
-
-
Constructor Summary
Constructors Constructor Description TemplateMessageApi(com.foxinmy.weixin4j.token.TokenManager tokenManager)
TemplateMessageApi(com.foxinmy.weixin4j.token.TokenManager tokenManager, Properties properties)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
getRequestUri(String key)
void
sendTemplateMessage(String toUser, String templateId, String page, String formId, Map<String,String> data, String emphasisKeyword)
发送模板消息protected ResourceBundle
weixinBundle()
-
-
-
Constructor Detail
-
TemplateMessageApi
public TemplateMessageApi(com.foxinmy.weixin4j.token.TokenManager tokenManager)
-
TemplateMessageApi
public TemplateMessageApi(com.foxinmy.weixin4j.token.TokenManager tokenManager, Properties properties)
-
-
Method Detail
-
sendTemplateMessage
public void sendTemplateMessage(String toUser, String templateId, String page, String formId, Map<String,String> data, String emphasisKeyword) throws com.foxinmy.weixin4j.exception.WeixinException
发送模板消息- Parameters:
toUser
- 接收者(用户)的 openid。templateId
- 所需下发的模板消息的 id。page
- 点击模板卡片后的跳转页面,仅限本小程序内的页面。支持带参数,(示例index?foo=bar)。该字段不填则模板无跳转。formId
- 表单提交场景下,为 submit 事件带上的 formId;支付场景下,为本次支付的 prepay_id。data
- 模板内容,不填则下发空模板。emphasisKeyword
- 模板需要放大的关键词,不填则默认无放大。- Throws:
com.foxinmy.weixin4j.exception.WeixinException
- indicates getting access token failed, or sending template message failed.- See Also:
- 发送模板消息
-
weixinBundle
protected ResourceBundle weixinBundle()
- Specified by:
weixinBundle
in classcom.foxinmy.weixin4j.api.BaseApi
-
-