- Create twitter-post sidecar with Playwright for browser automation - Create linkedin-post sidecar with Playwright for browser automation - Add TwitterPublisher class that calls twitter-post sidecar - Add LinkedInPublisher class that calls linkedin-post sidecar - Register both publishers in PublisherManager via AppServiceProvider - Update Posts index view to show Publish button for twitter/linkedin types Both publishers use the same pattern as RedditPublisher: - No API keys required (uses stored credentials from Social Accounts) - Browser automation via Playwright - Returns JSON result with success/failure and URL Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
1023 B
1023 B
Twitter/X Post Sidecar
A Playwright acceptance test that logs into Twitter/X with supplied credentials and creates a post.
One-time setup
cd sidecars/twitter-post
npm install
npx playwright install chromium
Usage
./run.sh --username=YOUR_USERNAME --password=YOUR_PASSWORD \
--tweet="Your tweet text here" [--headed]
Prints a single JSON line to stdout and exits 0 on success, exits 1 on failure:
{"success": true, "url": "https://twitter.com/username/status/..."}
{"success": false, "error": "Login failed: Invalid credentials"}
Notes
- On a failed run, Playwright retains a screenshot and trace under
test-results/for debugging. These are gitignored and not committed, but they persist on disk. - Twitter's UI changes frequently. If posting fails, check the selectors in
tests/twitter-post.spec.jsand update them using:npx playwright codegen https://twitter.com/i/flow/login - Twitter may show CAPTCHAs or 2FA prompts which will cause the automation to fail.