1.4、param
param(动态参数)。content为文本、action带有链接路径 能够添加动态参数,动态参数是在模板发送或申请短链时作替换。
param参数:
| 字段 | 数据类型 | 是否必有 | 描述 |
|---|---|---|---|
| type | int | 是 | 类型,必填1 |
| name | string | 是 | 动态参数名称 以${}标识动态参数,{}中填写参数名称,只能输入数字、英文字母、下划线。 字符长度[1, 20] |
| path | int | 是 | 参数所处content的position值,见:示例 |
| index | int | 是 | 指明此参数是所处content中的第几个参数 见:示例 |
| lengthType | int | 是 | 参数类型 1:可变长度(参数长度在范围内) 2:固定长度(参数长度是定长) |
| maxLength | int | 条件 | 当:lengthType = 取值范围[1, 100] 发送消息会替换参数,会以此校验替换值 需:minLength≤ maxLength |
| minLength | int | 条件 | 当:lengthType = 取值范围[1, 100] 发送消息会替换参数,会以此校验替换值 需:minLength≤ maxLength |
| example | string | 是 | 参数示例(给审核人员作参考) 当:lengthType = |
示例:多图文–携带动态参数
POST /aim/template/addAimTemplate HTTP/1.1
Content-Type: application/json
Accept: application/json
Authorization: ZGgxODUyODo1ZDM4MGFiYjQyZWY3YzRiMjVjNDUyOGQyMTcxNmVjMA==
Date: 2023-02-16 19:09:38
User-Agent: PostmanRuntime/7.31.0
Postman-Token: 9519a098-c502-44eb-97e4-308d169044cd
Host: 172.18.1.104:31205
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Content-Length: 2294
{
"aimNumber": "",
"name": "动态参数测试模板",
"remark": "多图文测试",
"templateType": 1,
"pages": [
{
"contents": [
{
"position": 1,
"type": 2,
"srcType": 1,
"src": "2f7c25c1f2ef4baa89d943aec2e8ff84",
"actionType": 8,
"action": {
"target": "https://www.baidu.com",
"merchantName": "正在跳转"
}
},
{
"position": 2,
"type": 1,
"content": "标题${param1}测试${param2}"
},
{
"position": 3,
"type": 2,
"srcType": 1,
"src": "70dfe28fc04a45eaacb0e0b26002071b",
"actionType": 8,
"action": {
"target": "https://www.baidu.com",
"merchantName": "正在跳转"
}
},
{
"position": 4,
"type": 1,
"content": "副图内容${param3}"
}
]
}
],
"params": [
{
"type": 1,
"name": "param1",
"path": 2,
"index": 1,
"lengthType": 1,
"maxLength": 10,
"minLength": 1,
"example": "示例内容"
},
{
"type": 1,
"name": "param2",
"path": 2,
"index": 2,
"lengthType": 2,
"maxLength": 8,
"minLength": 8,
"example": "示例内容"
},
{
"type": 1,
"name": "param3",
"path": 4,
"index": 1,
"lengthType": 1,
"maxLength": 10,
"minLength": 1,
"example": "示例内容"
}
],
"smsContent": "给您发送了一条消息,谨防失效,点击即可查看:${dh_rcs_aim}",
"factories": [
1,
2,
6
],
"useScene": "场景",
"useType": 1
}文档更新时间: 2025-12-17 10:29 作者:王超