小程序订阅事件服务器,微信小程序 订阅消息·getPubTemplateTitleList

subscribeMessage.getPubTemplateTitleList

本接口应在服务器端调用,详细说明参见服务端API。

本接口支持云调用。需开发者工具版本 >= 1.02.1904090(最新稳定版下载)

wx-server-sdk >= 0.4.0

获取帐号所属类目下的公共模板标题

调用方式:

HTTPS 调用

云调用

HTTPS 调用

请求地址GET https://api.weixin.qq.com/wxaapi/newtmpl/getpubtemplatetitles?access_token=ACCESS_TOKEN

请求参数

属性

类型

默认值

必填

说明

access_token

string

ids

string

类目 id,多个用逗号隔开

start

number

用于分页,表示从 start 开始。从 0 开始计数。

limit

number

用于分页,表示拉取 limit 条记录。最大为 30。

返回值

Object

返回的 JSON 数据包

属性

类型

说明

errcode

number

错误码

errmsg

string

错误信息

count

number

模版标题列表总数

data

Array.

模板标题列表

errcode 的合法值

说明

最低版本

200016

start 参数错误

200017

limit 参数错误

200018

类目 ids 缺失

200019

类目 ids 不合法

data 的结构

属性

类型

说明

tid

number

模版标题 id

title

string

模版标题

type

number

模版类型,2 为一次性订阅,3 为长期订阅

categoryId

number

模版所属类目 id

请求示例{

"ids": "2,616",

"start": 0,

"limit": 1

}

响应示例{

"errcode": 0,

"errmsg": "ok",

"count": 55,

"data": [

{

"tid": 99,

"title": "付款成功通知",

"type": 2,

"categoryId": "616"

}

]

}

云调用

云调用是小程序·云开发提供的在云函数中调用微信开放接口的能力,需要在云函数中通过 wx-server-sdk 使用。

接口方法openapi.subscribeMessage.getPubTemplateTitleList

需在 config.json 中配置 subscribeMessage.getPubTemplateTitleList API 的权限,详情

请求参数

属性

类型

默认值

必填

说明

ids

string

类目 id,多个用逗号隔开

start

number

用于分页,表示从 start 开始。从 0 开始计数。

limit

number

用于分页,表示拉取 limit 条记录。最大为 30。

返回值

Object

返回的 JSON 数据包

属性

类型

说明

errCode

number

错误码

errMsg

string

错误信息

count

number

模版标题列表总数

data

Array.

模板标题列表

errCode 的合法值

说明

最低版本

0

成功

data 的结构

属性

类型

说明

tid

number

模版标题 id

title

string

模版标题

type

number

模版类型,2 为一次性订阅,3 为长期订阅

categoryId

number

模版所属类目 id

异常

Object

抛出的异常

属性

类型

说明

errCode

number

错误码

errMsg

string

错误信息

errCode 的合法值

说明

最低版本

200016

start 参数错误

200017

limit 参数错误

200018

类目 ids 缺失

200019

类目 ids 不合法

请求示例const cloud = require('wx-server-sdk')

cloud.init()

exports.main = async (event, context) => {

try {

const result = await cloud.openapi.subscribeMessage.getPubTemplateTitleList({

ids: '',

start: '',

limit: ''

})

return result

} catch (err) {

return err

}

}

请求示例const cloud = require('wx-server-sdk')

cloud.init()

exports.main = async (event, context) => {

try {

const result = await cloud.openapi.subscribeMessage.getPubTemplateTitleList({

ids: '2,616',

start: 0,

limit: 1

})

return result

} catch (err) {

return err

}

}

响应示例{

"errCode": 0,

"errMsg": "openapi.subscribeMessage.getPubTemplateTitleList:ok",

"count": 55,

"data": [

{

"tid": 99,

"title": "付款成功通知",

"type": 2,

"categoryId": "616"

}

]

}

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值