1.0.2 • Published 6 years ago
shako v1.0.2
SHAKO - SIMPLE FACEBOOK OFFICAL API HELPER
Install
Install from npmjs
npm install --save shakoInstall latest beta versions
npm install --save Notekunn/shakoSuper simple to use
Example:
const shako = require('shako');
(async () => {
const api = await shako({ access_token : "YOUR_TOKEN" });
const result = await api.user.getID('zuck')
console.log(result);
})().catch((e) => console.log('ERROR: ' + e));Table of contents
Request also offers convenience methods like
request.defaults and request.post, and there are
lots of usage examples and several
debugging techniques.
Login
You can login by token
const shako = require('shako');
(async () => {
const api = await shako({ access_token: "YOUR_TOKEN" });
const result = await api.user.getID('zuck')
console.log(result);
})().catch((e) => console.log('ERROR: ' + e));Or appState
const shako = require('shako');
const appState = require('../config/appstate.json');
(async () => {
const api = await shako({ appState });
const result = await api.user.getID('zuck')
console.log(result);
})().catch((e) => console.log('ERROR: ' + e));Group Api
Api to contact with group (return a Promise). Example:
const shako = require('shako');
const appState = require('../config/appstate.json');
(async () => {
const api = await shako({ appState });
const result = await api.group.joinGroup('10000');
})().catch((e) => console.log('ERROR: ' + e));Add(Remove) Member
Api to add or remove member from group.
//Add member
api.group.addMember(ID_GROUP, ID_MEMBER);
//remove member
api.group.removeMember(ID_GROUP, ID_MEMBER);Join Groups
Api to join a group.
api.group.joinGroup(ID_GROUP);Reply Question
Api to reply question of group.
api.group.replyQuestion(ID_GROUP, function(question){
//Do something with variable `question`
return somthing || question;
});Open(Close) Comment
Api to open and close comment of a post.
//open comment
api.group.openComment(ID_POST);
//close comment
api.group.closeComment(ID_POST);Block(Unblock) Member
Api to block or unblock member from group.
//Add block
api.group.blockMember(ID_GROUP, ID_MEMBER);
//remove unblock
api.group.unblockMember(ID_GROUP, ID_MEMBER);back to top
USER API
Api to work with user. Example:
const shako = require('shako');
const appState = require('../config/appstate.json');
(async () => {
const api = await shako({ appState });
const result = await api.user.getID('zuck');
})().catch((e) => console.log('ERROR: ' + e));Get ID
Api to get ID from username.
api.user.getID(USER_NAME);Get Token
Api to get Token.
api.user.getToken();Get ID
Api to post a bio.
api.user.postBio(CONTENT, PUBLIC/*(true, false)*/);PAGE API
Api to work with page. Example:
const shako = require('shako');
const appState = require('../config/appstate.json');
(async () => {
const api = await shako({ appState });
const result = await api.page.createPage({name: 'zuck'});
})().catch((e) => console.log('ERROR: ' + e));Create Page
Api to create A new Page.
api.page.createPage({ name: 'PAGE_NAME', super_category, category});List id category in here
CUSTOM API
You can custom your api
GET
api.get(URL, QUERY_OBJECT);POST
api.post(URL, FORM_POST, QUERY_OBJECT);POST FORMDATA
api.postFormData(URL, FORM_POST, QUERY_OBJECT);