Quick Overview
This workflow runs daily to publish scheduled LinkedIn posts from a Google Sheets content calendar, drafting copy with OpenRouter and generating an image with OpenAI before publishing via upload-post, while sending approval requests, failure alerts, and a daily digest to Telegram.
How it works
- Runs every day at 09:00 (cron) and reads rows from a Google Sheets post calendar.
- Filters the sheet for rows that are Approved, scheduled for today, and not already Published, and processes each due post one at a time.
- Loads brand guidelines from a separate Google Sheets tab and uses OpenRouter (with a fallback model) to draft LinkedIn post copy in a structured JSON format.
- Uses OpenAI to generate a black-and-white post image based on the drafted copy, uploads it to imgbb, and then hosts the photo for LinkedIn using the upload-post API.
- Publishes the post to LinkedIn via upload-post, marking the row as Published in Google Sheets on success.
- If publishing returns an error, sends an admin alert to Telegram and updates the Google Sheets row status to Error.
- Sends Telegram messages to request manager review for rows marked pending_review and posts a daily Telegram digest with the number of published posts.
Setup
- Connect credentials for Google Sheets, OpenRouter, OpenAI, Telegram, imgbb (HTTP query auth), upload-post, and SMTP email.
- Update the Google Sheets document and sheet/tab URLs for both the post calendar and the brand guide to point to your own spreadsheets.
- Ensure your calendar sheet includes columns like id, Date Scheduled (dd/MM/yyyy), Topic, and Status, and use Status values Approved, pending_review, Published, and Error.
- Set the environment variables MANAGER_TELEGRAM_CHAT_ID, ADMIN_TELEGRAM_CHAT_ID, and ALERT_EMAIL used by the Telegram and email alert steps.
- Verify the upload-post request parameters (user, visibility, and LinkedIn platform) and the imgbb upload settings match your accounts and desired publishing behavior.