Quick overview
This workflow scans Google Merchant Center for disapproved Shopify products, uses OpenAI to draft minimal compliant fixes (title/description/GTIN actions), routes proposals to Slack for approval, applies approved changes back to Shopify, and tracks outcomes in Google Sheets with a daily verification report and Slack Q&A.
How it works
- Runs on a daily schedule (7 AM IST to detect disapproved items and 8 AM IST to verify applied fixes) or when an approval link webhook is opened from Slack.
- Fetches products from the Google Merchant API, keeps items with DISAPPROVED (or optionally DEMOTED) issues for the configured country, and extracts issue details plus a Shopify product/variant mapping from the offer ID.
- Loads fix history and a GTIN master from Google Sheets, skips recently handled items, checks GTIN candidates (including check-digit validation), and pulls the current product details from Shopify via the Admin GraphQL API.
- Sends the combined Merchant Center + Shopify context to OpenAI (gpt-4o-mini) to identify the root cause and generate the smallest safe fix, then validates the proposed text/GTIN against configured rules and confidence thresholds.
- Writes either a fix proposal or a human task into the Google Sheets “Fix History” tab, posts a daily Slack digest, and sends fix proposals to Slack with one-time Approve/Reject links.
- When someone approves, verifies the signed token and proposal status, updates the Shopify product (and variant barcode when needed), records the result back to Google Sheets, and posts a confirmation to Slack (or records a rejection).
- On the 8 AM run, re-fetches Merchant Center products, marks applied proposals as resolved or still disapproved in Google Sheets, and posts a verification report to Slack.
- Replies to Slack app mentions by using an OpenAI agent that queries Google Sheets tools to answer questions about proposal status and disapproval history in the thread.
Setup
- Create Shopify Admin API access (e.g., a custom app with read_products and write_products) and add it as HTTP Header Auth for the Shopify GraphQL requests, then set your Shopify domain in the workflow config.
- Add Google OAuth2 credentials for the Google Merchant API with scope https://www.googleapis.com/auth/content and update the Merchant Center account ID and country code in the workflow config.
- Create a Google Sheet with “Fix History” and “GTIN Master” tabs, connect Google Sheets credentials, and replace REPLACE_WITH_GOOGLE_SHEET_ID wherever it appears.
- Connect Slack credentials, set the target channel IDs for digest/proposals/status messages, and ensure your Slack app can receive app_mention events.
- Add OpenAI credentials for gpt-4o-mini and review/update the workflow config values (approval webhook domain, approval_secret, title/description limits, and regex rules) before activating.
- Set this workflow as its own error workflow in n8n settings and replace the Slack error-alert channel ID so failed runs are reported.