npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-qcloud-sms

v1.0.3

Published

## 腾讯云v5短信模块 需要先配置腾讯云短信参数才能正常使用

Downloads

2

Readme

node-qcloud-sms

腾讯云v5短信模块 需要先配置腾讯云短信参数才能正常使用

支持 发送单条短信 发送模板短信 群发短信 群发模板短信

Usage


  npm install node-qcloud-sms --save
  • 腾讯云配置
const qcloudSMS = require('node-qcloud-sms')

  /**
    * @param qcloudConfig 腾讯云配置信息
    * @param sdkappid 腾讯云SMS服务对应的sdkappid
    * @param appkey 腾讯云SMS服务对应的appkey
    */

qcloudSMS.qcloudConfig = {
  sdkappid: 'xxx',
  appkey: 'xxxx'
}
  • 发送单条短信

  /**
    * @param tel 手机
    * @param nationcode 国家码
    * @param mobile 电话号码
    * @param type 短信类型 0:普通短信;1:营销短信(强调:要按需填值,不然会影响到业务的正常使用)
    * @param msg 短息内容,字段需要匹配审核通过的模板内容
    */

qcloudSMS.sendSingleMsg({
  tel: {
    nationcode: '86',
    mobile: 'xxxxxxxxxx'
  },
  type: 0,
  msg: 'xxxx为您的登录验证码,请于xxxx分钟内填写。如非本人操作,请忽略本短信。'
}).then(result => {
  // 成功逻辑
}).catch(err => {
  // 失败
})
  • 发送模板短信

  /**
    * @param tel 手机
    * @param nationcode 国家码
    * @param mobile 电话号码
    * @param tplId 业务在控制台审核通过的模板ID
    * @param params //假定这个模板为:{1}为您的登录验证码,请于{2}分钟内填写。如非本人操作,请忽略本短信。参数,分别对应上面假定模板的{1},{2}
    */

qcloudSMS.sendTemplateMsg({
  tel: {
    nationcode: '86',
    mobile: 'xxxxxxxxxx'
  },
  tplId: 'xxxx',
  params: [
    '1234',
    '4'
  ]
}).then(result => {
  // 成功逻辑

}).catch(err => {
  // 失败逻辑

})
  • 群发短信

/**
    * @param tel 手机 群发数组 单次提交不超过200个手机号,内容长度不超过450字
    * @param nationcode 国家码
    * @param mobile 电话号码
    * @param type 短信类型 0:普通短信;1:营销短信(强调:要按需填值,不然会影响到业务的正常使用)
    * @param msg 短息内容,字段需要匹配审核通过的模板内容
    */

qcloudSMS.sendMultiMsg({
  tel: [{
    nationcode: '86',
    mobile: 'xxxxxxxxxx'
  }, {
    nationcode: '86',
    mobile: 'xxxxxxxxxx'
  }],
  type: 0,
  msg: 'xxxx为您的登录验证码,请于xx分钟内填写。如非本人操作,请忽略本短信。'
}).then(result => {
  console.debug('成功')
  console.debug(result.text)
}).catch(err => {
  console.debug('出错了')
  console.debug(err)
})
  • 群发模板短信

  /**
    * @param tel 手机 群发数组 单次提交不超过200个手机号,内容长度不超过450字
    * @param nationcode 国家码
    * @param mobile 电话号码
    * @param tplId 业务在控制台审核通过的模板ID
    * @param params //假定这个模板为:{1}为您的登录验证码,请于{2}分钟内填写。如非本人操作,请忽略本短信。参数,分别对应上面假定模板的{1},{2}
    */

qcloudSMS.sendMultiTemplateMsg({
  tel: [{
    nationcode: '86',
    mobile: 'xxxxxxxxxx'
  }, {
    nationcode: '86',
    mobile: 'xxxxxxxxxx'
  }],
  tplId: 'xxxx',
  params: [
    '1234',
    '4'
  ]
}).then(result => {
  console.debug('成功')
  console.debug(result.text)
}).catch(err => {
  console.debug('出错了')
  console.debug(err)
})