facebook integration in node.js
JavaScript
app.get('/facebook-search/:id', (req, res) => {
// you need permission for most of these fields
const userFieldSet = 'id, name, about, email, accounts, link, is_verified, significant_other, relationship_status, website, picture, photos, feed';
const options = {
method: 'GET',
uri: `https://graph.facebook.com/v2.8/${req.params.id}`,
qs: {
access_token: user_access_token,
fields: userFieldSet
}
};
request(options)
.then(fbRes => {
res.json(fbRes);
})
})
const request = require('request-promise');
module.exports = (app) => {
// you'll need to have requested 'user_about_me' permissions
// in order to get 'quotes' and 'about' fields from search
const userFieldSet = 'name, link, is_verified, picture';
const pageFieldSet = 'name, category, link, picture, is_verified';
app.post('/facebook-search', (req, res) => {
const { queryTerm, searchType } = req.body;
const options = {
method: 'GET',
uri: 'https://graph.facebook.com/search',
qs: {
access_token: config.user_access_token,
q: queryTerm,
type: searchType,
fields: searchType === 'page' ? pageFieldSet : userFieldSet
}
};
request(options)
.then(fbRes => {
// Search results are in the data property of the response.
// There is another property that allows for pagination of results.
// Pagination will not be covered in this post,
// so we only need the data property of the parsed response.
const parsedRes = JSON.parse(fbRes).data;
res.json(parsedRes);
})
});
}
Also in JavaScript:
- Title
- compare two array javascript
- Category
- JavaScript
- Title
- express js continous GET /json/version
- Category
- JavaScript
- Title
- ad data to js object
- Category
- JavaScript
- Title
- jason rpc reactjs
- Category
- JavaScript
- Title
- axios post with header
- Category
- JavaScript
- Title
- clear terminal node js
- Category
- JavaScript
- Title
- how to convert audio blocb to base64 string
- Category
- JavaScript
- Title
- add to json object javascript
- Category
- JavaScript
- Title
- how to do bubble sort in javascript
- Category
- JavaScript
- Title
- discord.js start code
- Category
- JavaScript
- Title
- comparing two arrays in javascript returning differences
- Category
- JavaScript
- Title
- express and node
- Category
- JavaScript
- Title
- get string of element
- Category
- JavaScript
- Title
- form validation in reactstrap
- Category
- JavaScript
- Title
- find a single element in array of objects javascript
- Category
- JavaScript
- Title
- javascript click button by id
- Category
- JavaScript
- Title
- how to make a show password button
- Category
- JavaScript
- Title
- eval in js
- Category
- JavaScript
- Title
- angular generate component
- Category
- JavaScript
- Title
- drupal 8 node has field
- Category
- JavaScript
- Title
- convert json to csv npm
- Category
- JavaScript
- Title
- how to create element in javascript
- Category
- JavaScript
- Title
- how to place text at custom position on canvas in javascript
- Category
- JavaScript
- Title
- how to get value in array object value using for loop in javascript
- Category
- JavaScript
- Title
- dom is loaded
- Category
- JavaScript
- Title
- Heroku H10-App Crashed Error
- Category
- JavaScript
- Title
- angular run with proxy
- Category
- JavaScript
- Title
- bootstrap modal remove gray background
- Category
- JavaScript
- Title
- how to add button react native app.js
- Category
- JavaScript
- Title
- get url of page in background script
- Category
- JavaScript
- Title
- clear scene\
- Category
- JavaScript
- Title
- bootstrap 4 open tab when opening modal
- Category
- JavaScript
- Title
- angular themeable components
- Category
- JavaScript
- Title
- ExoPlayer with auto linking react native
- Category
- JavaScript
- Title
- installing bootstrap in angular 9
- Category
- JavaScript
- Title
- get text of selected option jquery
- Category
- JavaScript
- Title
- get the index of object in array
- Category
- JavaScript
- Title
- abstraction in javascript
- Category
- JavaScript
- Title
- angular sumar labels
- Category
- JavaScript
- Title
- how to limit input type max length
- Category
- JavaScript
- Title
- curl post file json
- Category
- JavaScript
- Title
- convert boolean to string javascript
- Category
- JavaScript
- Title
- client side redirect javascript
- Category
- JavaScript
- Title
- installing vue router & implementation
- Category
- JavaScript
- Title
- dynamic for loop react
- Category
- JavaScript
- Title
- graphql react filtering
- Category
- JavaScript
- Title
- chart.js radar chart
- Category
- JavaScript
- Title
- discord.js
- Category
- JavaScript
- Title
- Check ratelimit discord js
- Category
- JavaScript
- Title
- express json body
- Category
- JavaScript
- Title
- get width of a dom element js
- Category
- JavaScript
- Title
- datatable on error.dt
- Category
- JavaScript
- Title
- how to get data from localstorage in javascript
- Category
- JavaScript
- Title
- javascript change attribute
- Category
- JavaScript
- Title
- async await javascript push
- Category
- JavaScript
- Title
- faunadb ref
- Category
- JavaScript
- Title
- empty array js
- Category
- JavaScript
- Title
- add elements to an array with splice
- Category
- JavaScript
- Title
- how to count click events javascript
- Category
- JavaScript
- Title
- convert json to 2d array
- Category
- JavaScript
- Title
- arrow function javascript ie11
- Category
- JavaScript
- Title
- error sending empty object express
- Category
- JavaScript
- Title
- document queryselector click event
- Category
- JavaScript
- Title
- get element by class
- Category
- JavaScript
- Title
- event.persist()
- Category
- JavaScript
- Title
- boucle foreach js
- Category
- JavaScript
- Title
- async await javascript stack overflow
- Category
- JavaScript
- Title
- Javascript clear canvas
- Category
- JavaScript
- Title
- angular subscribe
- Category
- JavaScript
- Title
- capitalize all letters jquery
- Category
- JavaScript
- Title
- discord.js send message to channel
- Category
- JavaScript
- Title
- get last item in array js
- Category
- JavaScript
- Title
- get selected option value
- Category
- JavaScript
- Title
- assign values to a table from javascript in VF page
- Category
- JavaScript
- Title
- axios delete request payload
- Category
- JavaScript
- Title
- indexing string in javascript
- Category
- JavaScript
- Title
- change the value in checkbox by button react
- Category
- JavaScript
- Title
- angular add debounce time before putting valu in subject next
- Category
- JavaScript
- Title
- bootstrap 4 hide modal via javascript
- Category
- JavaScript
- Title
- how to add text to h2 with jquery
- Category
- JavaScript
- Title
- console.log('Hi there!');
- Category
- JavaScript
- Title
- angular npm angular material
- Category
- JavaScript
- Title
- fivem trigger javascript function
- Category
- JavaScript
- Title
- flatten nested object js
- Category
- JavaScript
- Title
- hover vanilla javascript
- Category
- JavaScript
- Title
- Appending the option element using jquery each function
- Category
- JavaScript
- Title
- boucle for of javascript
- Category
- JavaScript
- Title
- JavaScript banner
- Category
- JavaScript
- Title
- how to check version of node js in cmd
- Category
- JavaScript
- Title
- Data Change with Mutation
- Category
- JavaScript
- Title
- how to format unix timestamp javascript
- Category
- JavaScript
- Title
- Find the stray number
- Category
- JavaScript
- Title
- javascript add class to element
- Category
- JavaScript
- Title
- change p tag text javascript
- Category
- JavaScript
- Title
- for javascript delay
- Category
- JavaScript
- Title
- geolocation speed
- Category
- JavaScript
- Title
- angular img
- Category
- JavaScript
- Title
- angular google maps
- Category
- JavaScript
- Title
- how to write a program that displays a message “It’s Fun day” if it's Saturday or Sunday today in javascript
- Category
- JavaScript
- Title
- how to deep copy object in javascript
- Category
- JavaScript