Contents
Master Guide: Pinterest 24/7 Automation Deployment
Professional deployment guide for the Python Pinterest Agent. Setup session cookies, Gemini API, and hourly Windows/GitHub scheduling.
Prerequisites
- Google Gemini API Key (Free)
- Python 3.10+
- Pinterest Account (Session Cookie)
- Basic CLI knowledge
This guide references:
View ProductDeploying the Python Pinterest Automation Infrastructure
Welcome, Operator. While this pack includes an n8n workflow, we strictly recommend deploying the Python Agent for high-volume operations (24+ pins/day). This guide focuses on the Python implementation for maximum stability and account safety.
Phase 1: Authentication & Secrets
The agent requires two critical pieces of data to operate: your Pinterest session and your Gemini brain.
1.1 Extracting the PINTEREST_COOKIE
We do not use passwords. We use an authentic session cookie to bypass login security.
- Open Chrome and log in to Pinterest.com.
- Press F12 to open Developer Tools.
- Go to the Application tab (or Storage in Firefox).
- Expand Cookies on the left and select
https://www.pinterest.com. - Search for the name
_pinterest_sess. - Copy the Value. This is your
PINTEREST_COOKIE.
1.2 Configuring the .env File
Rename .env.example to .env in the python_agent folder and fill in your details:
PINTEREST_COOKIE=paste_your_cookie_here
GEMINI_API_KEY=your_google_ai_studio_key
HEADLESS_MODE=true
MAX_RETRIES=3
Phase 2: Preparing Your Content
2.1 The pins_data.json Structure
The agent reads the pins to be published from this file. Ensure it follows this format:
[
{
"title": "Your Viral Title",
"description": "SEO optimized description",
"link": "https://yourlink.com",
"board_name": "Name of your Pinterest Board",
"alt_text": "Image Alt Text",
"image_path": "",
"published": false
}
]
Note: Leave image_path empty if you want the agent to auto-generate the image.
Phase 3: Deployment Options
Option A: Local PC Automation (Recommended for Starters)
You can turn your Windows PC into a 24/7 publishing station using the built-in Task Scheduler. We use a single command to set this up.
- Open Command Prompt as Administrator.
- Customize and run this command (replace paths with your actual folder location):
schtasks /create /sc hourly /mo 1 /tn "PinterestAgent" /tr "cmd /c cd /d C:\YOUR_PATH\python_agent && venv\Scripts\python.exe main.py >> logs\task.log 2>&1" /f
This command configures the agent to run every hour, resulting in 24 pins published per day.
Option B: GitHub Actions (Cloud Automation)
The pack includes a .github/workflows/hourly_automation.yml file.
- Push your code to a Private GitHub repository.
- Add
PINTEREST_COOKIEandGEMINI_API_KEYto your Repo Secrets. - GitHub will execute the script hourly for free.
Phase 4: High-Volume Strategy (24 Pins/Day)
To maintain a “warm” and high-authority account without getting flagged:
- Interval: Execute
main.pyexactly every 60 minutes. - Boards: Rotate between 3-5 different boards in your
pins_data.json. - Humanity: The agent includes randomized click patterns. Do not disable
Playwright-Stealthsettings inpublisher.py.
đź› Troubleshooting
Cookie Expiration
Pinterest session cookies typically last 30-90 days. If the agent fails with “Login required”, repeat Phase 1.1 to refresh your cookie.
Image Generation Errors
Ensure you have an active internet connection for the Gemini API. Check
logs/task.logfor specific error codes.
For technical assistance, use the /support command in our private Operator Discord.