W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗值獎勵
本接口應(yīng)在服務(wù)器端調(diào)用,詳細說明參見服務(wù)端API。
本接口支持云調(diào)用。需開發(fā)者工具版本 >= 1.02.1904090(最新穩(wěn)定版下載)
wx-server-sdk >= 0.4.0
獲取模板標題下的關(guān)鍵詞列表
調(diào)用方式:
GET https://api.weixin.qq.com/wxaapi/newtmpl/getpubtemplatekeywords?access_token=ACCESS_TOKEN
屬性 | 類型 | 默認值 | 必填 | 說明 |
---|---|---|---|---|
access_token | string | 是 | 接口調(diào)用憑證 | |
tid | string | 是 | 模板標題 id,可通過接口獲取 |
返回的 JSON 數(shù)據(jù)包
屬性 | 類型 | 說明 |
---|---|---|
errcode | number | 錯誤碼 |
errmsg | string | 錯誤信息 |
count | number | 模版標題列表總數(shù) |
data | Array.<Object> | 關(guān)鍵詞列表 |
data 的結(jié)構(gòu)
屬性 | 類型 | 說明 |
---|---|---|
kid | number | 關(guān)鍵詞 id,選用模板時需要 |
name | string | 關(guān)鍵詞內(nèi)容 |
example | string | 關(guān)鍵詞內(nèi)容對應(yīng)的示例 |
rule | string | 參數(shù)類型 |
{
"tid": "99"
}
{
"errcode": 0,
"errmsg": "ok",
"data": [
{
"kid": 1,
"name": "物品名稱",
"example": "名稱",
"rule": "thing"
}
]
}
云調(diào)用是小程序·云開發(fā)提供的在云函數(shù)中調(diào)用微信開放接口的能力,需要在云函數(shù)中通過 wx-server-sdk 使用。
openapi.subscribeMessage.getPubTemplateKeyWordsById
需在 config.json 中配置 subscribeMessage.getPubTemplateKeyWordsById API 的權(quán)限,詳情
屬性 | 類型 | 默認值 | 必填 | 說明 |
---|---|---|---|---|
tid | string | 是 | 模板標題 id,可通過接口獲取 |
返回的 JSON 數(shù)據(jù)包
屬性 | 類型 | 說明 |
---|---|---|
errCode | number | 錯誤碼 |
errMsg | string | 錯誤信息 |
count | number | 模版標題列表總數(shù) |
data | Array.<Object> | 關(guān)鍵詞列表 |
data 的結(jié)構(gòu)
屬性 | 類型 | 說明 |
---|---|---|
kid | number | 關(guān)鍵詞 id,選用模板時需要 |
name | string | 關(guān)鍵詞內(nèi)容 |
example | string | 關(guān)鍵詞內(nèi)容對應(yīng)的示例 |
rule | string | 參數(shù)類型 |
拋出的異常
屬性 | 類型 | 說明 |
---|---|---|
errCode | number | 錯誤碼 |
errMsg | string | 錯誤信息 |
errCode 的合法值
值 | 說明 | 最低版本 |
---|
const cloud = require('wx-server-sdk')
cloud.init()
exports.main = async (event, context) => {
try {
const result = await cloud.openapi.subscribeMessage.getPubTemplateKeyWordsById({
tid: ''
})
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.getPubTemplateKeyWordsById({
tid: '99'
})
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.getPubTemplateKeyWordsById({
errcode: 0,
errmsg: 'ok',
data: [
{
kid: 1,
name: '物品名稱',
example: '名稱',
rule: 'thing'
}
]
})
return result
} catch (err) {
return err
}
}
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報電話:173-0602-2364|舉報郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: