Skip to content

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

feat: maximum 500

Nevo Davidff4ee6c5fe6f
diff --git a/libraries/nestjs-libraries/src/integrations/social.abstract.ts b/libraries/nestjs-libraries/src/integrations/social.abstract.ts
index 10795896b..ec13f7f65 100644
--- a/libraries/nestjs-libraries/src/integrations/social.abstract.ts
+++ b/libraries/nestjs-libraries/src/integrations/social.abstract.ts
@@ -121,9 +121,11 @@ export abstract class SocialAbstract {
json = '{}';
}
+ const handleError = this.handleErrors(json || '{}');
+
if (
request.status === 429 ||
- request.status === 500 ||
+ (request.status === 500 && !handleError) ||
json.includes('rate_limit_exceeded') ||
json.includes('Rate limit')
) {
@@ -137,8 +139,6 @@ export abstract class SocialAbstract {
);
}
- const handleError = this.handleErrors(json || '{}');
-
if (handleError?.type === 'retry') {
await timer(5000);
return this.fetch(
diff --git a/libraries/nestjs-libraries/src/integrations/social/threads.provider.ts b/libraries/nestjs-libraries/src/integrations/social/threads.provider.ts
index eca2307d5..30cbee041 100644
--- a/libraries/nestjs-libraries/src/integrations/social/threads.provider.ts
+++ b/libraries/nestjs-libraries/src/integrations/social/threads.provider.ts
@@ -39,10 +39,18 @@ export class ThreadsProvider extends SocialAbstract implements SocialProvider {
value: string;
}
| undefined {
+ console.log(body);
if (body.includes('Error validating access token')) {
return { type: 'refresh-token', value: 'Threads access token expired' };
}
+ if (body.includes('text must be at most 500 characters')) {
+ return {
+ type: 'bad-body',
+ value: 'Post text exceeds 500 characters limit',
+ };
+ }
+
return undefined;
}
@@ -270,7 +278,7 @@ export class ThreadsProvider extends SocialAbstract implements SocialProvider {
form.append('quote_post_id', quoteId);
}
- const { id: contentId } = await (
+ const { id: contentId, ...all } = await (
await this.fetch(`https://graph.threads.net/v1.0/${userId}/threads`, {
method: 'POST',
body: form,