Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

midway-tencent-cloud-sms

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

midway-tencent-cloud-sms

midwayjs tencent cloud sms component

  • 0.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

midway 腾讯云短信组件

封装 tencentcloud-sdk-nodejs-sms 成组件,命名空间是 tencentCloudSms 。

使用

安装

 npm i midway-tencent-cloud-sms

配置

在 config/* 中配置

   tencentCloudSms: {
    secretId: '',//
    secretKey: '',
    region: '',
    SmsSdkAppId: '',
    TemplateId: '',
    SignName: '',
    log:true, // 调试时设置为true,会打印出配置和请求参数
  },

具体配置的含义,请 参考腾讯云文档

Controller 中使用

// 引入
import { SmsService } from 'midway-tencent-cloud-sms';


class SomeController {
   // 注入
   @Inject()
   smsService: SmsService;

   @Post('/sms')
    async sms(@Body('phone') phone: string) {
    const code = _.random(100000, 999999);
    // 使用
    const res = await this.smsService.sendSms(code.toString(), phone);
    this.ctx.logger.info('sms', phone, res);
  }
}

贡献

👏 欢迎提 issue 或 pr

Keywords

FAQs

Package last updated on 28 Jun 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc