Package in order to simplify access to instagram graph api.
npm i instagram-graph-fetcher-js `#### Example
`
import { fetchMediaFields } from "instagram-graph-fetcher-js";
fetchFields(
"",
["media_url", "permalink", "media_type"]
).then((x) => console.log(x));
`Methods list
#### refreshToken
##### Description
- Pass it your token, and if it has at least 24h, it will refresh it so it has still 60 days last
##### Usage
`
import { refreshToken } from "instagram-graph-fetcher-js";
refreshToken(
""
).then((x) => console.log(x));
`
##### Parameter
- access_token : The user access token
##### Response
`
{
"access_token": "",
"token_type": "bearer",
"expires_in": `#### fetchMediaFields
##### Description
- Pass it your token, and the field you wants, will return you a promise with the fields infos
##### Usage
`
import { fetchMediaFields } from "instagram-graph-fetcher-js";
fetchMediaFields(
,["media_url", "permalink", "media_type"])
.then((response) => console.log(response));
`
##### Parameter
- access_token : The user access token
- fields : The list of fields you want
##### Response
`
{
"data": [
{
"media_url": "",
"permalink": "",
"media_type": "IMAGE",
"id": ""
},
{
"media_url": "",
"permalink": "",
"media_type": "IMAGE",
"id": ""
},
{
...
}
],
"paging": {
"cursors": {
"before": "",
"after": ""
}
}
}
`#### fetchUserFields
##### Description
- Pass it your token, and the field you wants, will return you a promise with the fields infos
##### Usage
`
import { fetchUserFields } from "instagram-graph-fetcher-js";
fetchUserFields(
,["id","username"])
.then((response) => console.log(response));
`
##### Parameter
- access_token : The user access token
- fields : The list of fields you want
##### Response
`
{
"id": "",
"username": ""
}
`#### fetchSpecificMediaFields
##### Description
- Pass it your token, and the field you wants, will return you a promise with the fields infos
##### Usage
- When you have the media id list with fetchUserFields("access_token", ["media"]), you can request infos of this specific media
`
import { fetchSpecificMediaFields } from "instagram-graph-fetcher-js";
fetchSpecificMediaFields(
, ,["permalink", "media_type"])
.then((response) => console.log(response));
`
##### Parameter
- access_token : The user access token
- fields : The list of fields you want
##### Response
`
{
"media_url": "",
"id": ""
}
``