$ cat workspace-template.yaml

S

Social Posts Payloads

// Template per la creazione di post social su Instagram, facebook, X e LinkedIn partendo da und ocumento del Drive. Genera un'anteprima del post per ciascun social e il payload necessario alla pubblicazione nelle piattaforme social

Media Production

// Canvas Preview

canvas.flow

// Instruction

instruction.md

Social Posts Payloads

Overview

This workflow automates the creation of social media content by extracting text from Google Drive documents and transforming it into platform-specific posts. It produces both an HTML preview and a structured JSON payload for Facebook, X (Twitter), Instagram, and LinkedIn, requiring only the selection of the source document(s) from Drive.

Workflow Chain

[Drive Document Reader]  -> [Facebook Post Payload]  -> [X Post Payload]  -> [Instagram Post Payload]  -> [Linkedin Post Payload]

Node Reference

  • Drive Document Reader: Extracts text content from selected Google Drive documents.
    • Inputs from: User selection.
    • Configurable inputs: driveItemId (UUID of the document).
    • Output: content (string).
  • Facebook Post Payload: Generates a Facebook-optimized post.
    • Inputs from: Drive Document Reader.
    • Configurable inputs: Riassunto_Contenuto_Facebook__prompt (default: "Riassumi questo contenuto in modo conciso e accattivante per un pubblico Facebook.").
    • Output: Social_Post_Payload__preview_html, Social_Post_Payload__payload.
  • X Post Payload: Generates a professional X post.
    • Inputs from: Drive Document Reader.
    • Configurable inputs: Riassunto_Contenuto__prompt (default: "Riassumi questo contenuto per creare un post X professionale e coinvolgente.").
    • Output: Social_Post_Payload__payload, Social_Post_Payload__preview_html.
  • Instagram Post Payload: Generates a short, punchy Instagram caption.
    • Inputs from: Drive Document Reader.
    • Configurable inputs: Testo_Instagram__prompt (default: "Riassumi questo contenuto in un testo per Instagram di 138-150 caratteri...").
    • Output: Social_Post_Payload__payload, Social_Post_Payload__preview_html.
  • Linkedin Post Payload: Generates a long-form professional LinkedIn post.
    • Inputs from: Drive Document Reader.
    • Configurable inputs: Testo_LinkedIn__prompt (default: "Trasforma questo riassunto in un post LinkedIn completo...").
    • Output: Social_Post_Payload__payload, Social_Post_Payload__preview_html.

Execution Strategy

You MUST complete all 3 phases in order: Phase 1 -> Phase 2 -> Phase 3. Do NOT skip any phase.

  1. Phase 1: Initialization and Selection

    • Call requestUserDecision to confirm: a) Which Drive document(s) to process? (Context: Source material for posts) b) Do you want to customize any specific platform prompts? (Context: Default prompts are provided, but can be overridden) c) Do you want to proceed with generating all four platform payloads? (Context: Confirm scope)
    • Phase 1 complete. Now proceed to Phase 2. Do NOT skip to Phase 3.
  2. Phase 2: Content Processing

    • Execute Drive Document Reader using the selected driveItemId.
    • For EACH platform node (Facebook, X, Instagram, LinkedIn), repeat: a) Pass the content output from the reader to the respective Riassunto_Contenuto or content input port. b) Trigger the node execution to generate the preview_html and payload.
    • Phase 2 complete. Now proceed to Phase 3.
  3. Phase 3: Review and Follow-up

    • Present the generated preview_html for each platform to the user.
    • Call followUp to ask: "Would you like to regenerate any specific post, or are you ready to export the JSON payloads?"

Configuration Tips

User saysConfigure
"Make the LinkedIn post more formal"Linkedin Post Payload: Testo_LinkedIn__prompt="[Custom prompt]"
"Keep Instagram posts under 100 chars"Instagram Post Payload: Testo_Instagram__prompt="[Custom prompt]"

Error Handling

  • Node Execution Failure: Often caused by empty Drive documents. Verify the document contains text before running.
  • Missing Input: If a node fails to trigger, ensure the edge from Drive Document Reader is correctly connected to the content port of the target node.
  • API Timeout: If the document is extremely long, the LLM may time out. Split the document into smaller files if necessary.

Incremental Edits to an Existing Workflow

  • Detection: If the canvas already contains the four macro nodes, treat as an edit.
  • Add/Remove: To remove a platform, delete the node and its associated edge. To add a new platform, clone an existing macro node and connect the content output from Drive Document Reader.
  • Post-edit: After any structural change, run autoLayout() to maintain readability. Re-run the Phase 1-3 sequence to verify the new configuration.

// Dependencies

requirements.py
1from input import DriveDocumentReader