Skip to content

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

feat: fix

Nevo David379704c997c1
diff --git a/libraries/nestjs-libraries/src/integrations/social/instagram.provider.ts b/libraries/nestjs-libraries/src/integrations/social/instagram.provider.ts
index fd787a921..c548a7755 100644
--- a/libraries/nestjs-libraries/src/integrations/social/instagram.provider.ts
+++ b/libraries/nestjs-libraries/src/integrations/social/instagram.provider.ts
@@ -383,21 +383,47 @@ export class InstagramProvider
const since = dayjs().subtract(date, 'day').unix();
const { data, ...all } = await (
- await fetch(
- `https://graph.facebook.com/v20.0/${id}/insights?metric=follower_count,impressions,reach,profile_views&access_token=${accessToken}&period=day&since=${since}&until=${until}`
+ await this.fetch(
+ `https://graph.facebook.com/v20.0/${id}/insights?metric=follower_count,impressions,reach&access_token=${accessToken}&period=day&since=${since}&until=${until}`
+ )
+ ).json();
+
+ const { data: data2, ...all2 } = await (
+ await this.fetch(
+ `https://graph.facebook.com/v20.0/${id}/insights?metric_type=total_value&metric=likes,comments,shares,saves,replies&access_token=${accessToken}&period=day&since=${since}&until=${until}`
)
).json();
+ const analytics = [];
- return (
- data?.map((d: any) => ({
+ analytics.push(
+ ...(data?.map((d: any) => ({
label: d.title,
percentageChange: 5,
data: d.values.map((v: any) => ({
total: v.value,
date: dayjs(v.end_time).format('YYYY-MM-DD'),
})),
- })) || []
+ })) || [])
+ );
+
+ analytics.push(
+ ...data2.map((d: any) => ({
+ label: d.title,
+ percentageChange: 5,
+ data: [
+ {
+ total: d.total_value.value,
+ date: dayjs().format('YYYY-MM-DD'),
+ },
+ {
+ total: d.total_value.value,
+ date: dayjs().add(1, 'day').format('YYYY-MM-DD'),
+ },
+ ],
+ }))
);
+
+ return analytics;
}
music(accessToken: string, data: { q: string }) {