naystack - v1.9.9
    Preparing search index...
    • Checks whether an access token is allowed to publish.

      Meta exposes no scope-listing endpoint for Instagram Login tokens, so this probes the publishing quota — a read-only endpoint that needs exactly the same instagram_business_content_publish scope publishing does. Nothing is posted.

      Worth calling before createInstagramPost in a scheduled job: a token whose access was revoked fails here with a clear reason, instead of surfacing later as a container error.

      Rejects — rather than answering false — if the request itself fails, so a network blip is never reported as a missing permission.

      Parameters

      • token: string

        Instagram access token.

      Returns Promise<boolean>

      Promise of true if the token can publish. On false, the API's reason is logged.

      import { canPublishToInstagram } from "naystack/socials";

      if (!(await canPublishToInstagram(process.env.INSTAGRAM_ACCESS_TOKEN!))) {
      throw new Error("Instagram token cannot publish — reconnect with the publish scope");
      }