Automate Instagram Posts Using Google Drive, OpenAI & Facebook Graph API

This detailed tutorial guides you through automating Instagram posts triggered by new files in Google Drive. Using Google Drive, OpenAI’s AI captioning, Google Sheets, and Facebook Graph API, it streamlines post creation and publishing, saving time and enhancing engagement.
googleDriveTrigger
openAi
facebookGraphApi
+2
Workflow Identifier: 1221
NODES in Use: googleDriveTrigger, googleDrive, openAi, googleSheets, facebookGraphApi
Automate Instagram posts with n8n and OpenAI

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

What This Workflow Does

This workflow watches for new photos or videos added to a Google Drive folder.

It downloads the media, then uses AI to write an Instagram caption.

After that it saves post info in a Google Sheet.

Finally, it creates and publishes the post on Instagram automatically.

This helps avoid manual posting and missed deadlines.


Tools and Services Used

  • Google Drive: Stores media files uploaded by the creative team.
  • OpenAI GPT-4o-mini: Generates creative Instagram captions based on the media file.
  • Google Sheets: Logs post details including captions and media URLs for tracking.
  • Facebook Graph API: Creates and publishes posts on Instagram business accounts.
  • n8n: Runs the automated workflow connecting all services.

How the Workflow Works (Input → Process → Output)

Inputs

  • New media files (photos, videos, carousels) added to a chosen Google Drive folder.

Processing Steps

  • The Google Drive Trigger detects file creation in the folder.
  • Google Drive node downloads the actual media file using the dynamic file ID.
  • OpenAI node generates an Instagram caption using the filename and a prompt.
  • Google Sheets node saves the filename, caption, media URL, and thumbnail into a spreadsheet.
  • Facebook Graph API node creates an Instagram post draft with media and caption.
  • A second Facebook Graph API node publishes the post live using creation ID.

Output

  • Instagram post published with media and AI-generated caption.
  • Organized record of every post in Google Sheets for review.

Who Should Use This Workflow

This workflow is good for social media managers and teams who handle multiple client Instagram accounts.

It suits those who get images or videos from shared Google Drive folders.

This saves time from manual posting and writing captions.

It also fits users who want consistent daily posts without missing deadlines.


Beginner Step-by-Step: How to Use This Workflow in n8n

Importing the Workflow

  1. Inside the n8n editor, click the Download button on this page to get the workflow JSON file.
  2. In n8n, choose Import from File and select the downloaded file.

Configuring Credentials and IDs

  1. Add your Google Drive credentials to the Google Drive Trigger and Google Drive nodes.
  2. Add your OpenAI API Key in the OpenAI node.
  3. Input your Google Sheets API credentials and specify the spreadsheet ID where post data will be stored.
  4. Update the Facebook Graph API nodes with your Instagram Business account numeric ID.
  5. Set URLs and other parameters in Facebook Graph API nodes using dynamic expressions from previous steps if needed.

Prompt for Caption Generation

The OpenAI prompt looks like this:

=Generate an engaging Instagram caption for a {{ $('Post File Upload in Google Drive Folder  Trigger').item.json.name }} about [Description]. Include:
2-3 sentences with emojis
3-5 relevant hashtags
A call-to-action
Keep it under 150 characters...

You can copy and paste this directly into the OpenAI node message content field.

Testing and Activating

  1. After configurations, test the workflow by uploading a sample media file to the Google Drive folder.
  2. Check if the caption is generated and the post is created in Instagram as a draft.
  3. Review Google Sheets for correct data logging.
  4. When ready, activate the workflow by switching it on in n8n editor.

For full control and scaling, consider self-host n8n.


Common Input and Output Details

Inputs: Media files with names uploaded to Google Drive folder.

Outputs: Published Instagram posts with captions and entry records in Google Sheets.


Edge Cases and Troubleshooting

File not found error: Usually means file ID is wrong or folder permissions are insufficient.

Empty captions: Check if OpenAI prompt is correct and API key is valid.

Failed Instagram media upload: Confirm Instagram Business ID and API parameters are correct.


Customization Ideas

  • Change the AI prompt style for different tones like formal or casual.
  • Update media-type parameter to post images, videos, or carousels as needed.
  • Add extra data columns in Google Sheets for dates or engagement tracking.
  • Modify Google Drive folder watch to cover multiple client folders.
  • Add delays or conditions to control exact posting schedule.

Summary of Benefits and Results

✓ Saves hours weekly by automating media posting.

✓ Reduces errors from manual uploads and caption writing.

✓ Provides consistent Instagram content with AI-crafted captions.

✓ Keeps post records neatly in Google Sheets for management.

→ Instagram posts publish automatically once media is uploaded.

→ Workflow runs continuously after activation with minimal user input.


Automate Instagram posts with n8n and OpenAI

Visit through Desktop to Interact with the Workflow.

Frequently Asked Questions

This workflow needs an Instagram Business account connected to the Facebook Graph API. Personal accounts are not supported.
Yes, posting through Facebook Graph API consumes API quota based on account type and usage.
Files stay in Google Drive and are only temporarily handled in n8n during processing.
Check folder permissions and ensure the file ID is passed dynamically with the expression {{ $json.id }}.

Promoted by BULDRR AI

Related Workflows

Automate Twist Channel Creation and Messaging with n8n

This workflow automates creating and updating a channel in Twist and sending a personalized message to specific users. It eliminates manual setup errors and saves time managing Twist communications.

Automate Ideogram Image Generation with Google Sheets & Gmail

This workflow automates graphic design image generation via Ideogram AI, storing image data in Google Sheets and Google Drive, with email alerts via Gmail. It saves designers hours by automating image creation, remixing, review, and record-keeping.

Automate IT Support with Slack and OpenAI in n8n

Streamline IT support by automating Slack message handling using n8n and OpenAI. This workflow handles Slack DMs, filters bots, queries a Confluence knowledge base, and delivers AI-generated responses, improving support efficiency and response time.

Automate Crypto Analysis with CoinMarketCap & n8n AI Agent

Discover how this unique n8n workflow leverages CoinMarketCap’s multi-agent AI to deliver precise, real-time cryptocurrency insights directly via Telegram. Manage crypto data analysis efficiently with automated multi-source API integration.

Automate Gumroad to Beehiiv Subscriber Sync with n8n

Learn how to automatically add new Gumroad sales customers as Beehiiv newsletter subscribers using n8n automation. This workflow saves time by syncing sales data to Google Sheets CRM and notifying your Telegram channel instantly.

Generate On-Brand Blog Articles Using n8n and OpenAI

This workflow automates the creation of on-brand blog articles by analyzing existing company content using n8n and OpenAI. It extracts article structures and brand voice to produce consistent draft articles, saving significant content creation time.
1:1 Free Strategy Session
Your competitors are already automating. Are you still paying for it manually?

Do you want to adopt AI Automation?

Every hour your team does repetitive work, you're burning real money.
While you wait, faster businesses are cutting costs and moving quicker.
AI and automations aren't the future anymore — they're the present.

Book a live 1-on-1 session where we show you exactly which of your daily tasks can be automated — and what it’s costing you not to.