Social Sharing
Automatically share posts to Twitter and Facebook when they are published.
TL;DR
Go to Admin → Settings → Social Sharing. Enable auto-sharing for Twitter and/or Facebook, configure API credentials in .env, then check Share on Publish when creating or editing a post.
Details
Overview
When a post transitions to published status — either by clicking Publish immediately, or when a scheduled post's publish time arrives — Pubvana can automatically post a share to your connected social accounts.
Auto-sharing is controlled at two levels:
- Global toggle (Admin → Settings → Social Sharing) — enables or disables auto-sharing for each platform site-wide.
- Per-post toggle — the Share on Publish checkbox on the post editor. If unchecked, that post will not be shared even if global auto-sharing is on.
Both must be enabled for a post to be shared.
Twitter / X Configuration
Twitter sharing uses OAuth 1.0a via the abraham/twitteroauth library.
Add the following keys to your .env file:
TWITTER_API_KEY=your-api-key
TWITTER_API_SECRET=your-api-secret
TWITTER_ACCESS_TOKEN=your-access-token
TWITTER_ACCESS_SECRET=your-access-token-secret
Where to get credentials:
- Go to developer.twitter.com and create a project and app.
- Under Keys and Tokens, generate your API Key, API Secret, Access Token, and Access Token Secret.
- Ensure your app has Read and Write permissions (required to post tweets).
The shared tweet contains the post title and URL.
Facebook Configuration
Facebook sharing uses the Facebook Graph API.
Add the following key to your .env file:
FACEBOOK_PAGE_TOKEN=your-page-access-token
Where to get a Page Access Token:
- Go to developers.facebook.com and create an app.
- Add the Pages API product.
- Generate a Page Access Token for the Facebook Page you want to post to.
- Ensure the token has the
pages_manage_postspermission.
The shared post contains the post title, excerpt, and URL.
Per-Post Share Control
On the post editor, the Share on Publish checkbox determines whether this specific post will trigger auto-sharing when published.
- Checked + global toggle on → post is shared when published.
- Unchecked → post is never auto-shared, regardless of global settings.
- Sharing only fires once, on the initial transition to published status. Re-saving a published post does not trigger another share.
Troubleshooting
If posts are not being shared:
- Confirm the global toggle is enabled in Admin → Settings → Social Sharing.
- Confirm the Share on Publish checkbox was checked before publishing.
- Verify your API credentials are correctly set in
.envwith no extra spaces or quote characters. - Check that your Twitter app has Read and Write permissions (not Read Only).
- For Facebook, confirm the Page Access Token has not expired (long-lived tokens last ~60 days; use a permanent token for production).