Open zhaobinglong opened 3 years ago
router.post('/send/:app', function(req, res, next) {
const app = config.get(req.params.app)
const SmsClient = tencentcloud.sms.v20210111.Client;
const clientConfig = {
credential: {
secretId: app.sms.secretId,
secretKey: app.sms.secretKey // 绝密信息
},
region: "ap-beijing",
profile: {
httpProfile: {
endpoint: "sms.tencentcloudapi.com",
},
},
};
const client = new SmsClient(clientConfig);
const params = {
"PhoneNumberSet": req.body.PhoneNumberSet, // 数组,元素是手机号码,前面要加86
"SmsSdkAppId": app.sms.SmsSdkAppId,
"SignName": app.sms.SignName,
"TemplateId": req.body.TemplateId, // 短信模板id
"TemplateParamSet": req.body.TemplateParamSet // 数组
};
client.SendSms(params).then(
(data) => {
res.send(data)
},
(err) => {
res.send(err)
}
);
});
报错记录:signature format is incorrect or signature is not approved