workflows.fit
Back to n8n workflows
n8n templateFreeBy Yusuke Yamamoto

AI-powered X (Twitter) content generator and scheduler with LangChain and Blotato

This n8n template demonstrates how to use AI to fully automate the generation and scheduling of X (formerly Twitter) content based on a specific, predefined persona. Use cases are many: It's perfect for social media m...

Data & StorageProductivityCommunicationHITLDevelopmentCore NodesAILangchain
Loading interactive preview...

Template notes

This n8n template demonstrates how to use AI to fully automate the generation and scheduling of X (formerly Twitter) content based on a specific, predefined persona.

Use cases are many: It's perfect for social media marketers looking to streamline content creation, individual experts building a consistent brand voice, or businesses aiming to drive traffic to specific services with a steady stream of relevant content.

Good to know

The AI model used in this workflow (via OpenRouter) requires an API key and will incur costs based on usage (typically a few cents per generation). The Blotato node used for posting is a third-party community node and requires a separate Blotato account.

How it works

This workflow is divided into two main processes: Content Generation and Content Posting.

1. Content Generation Process: A Schedule Trigger kicks off the workflow every 4 hours. An AI Agent (LangChain) generates a post based on a detailed prompt defining a persona, purpose, and rules. A Code node refines the AI's output, ensuring the text ends naturally. The generated post is then saved to a Google Sheet with a "Not Posted" status, creating a content queue.

2. Content Posting Process: The workflow retrieves one "Not Posted" item from the Google Sheet. An IF node checks the post's category to determine if an image is required. If an image is needed, it searches for and retrieves a matching image file from a specified Google Drive folder. The Blotato node posts the text (and image, if applicable) to the designated X (Twitter) account. A confirmation email is sent via Gmail to notify stakeholders of the successful post. Finally, the Google Sheet status is updated to "Completed" to prevent duplicate posts.