短信服务使用方可调用SendBatchSms接口向多个不同的手机号发送不同内容的短信。
请求方式: POST
请求地址: https://sms.volcengineapi.com?Action=SendBatchSms&Version=2021-01-01
const columns = [
{
width: '9%',
title: '名称',
dataIndex: 'Name',
},
{
width: '9%',
title: '类型',
dataIndex: 'DataType',
},
{
width: '9%',
title: '是否必填',
dataIndex: 'IsRequired',
},
{
width: '18%',
title: '示例值',
dataIndex: 'Example',
},
{
width: '55%',
title: '描述',
dataIndex: 'Description',
},
];
const data = [
{
rowKey: '->Action',
Name: 'Action',
DataType: 'String',
IsRequired: '是',
Example: <RenderMd content={"SendBatchSms"} />,
Description: <RenderMd content={"要执行的操作,取值:SendBatchSms"} />,
children: [
]
},
{
rowKey: '->Version',
Name: 'Version',
DataType: 'String',
IsRequired: '是',
Example: <RenderMd content={"2021-01-01"} />,
Description: <RenderMd content={"API的版本,取值:2021-01-01"} />,
children: [
]
},
];
return (<Table
rowKey="rowKey"
columns={columns}
data={data}
border={ { cell: true, wrapper: true } }
pagination={false}
/>);
const columns = [
{
width: '9%',
title: '名称',
dataIndex: 'Name',
},
{
width: '9%',
title: '类型',
dataIndex: 'DataType',
},
{
width: '9%',
title: '是否必填',
dataIndex: 'IsRequired',
},
{
width: '18%',
title: '示例值',
dataIndex: 'Example',
},
{
width: '55%',
title: '描述',
dataIndex: 'Description',
},
];
const data = [
{
rowKey: '->SmsAccount',
Name: 'SmsAccount',
DataType: 'String',
IsRequired: '是',
Example: <RenderMd content={"A123****"} />,
Description: <RenderMd content={"消息组ID。"} />,
children: [
]
},
{
rowKey: '->Sign',
Name: 'Sign',
DataType: 'String',
IsRequired: '是',
Example: <RenderMd content={"短信服务"} />,
Description: <RenderMd content={"短信签名内容。您需要使用已通过审核的短信签名内容。"} />,
children: [
]
},
{
rowKey: '->TemplateID',
Name: 'TemplateID',
DataType: 'String',
IsRequired: '是',
Example: <RenderMd content={"ST_6f8c****"} />,
Description: <RenderMd content={"短信模板ID。"} />,
children: [
]
},
{
rowKey: '->Messages',
Name: 'Messages',
DataType: 'Array of Message',
IsRequired: '是',
Example: <RenderMd content={"[{\"PhoneNumber\":\"18800001234\",\"TemplateParam\":\"{\\\"code\\\":\\\"1234\\\"}\"},{\"PhoneNumber\":\"18800001235\",\"TemplateParam\":\"{\\\"code\\\":\\\"1234\\\"}\"}]"} />,
Description: <RenderMd content={"消息体,最多支持200个手机号。"} />,
children: [
{
rowKey: '->Messages->PhoneNumber',
Name: 'PhoneNumber',
DataType: 'String',
IsRequired: '是',
Example: <RenderMd content={""} />,
Description: <RenderMd content={"手机号"} />,
children: [
]
},
{
rowKey: '->Messages->TemplateParam',
Name: 'TemplateParam',
DataType: 'String',
IsRequired: '否',
Example: <RenderMd content={""} />,
Description: <RenderMd content={"模版变量的json形式,key是变量名,val是变量值"} />,
children: [
]
},
]
},
{
rowKey: '->Tag',
Name: 'Tag',
DataType: 'String',
IsRequired: '否',
Example: <RenderMd content={"123456"} />,
Description: <RenderMd content={"透传字段。这个字段用于关联发送请求和短信回执,在回传回执消息的时候,会将该字段原样返回给服务使用方。例:如果你在短信发送请求的Tag中传了一个唯一的ID,在短信回执的ext参数中会把这个ID也原样返回给调用方\n"} />,
children: [
]
},
];
return (<Table
rowKey="rowKey"
columns={columns}
data={data}
border={ { cell: true, wrapper: true } }
pagination={false}
/>);
const columns = [
{
title: '名称',
dataIndex: 'Name',
width: '10%',
},
{
title: '类型',
dataIndex: 'DataType',
width: '10%',
},
{
title: '示例值',
dataIndex: 'Example',
width: '20%',
},
{
title: '描述',
dataIndex: 'Description',
width: '60%',
},
];
const data = [
{
rowKey: "->ResponseMetadata",
Name: "ResponseMetadata",
DataType: "ResponseMetadata",
Example: <RenderMd content={" "} />,
Description: <RenderMd content={"响应公共参数"} />,
children: [
{
rowKey: "->ResponseMetadata->RequestId",
Name: "RequestId",
DataType: "String",
Example: <RenderMd content={""} />,
Description: <RenderMd content={"请求ID"} />,
children: [
]
},
{
rowKey: "->ResponseMetadata->Action",
Name: "Action",
DataType: "String",
Example: <RenderMd content={""} />,
Description: <RenderMd content={"请求方法"} />,
children: [
]
},
{
rowKey: "->ResponseMetadata->Version",
Name: "Version",
DataType: "String",
Example: <RenderMd content={""} />,
Description: <RenderMd content={"请求API版本"} />,
children: [
]
},
{
rowKey: "->ResponseMetadata->Service",
Name: "Service",
DataType: "String",
Example: <RenderMd content={""} />,
Description: <RenderMd content={"Service"} />,
children: [
]
},
{
rowKey: "->ResponseMetadata->Region",
Name: "Region",
DataType: "String",
Example: <RenderMd content={""} />,
Description: <RenderMd content={"Region"} />,
children: [
]
},
{
rowKey: "->ResponseMetadata->Error",
Name: "Error",
DataType: "Error",
Example: <RenderMd content={""} />,
Description: <RenderMd content={"错误信息(部分错误码将通过回执返回)"} />,
children: [
{
rowKey: "->ResponseMetadata->Error->Code",
Name: "Code",
DataType: 'String',
Example: <RenderMd content={""} />,
Description: <RenderMd content={"错误码"} />,
children: [
]
},
{
rowKey: "->ResponseMetadata->Error->Message",
Name: "Message",
DataType: 'String',
Example: <RenderMd content={""} />,
Description: <RenderMd content={"错误描述"} />,
children: [
]
},
]
},
]
},
{
rowKey: "->Result",
Name: "Result",
DataType: "SendResult",
Example: <RenderMd content={" "} />,
Description: <RenderMd content={"响应的消息 ID。每条消息 ID 对应一个手机号的请求,其中展示顺序为传入电话号码的顺序。"} />,
children: [
{
rowKey: "->Result->MessageID",
Name: "MessageID",
DataType: "Array of String",
Example: <RenderMd content={""} />,
Description: <RenderMd content={"响应的消息 ID。"} />,
children: [
]
},
]
},
];
return (<Table
rowKey="rowKey"
columns={columns}
data={data}
border={ { cell: true, wrapper: true } }
pagination={false}
/>);
{
"SmsAccount": "A123****",
"Sign": "短信服务",
"TemplateID": "ST_6f8c****",
"Messages": [
{
"PhoneNumber": "188********",
"TemplateParam": "{\"aaa\":\"模版中内容1\"}"
},
{
"PhoneNumber": "152********",
"TemplateParam": "{\"aaa\":\"模版中内容2\"}"
}
],
"Tag": "send return"
}
{
"ResponseMetadata": {
"RequestId": "202212091603350102121720400960****",
"Action": "SendBatchSms",
"Version": "2020-01-01",
"Service": "volcSMS",
"Region": "cn-north-1"
},
"Result": {
"MessageID": [
"3e5c0bb8-a1a6-4e86-bb73-3e8120ba****",
"03821294-76d4-4490-b395-4b35a73f****"
]
}
}
{
"SmsAccount": "A123****",
"Sign": "短信服务",
"TemplateID": "ST_6f8c****",
"Messages": [
{
"PhoneNumber": "188********",
"TemplateParam": "{\"aaa\":\"模版中内容1\"}"
},
{
"PhoneNumber": "152********",
"TemplateParam": "{\"aaa\":\"模版中内容2\"}"
}
],
"Tag": "send return"
}
{
"ResponseMetadata": {
"RequestId": "202212091603350102121720400960****",
"Action": "SendBatchSms",
"Version": "2020-01-01",
"Service": "volcSMS",
"Region": "cn-north-1",
"Error": {
"Code": "RE:0003",
"Message": "SmsAccount not exist."
}
},
"Result": {
"MessageID": [
"3e5c0bb8-a1a6-4e86-bb73-3e8120ba****"
]
}
}
下表提供了该接口业务逻辑相关的错误码。公共错误码请参见公共错误码。
const columns = [
{
title: 'HttpCode',
dataIndex: 'HttpCode',
width: '9%',
},
{
title: '错误码',
dataIndex: 'ErrorCode',
width: '13%',
},
{
title: '错误信息',
dataIndex: 'ErrorMessage',
width: '39%',
},
{
title: '描述',
dataIndex: 'Description',
width: '39%',
},
];
const data = [
{
HttpCode: 200,
ErrorCode: 'RE:0001',
ErrorMessage: '账号短信服务未开通',
Description: <RenderMd content={"请检查当前AccessKey是否已经开通短信服务。如已开通[短信服务](https://www.volcengine.com/product/cloud-sms),则参照短信服务文档调用接口。"} />,
},
{
HttpCode: 200,
ErrorCode: 'RE:0002',
ErrorMessage: '账号被关停',
Description: <RenderMd content={"请联系火山引擎客服确认"} />,
},
{
HttpCode: 200,
ErrorCode: 'RE:0003',
ErrorMessage: '子账号不存在',
Description: <RenderMd content={"请填写正确的SmsAccount,即[消息组ID](https://console.volcengine.com/sms/subaccount/list)"} />,
},
{
HttpCode: 200,
ErrorCode: 'RE:0004',
ErrorMessage: '签名错误',
Description: <RenderMd content={"请确认对应SmsAccount下是否存在该签名,或登录[短信服务控制台](https://console.volcengine.com/sms),在**短信签名**页面查询此签名是否审核通过。"} />,
},
{
HttpCode: 200,
ErrorCode: 'RE:0005',
ErrorMessage: '模板错误',
Description: <RenderMd content={"请检查对应SmsAccount下是否存在该模板,或登录[短信服务控制台](https://console.volcengine.com/sms),在**短信模板**页面查询此模板是否审核通过。"} />,
},
{
HttpCode: 200,
ErrorCode: 'RE:0006',
ErrorMessage: '手机号格式错误',
Description: <RenderMd content={"手机号参数请传入正确的格式。\n- 国内消息:+86或无任何前缀的11位手机号码,例如1580799\\*\\*\\*\\* \n- 国际/港澳台消息:国际区号为必填项,且格式需符合 E.164 标准。"} />,
},
{
HttpCode: 200,
ErrorCode: 'RE:0007',
ErrorMessage: 'IP校验错误',
Description: <RenderMd content={"已开启IP白名单,请联系火山引擎客服确认当前IP是否已加白。"} />,
},
{
HttpCode: 200,
ErrorCode: 'RE:0000',
ErrorMessage: '账号鉴权失败',
Description: <RenderMd content={"请检查参数是否使用正确或参考SDK内的鉴权处理"} />,
},
{
HttpCode: 200,
ErrorCode: 'VE:0004',
ErrorMessage: '当前模板已过期',
Description: <RenderMd content={"请重新申请新模板"} />,
},
{
HttpCode: 200,
ErrorCode: 'VE:0003',
ErrorMessage: '签名和申请模板时不一致',
Description: <RenderMd content={"请确保使用的签名和报备模板时保持一致"} />,
},
{
HttpCode: 200,
ErrorCode: 'VE:0002',
ErrorMessage: '视频短信模板不可用',
Description: <RenderMd content={"请确认对应的模板是否审核通过或允许使用"} />,
},
{
HttpCode: 200,
ErrorCode: 'VE:0001',
ErrorMessage: '账户不允许发送视频短信',
Description: <RenderMd content={"请检查当前AccessKey是否已经开通视频短信服务。如已开通视频短信服务,则参照视频短信务文档调用接口。"} />,
},
{
HttpCode: 200,
ErrorCode: 'RE:0500',
ErrorMessage: '未知交互类错误',
Description: <RenderMd content={"请尝试重新调用接口"} />,
},
{
HttpCode: 200,
ErrorCode: 'RE:0013',
ErrorMessage: '发送量超阈值',
Description: <RenderMd content={"发送量超阈值,请检查控制台发送上限设置"} />,
},
{
HttpCode: 200,
ErrorCode: 'RE:0012',
ErrorMessage: '不支持的发送类型',
Description: <RenderMd content={"请登录控制台,在消息组列表点击编辑,检查允许发送的短信类型是否勾选"} />,
},
{
HttpCode: 200,
ErrorCode: 'RE:0011',
ErrorMessage: '不支持对应地区下发',
Description: <RenderMd content={"请在允许的地区内进行下发或者申请对应地区的短信下发"} />,
},
{
HttpCode: 200,
ErrorCode: 'RE:0010',
ErrorMessage: '账号欠费',
Description: <RenderMd content={"请登录控制台费用中心查询余额是否充足"} />,
},
{
HttpCode: 200,
ErrorCode: 'RE:0009',
ErrorMessage: '请求参数错误',
Description: <RenderMd content={"请根据接口文档检查参数是否正确"} />,
},
];
return (<Table
columns={columns}
data={data}
border={ { cell: true, wrapper: true } }
pagination={false}
/>);