This project allows you to post to Meta Threads programmatically via the Threads API, using a secure backend powered by FastAPI and deployed on Render.
- Full OAuth2 flow (via Meta Threads)
- Post new Threads (with or without image)
- Publish Threads after creation
- Combined route to post and publish in one go
- Designed to work perfectly with Postman
Create a .env file locally or configure these in your Render dashboard:
APP_ID=your_meta_app_id
APP_SECRET=your_meta_app_secret
REDIRECT_URI=https://your-app-name.onrender.com/auth/callbackRender handles HTTPS out of the box, making it perfect for Threads API integration.
Create a file called render.yaml:
services:
- type: web
name: threads-automate
env: python
buildCommand: "pip install -r requirements.txt"
startCommand: "uvicorn main:app --host 0.0.0.0 --port 10000"
envVars:
- key: APP_ID
sync: false
- key: APP_SECRET
sync: false
- key: REDIRECT_URI
sync: falseThen push to your connected GitHub repo and let Render auto-deploy it with HTTPS support. Make sure this project is pushed to a GitHub repository.
- Go to the Meta App Dashboard.
- Click “Create App” and choose Business or None (either works for testing).
- Enter basic app info (name, email, etc.).
- Once created, you'll land in the App Dashboard.
In the permissions and features, make sure you have these perms given

In the Settings, make sure you have these settings
The name of my project in render was called threads-automate. This is why the redirect callback URL and other stuff has
that specific URL.
4. 📦 Install dependencies (if running locally) --THIS WONT WORK FOR THREADS LOCALLY SINCE IT NEEDS HTTPS
pip install -r requirements.txtUse in browser only
Initiates the OAuth login flow:
https: // your - app - name.onrender.com / login{
"access_token": "EAABsbCS1iHg...",
...
}{
"access_token": "your_access_token_here",
"text": "This one goes straight to Threads 🚀",
"image_url": "https://your-image-url.com/image.jpg" // optional
}- In the left sidebar, go to “Roles” > “Roles” > “Instagram Testers”.
- Click “Add Instagram Testers”.
- Enter your Instagram username (must be the same account you'll log in with on Threads).
- Save and send the invitation.
- Go to https://www.instagram.com/accounts/manage_access on the web (not the app).
- Log in with the Instagram account you invited.
- Accept the invitation under the “Apps and Websites” section.
- In your Meta App, go to “Settings > Basic” and copy your App ID and App Secret.
- Then go to “Facebook Login > Settings”:
- Add your Redirect URI (e.g.
https://your-app-name.onrender.com/auth/callback) - Enable
weblogin type.
- Add your Redirect URI (e.g.
Paste your values into the .env file (locally or in Render's dashboard):
APP_ID=your_meta_app_id
APP_SECRET=your_meta_app_secret
REDIRECT_URI=https://your-app-name.onrender.com/auth/callback