Automates posting images from a Google Drive folder: searches Drive, skips already-posted files (records kept in Supabase), uploads new images to a Supabase storage bucket (public URL), generates captions via OpenAI, creates Instagram media containers and publishes them via the Facebook Graph API, and records posted images in Supabase.
SocialContentEngine is an automation workflow built in n8n that connects Google Drive, Supabase, OpenAI, and the Instagram Graph API to streamline social content publishing.
It checks Google Drive for new files, avoids duplicates via Supabase, uploads valid images to a Supabase bucket, generates captions with OpenAI, and posts them to Instagram automatically. Posted entries are logged back in Supabase for record-keeping.
- 📂 Google Drive Integration – fetch new images from a specific folder
- 🛢 Supabase Database – check if files are already posted & record posted ones
- ☁ Supabase Storage – store images & generate public URLs
- ✍ AI Captions – generate creative captions/hashtags with OpenAI
- 📸 Instagram Auto-Posting – publish to Instagram Business/Creator accounts
- 🔄 Fully Automated – once set, everything runs on schedule
| Component | Tool / Service |
|---|---|
| Automation Engine | n8n |
| File Source | Google Drive |
| Database & Storage | Supabase (Postgres + S3) |
| AI Captioning | OpenAI API |
| Social Posting | Facebook Graph API (Instagram) |
SocialContentEngine/
├── images/ # Screenshots (flow diagram, outputs, etc.)
├── Social Media Post.json # n8n workflow export
└── README.md-
Running n8n instance (self-hosted or cloud)
-
Google Drive API enabled with OAuth2 credentials
-
Supabase project with:
- Public storage bucket (
insta_uploads) - Database table (
my_table) to track posted files
- Public storage bucket (
-
Facebook Developer App + Page + Instagram Business/Creator account
-
OpenAI API key
You’ll need to configure credentials in n8n for:
- Google Drive OAuth2 – connect Drive and provide Folder ID.
- Supabase – project URL + service role key.
- OpenAI – API key for GPT caption generation.
- Facebook Graph API – Page access token with
instagram_content_publishpermission and your Instagram business account ID.
-
Enable Google Drive API in Google Cloud.
-
Create OAuth2 credentials → add redirect URI for n8n (
/rest/oauth2-credential/callback/googleDriveOAuth2Api). -
In workflow, replace folder ID in:
'YOUR_FOLDER_ID' in parents and mimeType contains 'image/'
-
Create storage bucket:
insta_uploads(public). -
Create table:
create table public.my_table ( id text primary key, name text not null, created_at timestamptz default now() );
-
Update workflow’s Supabase nodes (
Supabase Check,Adding New Entry, and HTTP upload node). -
Use endpoint format:
POST https://<PROJECT_REF>.supabase.co/storage/v1/object/insta_uploads/{filename} -
Public URL:
https://<PROJECT_REF>.supabase.co/storage/v1/object/public/insta_uploads/{filename}
- Get API key from OpenAI.
- Configure OpenAI node in n8n → model
gpt-4o-mini. - Pass image binary as input to generate captions/hashtags.
-
Create a Facebook App.
-
Link a Page and Instagram Business/Creator account.
-
Generate Page access token with
instagram_content_publish. -
Get Instagram Business ID:
GET /{page-id}?fields=instagram_business_account -
Use that ID as
nodein workflow’s Instagram nodes.
- Import
Social Media Post.jsoninto n8n. - Configure all credentials.
- Test node-by-node (Google Drive → Supabase → Upload → OpenAI → Instagram).
- Activate workflow & schedule runs.
- New Drive images will now be auto-posted to Instagram with AI captions.
| Workflow Flow | Instagram Post Example |
|---|---|
![]() |
![]() |
For any help, queries, or collaborations, reach out:
👤 Usama Shahid
📧 Email: dev.usamashahid@gmail.com
🔗 LinkedIn: linkedin.com/in/-usamashahid
🐙 GitHub: github.com/fewgets
This project is for learning & research purposes. Feel free to fork, adapt, and improve.

