Quick overview
This workflow runs daily to refresh TikTok post and profile analytics from Upload Post, uses Sheets as a performance log and persistent “skill” memory, generates a 4-slide carousel concept with Google Gemini, creates images with fal.ai, publishes to TikTok via Upload Post, and updates the skill file with OpenAI.
How it works
- Runs on a daily schedule (or manually) and loads configuration values like product details, Upload Post user, and the Google Sheets document ID.
- Reads prior posts from Google Sheets, pulls missing or recent TikTok post analytics from the Upload Post API, and writes updated metrics (views, likes, comments, shares, engagement rate) back to the sheet.
- Fetches overall TikTok profile analytics from Upload Post and reads the current “Agent Skill” memory and refreshed performance log from Google Sheets to build a consolidated context summary.
- Uses Google Gemini (with a structured JSON parser) to generate a new TikTok carousel plan including caption, strategy notes, hashtags, engagement question, and four 9:16 slide prompts with on-image text.
- Sends the four prompts to fal.ai to generate four vertical PNG images, then combines the resulting image URLs into a single set for publishing.
- Uses OpenAI to write a short TikTok photo description, publishes the carousel to TikTok via Upload Post, logs the new post details to Google Sheets, and then uses OpenAI to update the “Agent Skill” content for the next run.
Setup
- Create or copy a Google Sheets file with two tabs—“Performance Log” and “Agent Skill”—and ensure the required columns exist (including request_id for matching stats updates).
- Add Google Sheets OAuth2 credentials in n8n and set the correct spreadsheet ID in the workflow configuration.
- Add an Upload Post account credential for publishing and an HTTP Header Auth credential for the Upload Post analytics API endpoints, then set your Upload Post username (and API key if you store it in config).
- Add a Google PaLM (Gemini) API credential for the strategy generation step.
- Add a fal.ai HTTP Header Auth credential for image generation.
- Add an OpenAI API credential for generating the TikTok description and maintaining the Agent Skill memory.