https://github.com/mkosir/fb-wrapper
Facebook API client for Node.js
https://github.com/mkosir/fb-wrapper
facebook javascript library nodejs
Last synced: 5 months ago
JSON representation
Facebook API client for Node.js
- Host: GitHub
- URL: https://github.com/mkosir/fb-wrapper
- Owner: mkosir
- Created: 2019-03-24T18:38:59.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-07-23T07:34:01.000Z (over 6 years ago)
- Last Synced: 2024-11-08T12:05:32.716Z (about 1 year ago)
- Topics: facebook, javascript, library, nodejs
- Language: TypeScript
- Homepage:
- Size: 119 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# fb-wrapper
[](https://www.npmjs.com/package/fb-wrapper)
[](https://travis-ci.org/mkosir/fb-wrapper)
## Facebook API client for Node.js
This is a small utility wrapper/facade library which translates [facebook-node-sdk](https://github.com/node-facebook/facebook-node-sdk) existing interface into simplified one.
## Install
```shell
npm i fb-wrapper
```
## Usage:
Only most commonly used function for interacting with Facebook API are implemented:
- postOnWall(msg: string): Promise<string>
- getFeed()
- getInfo(fields: string[] = ['id', 'name'])
```js
const FacebookClient = require('fb-wrapper');
const facebookClient = new FacebookClient(facebookToken, facebookAppID, facebookAppSecret);
// post on the wall
try {
const msgToPost = 'Post a test message';
const postId = await facebookClient.postOnWall(msgToPost);
console.log(postId);
} catch (e) {
console.error(e);
}
// get feed
try {
const feed = await facebookClient.getFeed();
console.log(feed);
} catch (e) {
console.error(e);
}
// get info
try {
const requestedInfo = await facebookClient.getInfo(['id', 'name']);
console.log(requestedInfo);
} catch (e) {
console.error(e);
}
```