• Townie
    AI
  • Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
project logo

artivilla

farcaster-autoPostToX

automatically cross-posts your Farcaster casts to X
Public
Like
farcaster-autoPostToX
Home
Code
2
README.md
H
index.ts
Branches
3
Pull requests
Remixes
1
History
Environment variables
4
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
README.md
Code
/
README.md
Search
6/11/2025
Viewing readonly version of main branch: v26
View latest version
README.md

Farcaster to Twitter/X Cross-Poster

This Val Town script automatically cross-posts your Farcaster casts to Twitter/X using webhooks.

Features

  • ✅ Automatic cross-posting from Farcaster to Twitter
  • ✅ Image support by uploading natively to Twitter (farcaster has 2 media limit per post)
  • ✅ Video support (popular hosting video URLs auto-unfurl on Twitter)
  • ✅ URL preservation in posts
  • ✅ Character limit validation (280 char limit)
  • ✅ Error handling and logging
  • ✅ Skips replies to avoid spam

Setup Instructions

Step 1: Fork This Val

  1. Fork this Val Town script to your account
  2. Note your Val's URL (you'll need this for the Neynar webhook setup)

Step 2: Create Twitter Developer Account & API Keys

  1. Go to Twitter Developer Portal
  2. Create a developer account if you don't have one
  3. Create a new app/project

Important: Set Up User Authentication Settings FIRST

Before generating your access tokens, you must configure user authentication:

  1. In your Twitter app settings, go to "User authentication settings"
  2. Set up OAuth 1.0a with Read and Write permissions
  3. Add your website URL and callback URL (can be placeholder URLs)
  4. Save the settings

Generate API Keys

After setting up authentication with read/write permissions:

  1. Go to "Keys and Tokens" tab
  2. Generate/copy these credentials:
    • API Key (TWITTER_API_KEY)
    • API Secret (TWITTER_API_SECRET)
    • Access Token (TWITTER_ACCESS_TOKEN)
    • Access Token Secret (TWITTER_ACCESS_TOKEN_SECRET)

Note: Free plan limits: 100 posts read + 500 writes per month

Step 3: Set Environment Variables

In your Val Town script, add these environment variables:

  • TWITTER_API_KEY
  • TWITTER_API_SECRET
  • TWITTER_ACCESS_TOKEN
  • TWITTER_ACCESS_TOKEN_SECRET

Step 4: Create Neynar Webhook (Paid Plan Required)

  1. Go to Neynar Webhook Setup
  2. Create a new webhook with these settings:
    • Event Type: cast.created
    • Target URL: Your Val Town script URL (e.g., https://yourname-scriptname.web.val.run)
    • Filter: Configure to only receive your own casts (set your username)

Note: Neynar webhooks require a paid plan

Troubleshooting

Check the Val Town logs if posts aren't appearing on Twitter:

  • Verify all environment variables are set
  • Ensure Twitter API keys have read/write permissions
  • Check that webhook URL is correctly configured in Neynar
  • Verify your Neynar webhook is active and properly filtered
FeaturesVersion controlCode intelligenceCLI
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.