1.0.7 • Published 4 years ago

onebuck v1.0.7

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

A toolkit that provides some methods to help you to integrate you app to tencent products such as qq, wechat, etc.

use with async

var onebuck = require('./index');
var mp = onebuck.mp('yourappid', 'yourappsecret');

var run = async (func) => {
    func();
}

run(async () => {
    try {
        // get at
        var at = await mp.getAccessToken();
        console.log(at);
        // get user list
        var ul = await mp.getUserList(at);
        console.log(ul.data.openid.length);
        // get user info
        var u = await mp.getUserInfo(at, ul.data.openid[0]);
        console.log(u.nickname);
        // get template list
        var tl = await mp.getTemplates(at);
        // send message
        var msgId = await mp.sendMessage(at, 'openid', 'templateid',
            {
                msg: {
                    value: new Date().toString()
                }
            });
        // get js ticket
        var ticket = await mp.getJsTicket(at);
        console.log(ticket);
        var signature = mp.getJsSignature(ticket, 'redirecturl');
        console.log(signature);
    }
    catch (err) {
        console.log(err.code);
        console.log(err.message);
    }
});
1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago