A powerful, Instagram automation toolkit that leverages n8n workflows and Playwright for profile analysis, personalized messaging, and screenshot capture.
This tutorial will guide you through setting up a powerful Instagram automation system using n8n workflows and Playwright browser automation. With this system, you can automate profile analysis, send personalized messages, and capture screenshots without writing a single line of code.
Automatically analyze Instagram profiles using AI to understand content themes, visual style, and audience engagement.
Generate and send targeted messages based on profile content and user interests.
Take automated screenshots of profiles for further visual analysis and record-keeping.
Works seamlessly on Linux, macOS, and Windows with Docker.
Before you begin, make sure you have the following:
Note: This tutorial assumes you already have Docker set up with the necessary containers:
First, clone the GitHub repository to get all the necessary files:
git clone https://github.com/wangdangel/insta_n8n.git
cd insta_n8n
The project includes setup scripts for both Linux/macOS and Windows:
chmod +x setup.sh
./setup.sh
Double-click setup.bat
or run it from Command Prompt.
These scripts will:
Important: If you prefer manual setup, refer to the README.md file for detailed step-by-step instructions.
Once the setup is complete, you can access n8n through your browser:
http://localhost:5678
You'll be prompted to create an account or log in if you already have one.
In the n8n interface:
basic_working_instagram_msg.json
or instgram_v2 (working).json
fileTip: The instgram_v2 (working).json
is the enhanced version with AI-powered profile analysis and personalized messaging capabilities.
The main workflow (instgram_v2 (working).json
)
consists of several interconnected components that handle different aspects of the automation:
Note: The workflow uses several AI models powered by Google Gemini. You'll need to configure these components with your own API key.
In both workflow files, you need to update the Instagram credentials node with your account information:
YOUR_EMAIL@YOUR_PROVIDER.COM
with your Instagram emailYOUR_PASSWORD
with your Instagram passwordSecurity Note: Your credentials are stored within n8n and are not transmitted outside your local environment. However, it's recommended to use a separate Instagram account for testing.
To enable AI components, set up Google Gemini API integration:
Tip: The free tier of Google Gemini API should be sufficient for testing and moderate usage.
To test a simple workflow without AI components:
insta_n8n.json
workflowFor the complete AI-powered workflow:
instgram_v2 (working).json
workflowThe workflow will:
Tip: Click on each node during execution to see its input and output data. This helps with troubleshooting and understanding the workflow.
You can modify how the AI analyzes profiles and generates messages:
For example, in the Messaging Agent, you can adjust the prompt to emphasize different aspects of your product/service or change the messaging tone.
To modify how screenshots are captured:
numScreenshots
:
Number of screenshots to take (default: 3)scrollPercent
:
How far to scroll between screenshots (default: 0.8)waitTime
:
Milliseconds to wait between scrolls (default: 3000)The workflow is modular, so you can extend it with additional capabilities:
When using automation with Instagram, be aware of the following:
When you're done using the automation, you can stop the Docker containers:
chmod +x cleanup.sh
./cleanup.sh
Double-click cleanup.bat
or run it from Command Prompt.
To keep your automation running smoothly:
Issue | Solution |
---|---|
Playwright installation fails |
Run manually in Docker:
|
n8n can't connect to Playwright |
Check if the API server is running:
Ensure the API is listening on port 3333.
|
Instagram security challenge | If Instagram shows a security challenge, you'll need to manually log in to your account and complete the verification. |
Line ending issues in Windows |
If you encounter errors related to line endings:
|
Need Help? If you encounter issues not covered here, check the GitHub repository issues or create a new one with detailed information about your problem.
If you find this project helpful and would like to support its development:
This project is licensed under the MIT License - see the LICENSE file for details.
Take control of your Instagram outreach with this powerful, local-first automation solution.