Skip to content

πŸ“¨ The ultimate agentic social media scheduling tool πŸ€–

fix: bump Meta Graph API from v20.0 to v25.0 via shared constant

Gilad Resisi3fab214f0fbe
diff --git a/libraries/nestjs-libraries/src/integrations/social/facebook.provider.ts b/libraries/nestjs-libraries/src/integrations/social/facebook.provider.ts
index 5ade76092..eabed2baf 100644
--- a/libraries/nestjs-libraries/src/integrations/social/facebook.provider.ts
+++ b/libraries/nestjs-libraries/src/integrations/social/facebook.provider.ts
@@ -23,6 +23,8 @@ import { hasExtension } from '@gitroom/helpers/utils/has.extension';
import { timer } from '@gitroom/helpers/utils/timer';
import { Rules } from '@gitroom/nestjs-libraries/chat/rules.description.decorator';
+export const META_GRAPH_API_VERSION = 'v25.0';
+
@Rules(
"Facebook posts can be text only, or include photos or a video. If it's a story, it must have at least one attachment (photo or video), and each media is published as a separate story."
)
@@ -239,7 +241,7 @@ export class FacebookProvider extends SocialAbstract implements SocialProvider {
const state = makeId(6);
return {
url:
- 'https://www.facebook.com/v20.0/dialog/oauth' +
+ `https://www.facebook.com/${META_GRAPH_API_VERSION}/dialog/oauth` +
`?client_id=${process.env.FACEBOOK_APP_ID}` +
`&redirect_uri=${encodeURIComponent(
`${process.env.FRONTEND_URL}/integrations/social/facebook`
@@ -276,7 +278,7 @@ export class FacebookProvider extends SocialAbstract implements SocialProvider {
}) {
const getAccessToken = await (
await fetch(
- 'https://graph.facebook.com/v20.0/oauth/access_token' +
+ `https://graph.facebook.com/${META_GRAPH_API_VERSION}/oauth/access_token` +
`?client_id=${process.env.FACEBOOK_APP_ID}` +
`&redirect_uri=${encodeURIComponent(
`${process.env.FRONTEND_URL}/integrations/social/facebook${
@@ -290,7 +292,7 @@ export class FacebookProvider extends SocialAbstract implements SocialProvider {
const { access_token } = await (
await fetch(
- 'https://graph.facebook.com/v20.0/oauth/access_token' +
+ `https://graph.facebook.com/${META_GRAPH_API_VERSION}/oauth/access_token` +
'?grant_type=fb_exchange_token' +
`&client_id=${process.env.FACEBOOK_APP_ID}` +
`&client_secret=${process.env.FACEBOOK_APP_SECRET}` +
@@ -300,7 +302,7 @@ export class FacebookProvider extends SocialAbstract implements SocialProvider {
const { data } = await (
await fetch(
- `https://graph.facebook.com/v20.0/me/permissions?access_token=${access_token}`
+ `https://graph.facebook.com/${META_GRAPH_API_VERSION}/me/permissions?access_token=${access_token}`
)
).json();
@@ -311,7 +313,7 @@ export class FacebookProvider extends SocialAbstract implements SocialProvider {
const { id, name, picture } = await (
await fetch(
- `https://graph.facebook.com/v20.0/me?fields=id,name,picture&access_token=${access_token}`
+ `https://graph.facebook.com/${META_GRAPH_API_VERSION}/me?fields=id,name,picture&access_token=${access_token}`
)
).json();
@@ -348,7 +350,7 @@ export class FacebookProvider extends SocialAbstract implements SocialProvider {
// Fetch pages the user explicitly shared during the OAuth dialog
await fetchPaginated(
- `https://graph.facebook.com/v20.0/me/accounts?fields=id,username,name,access_token,picture.type(large)&limit=100&access_token=${accessToken}`
+ `https://graph.facebook.com/${META_GRAPH_API_VERSION}/me/accounts?fields=id,username,name,access_token,picture.type(large)&limit=100&access_token=${accessToken}`
);
// Also fetch pages via Business Manager API to discover pages
@@ -356,7 +358,7 @@ export class FacebookProvider extends SocialAbstract implements SocialProvider {
try {
let bizUrl:
| string
- | undefined = `https://graph.facebook.com/v20.0/me/businesses?access_token=${accessToken}`;
+ | undefined = `https://graph.facebook.com/${META_GRAPH_API_VERSION}/me/businesses?access_token=${accessToken}`;
while (bizUrl) {
const bizResponse = await (await fetch(bizUrl)).json();
@@ -364,7 +366,7 @@ export class FacebookProvider extends SocialAbstract implements SocialProvider {
for (const business of bizResponse.data) {
try {
await fetchPaginated(
- `https://graph.facebook.com/v20.0/${business.id}/owned_pages?fields=id,username,name,access_token,picture.type(large)&limit=100&access_token=${accessToken}`
+ `https://graph.facebook.com/${META_GRAPH_API_VERSION}/${business.id}/owned_pages?fields=id,username,name,access_token,picture.type(large)&limit=100&access_token=${accessToken}`
);
} catch {
// Continue with other businesses
@@ -372,7 +374,7 @@ export class FacebookProvider extends SocialAbstract implements SocialProvider {
try {
await fetchPaginated(
- `https://graph.facebook.com/v20.0/${business.id}/client_pages?fields=id,username,name,access_token,picture.type(large)&limit=100&access_token=${accessToken}`
+ `https://graph.facebook.com/${META_GRAPH_API_VERSION}/${business.id}/client_pages?fields=id,username,name,access_token,picture.type(large)&limit=100&access_token=${accessToken}`
);
} catch {
// Continue with other businesses
@@ -417,7 +419,7 @@ export class FacebookProvider extends SocialAbstract implements SocialProvider {
// 1. Check /me/accounts
const fromAccounts = await searchPaginated(
- `https://graph.facebook.com/v20.0/me/accounts?fields=${fields}&limit=100&access_token=${accessToken}`
+ `https://graph.facebook.com/${META_GRAPH_API_VERSION}/me/accounts?fields=${fields}&limit=100&access_token=${accessToken}`
);
if (fromAccounts) return fromAccounts;
@@ -425,7 +427,7 @@ export class FacebookProvider extends SocialAbstract implements SocialProvider {
try {
let bizUrl:
| string
- | undefined = `https://graph.facebook.com/v20.0/me/businesses?access_token=${accessToken}`;
+ | undefined = `https://graph.facebook.com/${META_GRAPH_API_VERSION}/me/businesses?access_token=${accessToken}`;
while (bizUrl) {
const bizResponse = await (await fetch(bizUrl)).json();
@@ -433,7 +435,7 @@ export class FacebookProvider extends SocialAbstract implements SocialProvider {
for (const business of bizResponse.data) {
try {
const fromOwned = await searchPaginated(
- `https://graph.facebook.com/v20.0/${business.id}/owned_pages?fields=${fields}&limit=100&access_token=${accessToken}`
+ `https://graph.facebook.com/${META_GRAPH_API_VERSION}/${business.id}/owned_pages?fields=${fields}&limit=100&access_token=${accessToken}`
);
if (fromOwned) return fromOwned;
} catch {
@@ -442,7 +444,7 @@ export class FacebookProvider extends SocialAbstract implements SocialProvider {
try {
const fromClient = await searchPaginated(
- `https://graph.facebook.com/v20.0/${business.id}/client_pages?fields=${fields}&limit=100&access_token=${accessToken}`
+ `https://graph.facebook.com/${META_GRAPH_API_VERSION}/${business.id}/client_pages?fields=${fields}&limit=100&access_token=${accessToken}`
);
if (fromClient) return fromClient;
} catch {
@@ -464,7 +466,7 @@ export class FacebookProvider extends SocialAbstract implements SocialProvider {
private async fbVideoStatus(videoId: string, accessToken: string) {
const { status } = await (
await this.fetch(
- `https://graph.facebook.com/v20.0/${videoId}?fields=status&access_token=${accessToken}`,
+ `https://graph.facebook.com/${META_GRAPH_API_VERSION}/${videoId}?fields=status&access_token=${accessToken}`,
undefined,
'',
0,
@@ -504,7 +506,7 @@ export class FacebookProvider extends SocialAbstract implements SocialProvider {
if (hasExtension(media.path, 'mp4')) {
const { video_id, upload_url } = await (
await this.fetch(
- `https://graph.facebook.com/v20.0/${id}/video_stories?upload_phase=start&access_token=${accessToken}`,
+ `https://graph.facebook.com/${META_GRAPH_API_VERSION}/${id}/video_stories?upload_phase=start&access_token=${accessToken}`,
{
method: 'POST',
},
@@ -528,7 +530,7 @@ export class FacebookProvider extends SocialAbstract implements SocialProvider {
} else {
const { id: photoId } = await (
await this.fetch(
- `https://graph.facebook.com/v20.0/${id}/photos?access_token=${accessToken}`,
+ `https://graph.facebook.com/${META_GRAPH_API_VERSION}/${id}/photos?access_token=${accessToken}`,
{
method: 'POST',
headers: {
@@ -646,8 +648,8 @@ export class FacebookProvider extends SocialAbstract implements SocialProvider {
const { post_id: storyPostId } = await (
await this.fetch(
item.kind === 'video'
- ? `https://graph.facebook.com/v20.0/${integration.internalId}/video_stories?upload_phase=finish&video_id=${item.mediaId}&access_token=${accessToken}`
- : `https://graph.facebook.com/v20.0/${integration.internalId}/photo_stories?photo_id=${item.mediaId}&access_token=${accessToken}`,
+ ? `https://graph.facebook.com/${META_GRAPH_API_VERSION}/${integration.internalId}/video_stories?upload_phase=finish&video_id=${item.mediaId}&access_token=${accessToken}`
+ : `https://graph.facebook.com/${META_GRAPH_API_VERSION}/${integration.internalId}/photo_stories?photo_id=${item.mediaId}&access_token=${accessToken}`,
{
method: 'POST',
},
@@ -764,7 +766,7 @@ export class FacebookProvider extends SocialAbstract implements SocialProvider {
...all
} = await (
await this.fetch(
- `https://graph.facebook.com/v20.0/${id}/videos?access_token=${accessToken}&fields=id,permalink_url`,
+ `https://graph.facebook.com/${META_GRAPH_API_VERSION}/${id}/videos?access_token=${accessToken}&fields=id,permalink_url`,
{
method: 'POST',
headers: {
@@ -789,7 +791,7 @@ export class FacebookProvider extends SocialAbstract implements SocialProvider {
firstPost.media.map(async (media) => {
const { id: photoId } = await (
await this.fetch(
- `https://graph.facebook.com/v20.0/${id}/photos?access_token=${accessToken}`,
+ `https://graph.facebook.com/${META_GRAPH_API_VERSION}/${id}/photos?access_token=${accessToken}`,
{
method: 'POST',
headers: {
@@ -821,7 +823,7 @@ export class FacebookProvider extends SocialAbstract implements SocialProvider {
const publishFeed = async (withPreset: boolean) =>
(
await this.fetch(
- `https://graph.facebook.com/v20.0/${id}/feed?access_token=${accessToken}&fields=id,permalink_url`,
+ `https://graph.facebook.com/${META_GRAPH_API_VERSION}/${id}/feed?access_token=${accessToken}&fields=id,permalink_url`,
{
method: 'POST',
headers: {
@@ -920,7 +922,7 @@ export class FacebookProvider extends SocialAbstract implements SocialProvider {
const data = await (
await this.fetch(
- `https://graph.facebook.com/v20.0/${replyToId}/comments?access_token=${accessToken}&fields=id,permalink_url`,
+ `https://graph.facebook.com/${META_GRAPH_API_VERSION}/${replyToId}/comments?access_token=${accessToken}&fields=id,permalink_url`,
{
method: 'POST',
headers: {
@@ -963,7 +965,7 @@ export class FacebookProvider extends SocialAbstract implements SocialProvider {
// - page_media_view: total media views, broken down between paid and organic
const { data } = await (
await fetch(
- `https://graph.facebook.com/v23.0/${id}/insights?metric=page_total_media_view_unique,page_media_view,page_post_engagements,page_daily_follows&access_token=${accessToken}&period=day&since=${since}&until=${until}`
+ `https://graph.facebook.com/${META_GRAPH_API_VERSION}/${id}/insights?metric=page_total_media_view_unique,page_media_view,page_post_engagements,page_daily_follows&access_token=${accessToken}&period=day&since=${since}&until=${until}`
)
).json();
@@ -1013,7 +1015,7 @@ export class FacebookProvider extends SocialAbstract implements SocialProvider {
// Graph API v23.0+. Engagement metrics below are unaffected.
const { data } = await (
await fetch(
- `https://graph.facebook.com/v23.0/${postId}/insights?metric=post_total_media_view_unique,post_reactions_by_type_total,post_clicks,post_clicks_by_type&access_token=${accessToken}`
+ `https://graph.facebook.com/${META_GRAPH_API_VERSION}/${postId}/insights?metric=post_total_media_view_unique,post_reactions_by_type_total,post_clicks,post_clicks_by_type&access_token=${accessToken}`
)
).json();
diff --git a/libraries/nestjs-libraries/src/integrations/social/instagram.provider.ts b/libraries/nestjs-libraries/src/integrations/social/instagram.provider.ts
index 1ab4c0915..81b7cc880 100644
--- a/libraries/nestjs-libraries/src/integrations/social/instagram.provider.ts
+++ b/libraries/nestjs-libraries/src/integrations/social/instagram.provider.ts
@@ -17,6 +17,7 @@ import {
import { InstagramDto } from '@gitroom/nestjs-libraries/dtos/posts/providers-settings/instagram.dto';
import { Integration } from '@prisma/client';
import { Rules } from '@gitroom/nestjs-libraries/chat/rules.description.decorator';
+import { META_GRAPH_API_VERSION } from '@gitroom/nestjs-libraries/integrations/social/facebook.provider';
import { Tool } from '@gitroom/nestjs-libraries/integrations/tool.decorator';
import { hasExtension } from '@gitroom/helpers/utils/has.extension';
@@ -417,7 +418,7 @@ export class InstagramProvider
const state = makeId(6);
return {
url:
- 'https://www.facebook.com/v20.0/dialog/oauth' +
+ `https://www.facebook.com/${META_GRAPH_API_VERSION}/dialog/oauth` +
`?client_id=${process.env.FACEBOOK_APP_ID}` +
`&redirect_uri=${encodeURIComponent(
`${process.env.FRONTEND_URL}/integrations/social/instagram`
@@ -436,7 +437,7 @@ export class InstagramProvider
}) {
const getAccessToken = await (
await fetch(
- 'https://graph.facebook.com/v20.0/oauth/access_token' +
+ `https://graph.facebook.com/${META_GRAPH_API_VERSION}/oauth/access_token` +
`?client_id=${process.env.FACEBOOK_APP_ID}` +
`&redirect_uri=${encodeURIComponent(
`${process.env.FRONTEND_URL}/integrations/social/instagram${
@@ -450,7 +451,7 @@ export class InstagramProvider
const { access_token, expires_in, ...all } = await (
await fetch(
- 'https://graph.facebook.com/v20.0/oauth/access_token' +
+ `https://graph.facebook.com/${META_GRAPH_API_VERSION}/oauth/access_token` +
'?grant_type=fb_exchange_token' +
`&client_id=${process.env.FACEBOOK_APP_ID}` +
`&client_secret=${process.env.FACEBOOK_APP_SECRET}` +
@@ -460,7 +461,7 @@ export class InstagramProvider
const { data } = await (
await fetch(
- `https://graph.facebook.com/v20.0/me/permissions?access_token=${access_token}`
+ `https://graph.facebook.com/${META_GRAPH_API_VERSION}/me/permissions?access_token=${access_token}`
)
).json();
@@ -471,7 +472,7 @@ export class InstagramProvider
const { id, name, picture } = await (
await fetch(
- `https://graph.facebook.com/v20.0/me?fields=id,name,picture&access_token=${access_token}`
+ `https://graph.facebook.com/${META_GRAPH_API_VERSION}/me?fields=id,name,picture&access_token=${access_token}`
)
).json();
@@ -509,7 +510,7 @@ export class InstagramProvider
// Fetch pages the user explicitly shared during the OAuth dialog
await fetchPaginated(
- `https://graph.facebook.com/v20.0/me/accounts?fields=id,instagram_business_account,username,name,picture.type(large)&limit=100&access_token=${accessToken}`
+ `https://graph.facebook.com/${META_GRAPH_API_VERSION}/me/accounts?fields=id,instagram_business_account,username,name,picture.type(large)&limit=100&access_token=${accessToken}`
);
// Also fetch pages via Business Manager API to discover pages
@@ -517,7 +518,7 @@ export class InstagramProvider
try {
let bizUrl:
| string
- | undefined = `https://graph.facebook.com/v20.0/me/businesses?access_token=${accessToken}`;
+ | undefined = `https://graph.facebook.com/${META_GRAPH_API_VERSION}/me/businesses?access_token=${accessToken}`;
while (bizUrl) {
const bizResponse = await (await fetch(bizUrl)).json();
@@ -525,7 +526,7 @@ export class InstagramProvider
for (const business of bizResponse.data) {
try {
await fetchPaginated(
- `https://graph.facebook.com/v20.0/${business.id}/owned_pages?fields=id,instagram_business_account,username,name,picture.type(large)&limit=100&access_token=${accessToken}`
+ `https://graph.facebook.com/${META_GRAPH_API_VERSION}/${business.id}/owned_pages?fields=id,instagram_business_account,username,name,picture.type(large)&limit=100&access_token=${accessToken}`
);
} catch {
// Continue with other businesses
@@ -533,7 +534,7 @@ export class InstagramProvider
try {
await fetchPaginated(
- `https://graph.facebook.com/v20.0/${business.id}/client_pages?fields=id,instagram_business_account,username,name,picture.type(large)&limit=100&access_token=${accessToken}`
+ `https://graph.facebook.com/${META_GRAPH_API_VERSION}/${business.id}/client_pages?fields=id,instagram_business_account,username,name,picture.type(large)&limit=100&access_token=${accessToken}`
);
} catch {
// Continue with other businesses
@@ -554,7 +555,7 @@ export class InstagramProvider
pageId: p.id,
...(await (
await fetch(
- `https://graph.facebook.com/v20.0/${p.instagram_business_account.id}?fields=name,profile_picture_url&access_token=${accessToken}`
+ `https://graph.facebook.com/${META_GRAPH_API_VERSION}/${p.instagram_business_account.id}?fields=name,profile_picture_url&access_token=${accessToken}`
)
).json()),
id: p.instagram_business_account.id,
@@ -577,13 +578,13 @@ export class InstagramProvider
const [accessToken, userToken] = token.split('___');
const { access_token, ...all } = await (
await fetch(
- `https://graph.facebook.com/v20.0/${data.pageId}?fields=access_token,name,picture.type(large)&access_token=${accessToken}`
+ `https://graph.facebook.com/${META_GRAPH_API_VERSION}/${data.pageId}?fields=access_token,name,picture.type(large)&access_token=${accessToken}`
)
).json();
const { id, name, profile_picture_url, username } = await (
await fetch(
- `https://graph.facebook.com/v20.0/${data.id}?fields=username,name,profile_picture_url&access_token=${accessToken}`
+ `https://graph.facebook.com/${META_GRAPH_API_VERSION}/${data.id}?fields=username,name,profile_picture_url&access_token=${accessToken}`
)
).json();
@@ -605,7 +606,7 @@ export class InstagramProvider
): Promise<string> {
const { status_code, status } = await (
await this.fetch(
- `https://${type}/v20.0/${containerId}?access_token=${checkToken}&fields=status_code,status`,
+ `https://${type}/${META_GRAPH_API_VERSION}/${containerId}?access_token=${checkToken}&fields=status_code,status`,
undefined,
'',
0,
@@ -636,7 +637,7 @@ export class InstagramProvider
try {
const { permalink } = await (
await this.fetch(
- `https://${type}/v20.0/${mediaId}?fields=permalink&access_token=${checkToken}`
+ `https://${type}/${META_GRAPH_API_VERSION}/${mediaId}?fields=permalink&access_token=${checkToken}`
)
).json();
return permalink;
@@ -723,7 +724,7 @@ export class InstagramProvider
const { id: photoId } = await (
await this.fetch(
- `https://${type}/v20.0/${id}/media?${mediaType}${isCarousel}${collaborators}${trialParams}${audioConfiguration}&access_token=${accessToken}${caption}`,
+ `https://${type}/${META_GRAPH_API_VERSION}/${id}/media?${mediaType}${isCarousel}${collaborators}${trialParams}${audioConfiguration}&access_token=${accessToken}${caption}`,
{
method: 'POST',
}
@@ -855,7 +856,7 @@ export class InstagramProvider
const { id: mediaId } = await (
await this.fetch(
- `https://${pendingData.type}/v20.0/${igId}/media_publish?creation_id=${mediaCreationId}&access_token=${accessToken}&field=id`,
+ `https://${pendingData.type}/${META_GRAPH_API_VERSION}/${igId}/media_publish?creation_id=${mediaCreationId}&access_token=${accessToken}&field=id`,
{
method: 'POST',
}
@@ -884,7 +885,7 @@ export class InstagramProvider
// re-running this is safe)
const { id: containerId } = await (
await this.fetch(
- `https://${pendingData.type}/v20.0/${igId}/media?caption=${encodeURIComponent(
+ `https://${pendingData.type}/${META_GRAPH_API_VERSION}/${igId}/media?caption=${encodeURIComponent(
pendingData.message || ''
)}&media_type=CAROUSEL&children=${encodeURIComponent(
pendingData.containers.join(',')
@@ -908,7 +909,7 @@ export class InstagramProvider
const { id: mediaId } = await (
await this.fetch(
- `https://${pendingData.type}/v20.0/${igId}/media_publish?creation_id=${creationId}&access_token=${accessToken}&field=id`,
+ `https://${pendingData.type}/${META_GRAPH_API_VERSION}/${igId}/media_publish?creation_id=${creationId}&access_token=${accessToken}&field=id`,
{
method: 'POST',
}
@@ -1005,7 +1006,7 @@ export class InstagramProvider
const { id: commentId } = await (
await this.fetch(
- `https://${type}/v20.0/${postId}/comments?message=${encodeURIComponent(
+ `https://${type}/${META_GRAPH_API_VERSION}/${postId}/comments?message=${encodeURIComponent(
commentPost.message
)}&access_token=${accessToken}`,
{
@@ -1017,7 +1018,7 @@ export class InstagramProvider
// Get the permalink from the parent post
const { permalink } = await (
await this.fetch(
- `https://${type}/v20.0/${postId}?fields=permalink&access_token=${
+ `https://${type}/${META_GRAPH_API_VERSION}/${postId}?fields=permalink&access_token=${
userToken || accessToken
}`
)
@@ -1087,13 +1088,13 @@ export class InstagramProvider
const { data, ...all } = await (
await fetch(
- `https://${type}/v21.0/${id}/insights?metric=follower_count,reach&access_token=${accessToken}&period=day&since=${since}&until=${until}`
+ `https://${type}/${META_GRAPH_API_VERSION}/${id}/insights?metric=follower_count,reach&access_token=${accessToken}&period=day&since=${since}&until=${until}`
)
).json();
const { data: data2, ...all2 } = await (
await fetch(
- `https://${type}/v21.0/${id}/insights?metric_type=total_value&metric=likes,views,comments,shares,saves,replies&access_token=${accessToken}&period=day&since=${since}&until=${until}`
+ `https://${type}/${META_GRAPH_API_VERSION}/${id}/insights?metric_type=total_value&metric=likes,views,comments,shares,saves,replies&access_token=${accessToken}&period=day&since=${since}&until=${until}`
)
).json();
const analytics = [];
@@ -1127,7 +1128,7 @@ export class InstagramProvider
music(accessToken: string, data: { q: string }) {
return this.fetch(
- `https://graph.facebook.com/v20.0/music/search?q=${encodeURIComponent(
+ `https://graph.facebook.com/${META_GRAPH_API_VERSION}/music/search?q=${encodeURIComponent(
data.q
)}&access_token=${accessToken}`
);
@@ -1162,7 +1163,7 @@ export class InstagramProvider
const { audio } = await (
await this.fetch(
- `https://graph.facebook.com/v22.0/ig_audio?audio_type=${audioType}&user_id=${internalId}${
+ `https://graph.facebook.com/${META_GRAPH_API_VERSION}/ig_audio?audio_type=${audioType}&user_id=${internalId}${
data?.q ? `&search_query=${encodeURIComponent(data.q)}` : ''
}&access_token=${userToken || accessToken}`
)
@@ -1196,7 +1197,7 @@ export class InstagramProvider
// Fetch media insights from Instagram Graph API
const { data } = await (
await fetch(
- `https://${type}/v21.0/${postId}/insights?metric=views,reach,saved,likes,comments,shares&access_token=${accessToken}`
+ `https://${type}/${META_GRAPH_API_VERSION}/${postId}/insights?metric=views,reach,saved,likes,comments,shares&access_token=${accessToken}`
)
).json();
diff --git a/libraries/nestjs-libraries/src/integrations/social/instagram.standalone.provider.ts b/libraries/nestjs-libraries/src/integrations/social/instagram.standalone.provider.ts
index d84c9199a..5cbd5df80 100644
--- a/libraries/nestjs-libraries/src/integrations/social/instagram.standalone.provider.ts
+++ b/libraries/nestjs-libraries/src/integrations/social/instagram.standalone.provider.ts
@@ -12,6 +12,7 @@ import {
} from '@gitroom/nestjs-libraries/integrations/social.abstract';
import { InstagramDto } from '@gitroom/nestjs-libraries/dtos/posts/providers-settings/instagram.dto';
import { InstagramProvider } from '@gitroom/nestjs-libraries/integrations/social/instagram.provider';
+import { META_GRAPH_API_VERSION } from '@gitroom/nestjs-libraries/integrations/social/facebook.provider';
import { Integration } from '@prisma/client';
import { Rules } from '@gitroom/nestjs-libraries/chat/rules.description.decorator';
@@ -86,7 +87,7 @@ export class InstagramStandaloneProvider
profile_picture_url = '',
} = await (
await fetch(
- `https://graph.instagram.com/v21.0/me?fields=user_id,username,name,profile_picture_url&access_token=${access_token}`
+ `https://graph.instagram.com/${META_GRAPH_API_VERSION}/me?fields=user_id,username,name,profile_picture_url&access_token=${access_token}`
)
).json();
@@ -161,7 +162,7 @@ export class InstagramStandaloneProvider
const { user_id, name, username, profile_picture_url } = await (
await fetch(
- `https://graph.instagram.com/v21.0/me?fields=user_id,username,name,profile_picture_url&access_token=${access_token}`
+ `https://graph.instagram.com/${META_GRAPH_API_VERSION}/me?fields=user_id,username,name,profile_picture_url&access_token=${access_token}`
)
).json();