Coder Social home page Coder Social logo

node-dysms's Introduction

node-dysms

Alidayu SMS (dysmsapi.aliyuncs.com) for Node.js witout async function.

阿里大于(阿里云服务版)Node.js 客户端,不需要 Async 方法(阿里大于官方客户端居然要 async,只好手撸一个简单的版本。

安装使用使用

npm install dysms --save
const Alidayu = require('dysms');

// 初始化客户端
const client = new Alidayu({ 
  AccessKeyId: 'Your-AccessKeyId', 
  AccessKeySecret: 'Your-AccessKeySecret' 
});

// 发送短信(Promise)
client.sms({
  phone: 13800138000,
  sign: '签名',
  template: 'SMS_8xxxxx',
  params: { user: 'Yourtion' },
})
.then(console.log)
.catch(console.log);

// 发送短信(Callback)
client.sms({
  phone: 13800138000,
  sign: '签名',
  template: 'SMS_8xxxxx',
  params: { user: 'Yourtion' },
}, (err, data) => {console.log(err, data)});

详情参数指定

/**
* 发送短信
* @param {Object} option - 发送短信配置
* @param {Number} option.phone - 手机号
* @param {String} option.sign - 签名
* @param {String} option.template - 模版
* @param {Object} option.params - 模版参数
* @param {Function} callback - 回调函数
* @return {Promise} 
*/
sms(option, callback)

node-dysms's People

Contributors

yourtion avatar

Watchers

James Cloos avatar  avatar

Forkers

914955868

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.