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