LinkedIn Content Suite
Relevant source files
The following files were used as context for generating this wiki page:
- frontend/src/components/LinkedInWriter/LinkedInWriter.tsx
- frontend/src/components/LinkedInWriter/RegisterLinkedInActions.tsx
- backend/services/persona/linkedin/linkedin_persona_prompts.py
- backend/README_LINKEDIN_MIGRATION.md
- frontend/src/components/LinkedInWriter/utils/linkedInWriterUtils.ts
- backend/test/test_linkedin_endpoints.py
- frontend/src/components/LinkedInWriter/components/ArticleHITL.tsx
- frontend/src/components/LinkedInWriter/components/CopilotActions.tsx
The LinkedIn Content Suite is a comprehensive AI-powered system within ALwrity designed to automate and optimize professional content creation for LinkedIn. It supports a wide range of content formats, including posts, long-form articles, carousels, video scripts, and polls. The suite integrates advanced features such as persona-aware writing, real-time web research, AI image generation, and automated citation management to ensure high-quality, professional engagement.
The system is architected as a modular FastAPI backend service integrated with a React-based frontend. It leverages specialized LLM prompts and persona frameworks to maintain authoritative professional tones while adhering to LinkedIn's platform constraints, such as character limits and engagement algorithms.
Sources: backend/README_LINKEDIN_MIGRATION.md:3-15, frontend/src/components/LinkedInWriter/LinkedInWriter.tsx:280-320, README.md:65-75
Architectural Overview
The LinkedIn Content Suite follows a multi-tier architecture involving frontend components, AI-powered Copilot actions, and backend services. The frontend uses CopilotKit to provide an interactive sidebar for users to interact with AI agents, while the backend utilizes the linkedin_service and gemini_provider for content generation.
Frontend Components and Actions
The frontend is built around the LinkedInWriter component, which serves as the primary workspace. It registers multiple sets of actions through RegisterLinkedInActions, allowing the AI to perform complex tasks like generating posts, articles, or images directly from the chat interface.
The diagram above illustrates the request flow from the user interface through the Copilot actions to the backend AI services.
Sources: frontend/src/components/LinkedInWriter/LinkedInWriter.tsx:18-35, frontend/src/components/LinkedInWriter/RegisterLinkedInActions.tsx:120-150, backend/README_LINKEDIN_MIGRATION.md:100-115
Backend Service Structure
The backend was migrated from a monolithic Streamlit application to a modular FastAPI service. It includes Pydantic models for request validation, a core business logic layer in linkedin_service.py, and specialized prompt builders for LinkedIn personas.
| Component | Responsibility | Relevant Files |
|---|---|---|
| Routers | FastAPI route handlers for LinkedIn endpoints | backend/routers/linkedin.py |
| Models | Pydantic request/response schemas | backend/models/linkedin_models.py |
| Services | Core business logic and AI orchestration | backend/services/linkedin_service.py |
| Persona Prompts | LinkedIn-specific prompt engineering | backend/services/persona/linkedin/linkedin_persona_prompts.py |
Sources: backend/README_LINKEDIN_MIGRATION.md:78-90
Content Generation Features
The suite provides specialized generators for various LinkedIn content types, each with its own optimization rules and research capabilities.
LinkedIn Posts and Articles
The generateLinkedInPost and generateLinkedInArticle actions utilize a multi-step progress tracker. This process includes personalizing the topic, conducting research analysis, applying AI grounding, and extracting citations.
- Posts: Optimized for maximum engagement (150-300 words), with automated hashtag generation (3-5 limit).
- Articles: Long-form content supporting SEO optimization, section structuring, and reading time estimation.
This sequence shows the research-backed generation process used for posts and articles.
Sources: frontend/src/components/LinkedInWriter/RegisterLinkedInActions.tsx:135-180, backend/services/persona/linkedin/linkedin_persona_prompts.py:50-70
Visual Content (Carousels and Video Scripts)
- Carousels: Generates multi-slide content with visual hierarchy suggestions and story arc development.
- Video Scripts: Includes hooks, main content scenes with duration, conclusions, and caption generation.
Sources: frontend/src/components/LinkedInWriter/RegisterLinkedInActions.tsx:430-470, backend/README_LINKEDIN_MIGRATION.md:38-45
Persona Optimization and Grounding
A core differentiator of the suite is its use of professional personas to tailor content.
LinkedIn Persona Prompts
The LinkedInPersonaPrompts class builds enhanced prompts based on "onboarding data," which includes industry focus, expertise level, and professional role. This ensures the AI maintains an authoritative yet approachable tone.
Linguistic Style Configuration:
- Industry Focus: Extracts context (e.g., Tech, Healthcare) from website analysis.
- Expertise Level: Adjusts terminology based on the target audience (Beginner to Expert).
- Algorithm Optimization: Enforces LinkedIn best practices like placing links in the first comment and "See More" optimization.
Sources: backend/services/persona/linkedin/linkedin_persona_prompts.py:18-45, backend/services/persona/linkedin/linkedin_persona_prompts.py:145-165
Grounding and Quality Assessment
The system implements "AI grounding" to ensure factual accuracy. It extraction citations and calculates quality metrics, providing recommendations for content improvement.
| Metric | Purpose | Source |
|---|---|---|
| Factual Accuracy | Validates claims against research sources | RegisterLinkedInActions.tsx |
| Citation Coverage | Ensures proper source attribution | RegisterLinkedInActions.tsx |
| Industry Relevance | Checks alignment with industry-specific trends | LinkedInPersonaPrompts.py |
| Tone Analysis | Evaluates sentiment and professional formality | test_linkedin_endpoints.py |
Sources: frontend/src/components/LinkedInWriter/RegisterLinkedInActions.tsx:645-670, backend/test/test_linkedin_endpoints.py:185-200
API and Integration
The suite exposes several RESTful endpoints for integration with the frontend and external tools.
Key API Endpoints
All endpoints are asynchronous and return structured JSON data.
| Endpoint | Method | Description |
|---|---|---|
/api/linkedin/generate-post | POST | Generates research-backed posts |
/api/linkedin/generate-article | POST | Generates long-form articles |
/api/linkedin/generate-image-prompts | POST | Generates 3 AI-optimized image prompts |
/api/linkedin/generate-image | POST | Generates actual image from prompt |
/api/linkedin/optimize-profile | POST | Optimizes headline and about sections |
Sources: backend/README_LINKEDIN_MIGRATION.md:100-110, frontend/src/components/LinkedInWriter/RegisterLinkedInActions.tsx:25-50
Image Generation Logic
The suite includes specialized actions for visual enhancement. generateLinkedInImagePrompts creates content-aware prompts (e.g., Professional, Creative, or Industry-Specific styles) which are then processed by the generateLinkedInImage action.
Sources: frontend/src/components/LinkedInWriter/RegisterLinkedInActions.tsx:75-100
Conclusion
The LinkedIn Content Suite provides a robust framework for professional social media management. By combining structured AI generation with real-time research and persona-driven constraints, it enables users to produce high-quality, platform-optimized content. Its modular architecture ensures scalability and ease of integration within the broader ALwrity digital marketing platform.