Skip to content

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

fix(facebook): flag channels that hold a non-page token as needing reconnection

Gilad Resisi8bcb2f548b66
diff --git a/libraries/nestjs-libraries/src/integrations/social/facebook.provider.ts b/libraries/nestjs-libraries/src/integrations/social/facebook.provider.ts
index 5ade76092..0012cd378 100644
--- a/libraries/nestjs-libraries/src/integrations/social/facebook.provider.ts
+++ b/libraries/nestjs-libraries/src/integrations/social/facebook.provider.ts
@@ -81,6 +81,20 @@ export class FacebookProvider extends SocialAbstract implements SocialProvider {
};
}
+ // The token is valid but belongs to the user, not to the page - the page
+ // was never granted to the app, so only reconnecting can fix it
+ if (
+ body.indexOf(
+ 'Unpublished posts must be posted to a page as the page itself'
+ ) > -1
+ ) {
+ return {
+ type: 'refresh-token' as const,
+ value:
+ 'Postiz is not authorized to publish as this page, please reconnect the channel',
+ };
+ }
+
if (body.indexOf('1366046') > -1) {
return {
type: 'bad-body' as const,