egg-uni-sms
v1.0.0
Published
tencent qcloud sms plugin for egg
Downloads
12
Readme
egg-sms
Install
$ npm i egg-sms --save
Usage
// {app_root}/config/plugin.js
exports.sms = {
enable: true,
package: 'egg-sms'
}
Configuration
// {app_root}/config/config.default.js
exports.sms = {
client: {
accessKeyId: 'your access key',
secretAccessKey: 'your access secret'
}
}
see config/config.default.js for more detail.
API
detail on ali doc here
- sms.sendSMS(params)
- sms.queryDetail(params)
- sms.receiveMsg(params)
Example
You can acquire sms instance on app
or ctx
// {app_root}/app/controller/sms.js
...
async send () {
await this.ctx.sms.sendSMS({
PhoneNumbers: '1500000000',
SignName: '云通信产品',
TemplateCode: 'SMS_000000',
TemplateParam: '{"code":"12345"}'
})
}
...
Questions & Suggestions
Please open an issue here.