Quick overview
This workflow runs every morning to pull inventory from Shopify, Amazon SP-API, and Etsy, calculates days of cover and reorder quantities, then uses OpenAI to draft a purchase brief that is emailed via Gmail, summarized in Telegram, and logged to Google Sheets.
How it works
- Runs daily at 7:00 and requests current inventory data from Shopify, Amazon Selling Partner API, and Etsy.
- Combines the available channel responses into a single SKU list while recording any channels that failed to return data.
- Calculates daily sales velocity, days of cover, target stock, and reorder quantity per SKU and flags items that fall below the reorder point.
- If no SKUs are low, sends a Telegram message stating there is nothing to reorder.
- If SKUs are low, sends the computed low-stock data to OpenAI to generate a prioritized purchasing plan and formats a fallback plan if the model output is missing or invalid.
- Emails the purchase plan via Gmail, posts a short status summary to Telegram, and appends each low-stock SKU as a new row in a Google Sheets “Reorder Plan” tab.
Setup
- Configure HTTP Header Auth (or the required auth method) for Shopify Admin API, Amazon SP-API, Etsy API, and the OpenAI Chat Completions API, and replace the placeholder URLs/shop IDs.
- Update the Shopify domain, Etsy shop ID, and ensure the inventory responses include the fields mapped in the merge step (SKU, stock, sold last 30 days, and lead time) or adjust the field mappings accordingly.
- Add a Gmail OAuth connection and set the recipient address used for the purchase plan email.
- Add a Telegram credential, set your Telegram chat ID, and ensure the bot can message the target chat.
- Add a Google Sheets OAuth connection, set the target spreadsheet ID, and create a sheet tab named “Reorder Plan” with columns that match the appended fields.