Skip to content

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

feat: providers

Nevo Davide3741fe448cb
diff --git a/libraries/nestjs-libraries/src/integrations/social/facebook.provider.ts b/libraries/nestjs-libraries/src/integrations/social/facebook.provider.ts
index 08d1bdff7..a2ff01b8d 100644
--- a/libraries/nestjs-libraries/src/integrations/social/facebook.provider.ts
+++ b/libraries/nestjs-libraries/src/integrations/social/facebook.provider.ts
@@ -106,6 +106,13 @@ export class FacebookProvider extends SocialAbstract implements SocialProvider {
};
}
+ if (body.indexOf('2069019') > -1) {
+ return {
+ type: 'bad-body' as const,
+ value: 'Invalid file',
+ }
+ }
+
if (body.indexOf('1404102') > -1) {
return {
type: 'bad-body' as const,
diff --git a/libraries/nestjs-libraries/src/integrations/social/mastodon.provider.ts b/libraries/nestjs-libraries/src/integrations/social/mastodon.provider.ts
index 8e05c8055..8239340d9 100644
--- a/libraries/nestjs-libraries/src/integrations/social/mastodon.provider.ts
+++ b/libraries/nestjs-libraries/src/integrations/social/mastodon.provider.ts
@@ -20,6 +20,22 @@ export class MastodonProvider extends SocialAbstract implements SocialProvider {
return 500;
}
+ override handleErrors(
+ body: string,
+ status: number
+ ):
+ | { type: 'refresh-token' | 'bad-body' | 'retry'; value: string }
+ | undefined {
+ if (body.includes('Your login is currently disabled')) {
+ return {
+ type: 'refresh-token',
+ value: 'Your login is currently disabled',
+ };
+ }
+
+ return undefined;
+ }
+
async refreshToken(refreshToken: string): Promise<AuthTokenDetails> {
return {
refreshToken: '',
@@ -113,7 +129,12 @@ export class MastodonProvider extends SocialAbstract implements SocialProvider {
);
}
- async uploadFile(instanceUrl: string, fileUrl: string, accessToken: string, alt?: string) {
+ async uploadFile(
+ instanceUrl: string,
+ fileUrl: string,
+ accessToken: string,
+ alt?: string
+ ) {
const form = new FormData();
form.append('file', await fetch(fileUrl).then((r) => r.blob()));
if (alt) {
diff --git a/libraries/nestjs-libraries/src/integrations/social/pinterest.provider.ts b/libraries/nestjs-libraries/src/integrations/social/pinterest.provider.ts
index 649042f4b..799d3e089 100644
--- a/libraries/nestjs-libraries/src/integrations/social/pinterest.provider.ts
+++ b/libraries/nestjs-libraries/src/integrations/social/pinterest.provider.ts
@@ -97,6 +97,12 @@ export class PinterestProvider
value: 'You can upload a maximum of 5 images per post on Pinterest.',
};
}
+ if (body.indexOf('Board not found') > -1) {
+ return {
+ type: 'bad-body' as const,
+ value: 'The specified board was not found. Please check the board ID.',
+ }
+ }
if (body.indexOf('cover_image_url or cover_image_content_type') > -1) {
return {
type: 'bad-body' as const,