We built an automated Facebook posting tool for SO Websites, every time we publish a new blog post, it generates a social card, writes a caption, and posts it to Facebook automatically. Here is what we built and what we learned.

The Stack

PHP backend running on cPanel. Facebook Graph API v21.0 for posting. An SVG template system for generating social cards (20 templates, chosen based on post category). Claude API for writing the caption. The whole thing runs as a POST endpoint that gets triggered when a new post is published.

The Rate Limit Reality

Graph API has rate limits that are not clearly documented. In practice: you can make roughly 200 calls per hour per user token before you start getting errors. For a publishing system that makes 3–4 calls per post (upload image, create post, tag page), this is not a constraint unless you are publishing at volume.

What Broke

Token expiry. User access tokens expire. Page access tokens from a user token also expire when the user token does. We solved this with a long-lived page access token, which Facebook allows and which does not expire unless the user changes their password or revokes the app.

What Actually Works

The image generation is the most valuable part. Consistent branded visuals without any manual work per post. The caption quality from Claude is good enough that we rarely edit it. The time saving is roughly 20 minutes per post.