Quick Overview
This manual workflow reads pending editorial prospects from Google Sheets, matches each one to a published WooCommerce product from an EU or NA store, fetches the prospect page metadata, scores editorial relevance with OpenAI, and upserts a prioritized review record back into Google Sheets.
How it works
- Runs when started manually.
- Fetches all published products from two WooCommerce stores (EU and NA) and reads pending prospects from a Google Sheets tab.
- Validates each prospect (region, permission status, and safe public URL) and text-matches it to the best-fit regional WooCommerce product.
- For valid prospects, requests the target URL and extracts the page title and meta description from the HTML response.
- Sends the page metadata and matched product context to the OpenAI Chat Completions API to get a JSON relevance score, rationale, pitch angle, and suggested anchors.
- Combines the OpenAI relevance score with sheet-provided domain rating and traffic inputs to set a review status and append-or-update the opportunity in the Google Sheets Opportunities tab.
- For invalid, unapproved, or unsafe prospects (or fetch/metadata failures), skips the AI step and writes a flagged record to the Opportunities tab for manual follow-up.
Setup
- Add WooCommerce credentials for both regional stores and ensure product permalinks use the expected EU/NA hostnames.
- Add a Google Sheets OAuth credential, replace REPLACE_WITH_SPREADSHEET_ID, and ensure the Pending_Leads and Opportunities sheet tabs exist.
- Add an OpenAI API key as an HTTP Bearer Auth credential for the OpenAI Chat Completions request and change the model name if your account requires it.
- Ensure Pending_Leads includes the required columns (prospect_id, target_url, target_region, brand, model, part_category, permission_status) and Opportunities has opportunity_key set as the match column for upserts.