1.0.1 • Published 7 years ago

log-push v1.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

log-push

Note: This module just can be used in China

Push something (like server logs) to phone or wechat. It use Aliyun SMS to do sms and use Server酱 to do wechat notification

Install

npm install log-push

Config

Push by SMS

paramtypedescription
accessKeyIDstringaccess key id, get from aliyun
accessKeySecretstringaccess key secret, get from aliyun
paramStringobjectali sms param which you have defined on aliyun sms dashboard
recNumarrayphone numbers of users
signNamestringali sms param, get from aliyun sms dashboard
templateCodestringali sms param, get from aliyun sms dashboard
notifyWaystringmust be sms

Push by Wechat

paramtypedescription
serverJiangKeystringaccess key from server酱
wechatTextstringthe title of wechat message
wechatDespstringthe content of wechat message

NOTE: All parameters is required

Usage

const logPush = require("log-push");

const configWechat = {
  serverJiangKey: process.env.SERVER_JIANG_KEY,
  wechatText: '数星星',
  wechatDesp: `一共有${Math.ceil(Math.random() * 100)}个`
};

const configSMS = {
  accessKeyID       : process.env.ALI_SMS_ACCESSKEYID,
  accessKeySecret   : process.env.ALI_SMS_ACCESSKEYSECRET,
  paramString       : {code: '一起去大保健'},
  recNum            : ['17705143392'],
  signName          : '久康云',
  templateCode      : 'SMS_28100008',
  notifyWay         : 'sms',
};

logPush(configWechat, (err) => console.log(err));
logPush(configSMS, (err) => console.log(err));