Skip to content

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

feat: mentions

Nevo David58abf6eb00f8
diff --git a/apps/backend/src/api/routes/integrations.controller.ts b/apps/backend/src/api/routes/integrations.controller.ts
index d658fa6e6..5393f3859 100644
--- a/apps/backend/src/api/routes/integrations.controller.ts
+++ b/apps/backend/src/api/routes/integrations.controller.ts
@@ -278,7 +278,7 @@ export class IntegrationsController {
name: p.label,
username: p.id,
image: p.image,
- }))
+ })).filter((f: any) => f.name)
);
}
@@ -292,7 +292,7 @@ export class IntegrationsController {
...newList,
],
(p) => p.id
- );
+ ).filter(f => f.label && f.image && f.id);
}
@Post('/function')
diff --git a/libraries/nestjs-libraries/src/database/prisma/integrations/integration.repository.ts b/libraries/nestjs-libraries/src/database/prisma/integrations/integration.repository.ts
index b432f2468..ae5762230 100644
--- a/libraries/nestjs-libraries/src/database/prisma/integrations/integration.repository.ts
+++ b/libraries/nestjs-libraries/src/database/prisma/integrations/integration.repository.ts
@@ -54,6 +54,9 @@ export class IntegrationRepository {
platform: string,
mentions: { name: string; username: string; image: string }[]
) {
+ if (mentions.length === 0) {
+ return [];
+ }
return this._mentions.model.mentions.createMany({
data: mentions.map((mention) => ({
platform,
diff --git a/libraries/nestjs-libraries/src/integrations/social/threads.provider.ts b/libraries/nestjs-libraries/src/integrations/social/threads.provider.ts
index 37ed96fad..6ae041863 100644
--- a/libraries/nestjs-libraries/src/integrations/social/threads.provider.ts
+++ b/libraries/nestjs-libraries/src/integrations/social/threads.provider.ts
@@ -13,6 +13,7 @@ import { capitalize, chunk } from 'lodash';
import { Plug } from '@gitroom/helpers/decorators/plug.decorator';
import { Integration } from '@prisma/client';
import { stripHtmlValidation } from '@gitroom/helpers/utils/strip.html.validation';
+import { TwitterApi } from 'twitter-api-v2';
export class ThreadsProvider extends SocialAbstract implements SocialProvider {
identifier = 'threads';
@@ -23,6 +24,7 @@ export class ThreadsProvider extends SocialAbstract implements SocialProvider {
'threads_content_publish',
'threads_manage_replies',
'threads_manage_insights',
+ // 'threads_profile_discovery',
];
editor = 'normal' as const;
@@ -413,8 +415,7 @@ export class ThreadsProvider extends SocialAbstract implements SocialProvider {
{
id: makeId(10),
media: [],
- message:
- postDetails?.[0]?.settings?.thread_finisher,
+ message: postDetails?.[0]?.settings?.thread_finisher,
settings: {},
},
lastReplyId,
@@ -526,4 +527,29 @@ export class ThreadsProvider extends SocialAbstract implements SocialProvider {
return false;
}
+
+ // override async mention(
+ // token: string,
+ // data: { query: string },
+ // id: string,
+ // integration: Integration
+ // ) {
+ // const p = await (
+ // await fetch(
+ // `https://graph.threads.net/v1.0/profile_lookup?username=${data.query}&access_token=${integration.token}`
+ // )
+ // ).json();
+ //
+ // return [
+ // {
+ // id: String(p.id),
+ // label: p.name,
+ // image: p.profile_picture_url,
+ // },
+ // ];
+ // }
+ //
+ // mentionFormat(idOrHandle: string, name: string) {
+ // return `@${idOrHandle}`;
+ // }
}