Automation

Automate Your LinkedIn Content Workflow: A No-Code/AI Toolkit

May 15, 2023
Nexovate Team
Automate Your LinkedIn Content Workflow: A No-Code/AI Toolkit

Since Minh Chau wrote about automating his LinkedIn posts, I have been playing around with automation myself. I wanted to push it further and see if I can connect it to my ChatGPT to create posts specific to prompts and tailored to audience - what if you could automate the entire pipeline using free tools, no servers, and just a sprinkle of Python?

In this guide, I'll walk you through building a fully automated code creation, content creation and management system using Google Sheets, OpenAI, and Google Colab. You'll go from scattered post ideas to AI-generated, audience-specific LinkedIn content that you can approve, track, and reuse.

1Prompt 1: Set Up the Brain — Google Sheet as a Prompt Engine

Let's start by building the brain of your system: a Google Sheet that holds your ideas and audiences.

Create a Google Sheet titled LinkedIn Weekly Posts with two tabs:

Tab 1: "Prompts"
  • Column A: Post_ID (unique identifier)
  • Column B: Topic (your post idea)
  • Column C: Audience (target demographic)
  • Column D: Tone (professional, casual, etc.)
  • Column E: Status (pending, generated, posted)
Tab 2: "Generated_Posts"
  • Column A: Post_ID (links to Prompts tab)
  • Column B: Generated_Content
  • Column C: Date_Generated
  • Column D: Approval_Status
  • Column E: Posted_Date

2Prompt 2: The Magic — Python Script in Google Colab

Now we'll create the automation engine that reads your prompts and generates content.

Open Google Colab and create a new notebook. Here's the complete automation script:

# Install required packages
!pip install openai gspread oauth2client

import openai
import gspread
from oauth2client.service_account import ServiceAccountCredentials
import pandas as pd
from datetime import datetime
import time

# Set up OpenAI API
openai.api_key = 'your-openai-api-key'

# Google Sheets setup
scope = ['https://spreadsheets.google.com/feeds',
         'https://www.googleapis.com/auth/drive']

# Upload your service account JSON file to Colab
creds = ServiceAccountCredentials.from_json_keyfile_name('path-to-your-credentials.json', scope)
client = gspread.authorize(creds)

# Open your Google Sheet
sheet = client.open('LinkedIn Weekly Posts')
prompts_sheet = sheet.worksheet('Prompts')
posts_sheet = sheet.worksheet('Generated_Posts')

The Content Generation Function:

def generate_linkedin_post(topic, audience, tone):
    prompt = f"""
    Create a LinkedIn post about {topic} for {audience} with a {tone} tone.
    
    Requirements:
    - 150-300 words
    - Include relevant hashtags
    - Add a call-to-action
    - Make it engaging and professional
    - Include line breaks for readability
    """
    
    response = openai.ChatCompletion.create(
        model="gpt-3.5-turbo",
        messages=[{"role": "user", "content": prompt}],
        max_tokens=500,
        temperature=0.7
    )
    
    return response.choices[0].message.content

3Prompt 3: Automation Loop — Process All Pending Posts

Create the main automation function that processes all your pending prompts.

def process_pending_posts():
    # Get all prompts
    prompts_data = prompts_sheet.get_all_records()
    
    for i, row in enumerate(prompts_data, start=2):  # Start from row 2 (skip header)
        if row['Status'].lower() == 'pending':
            try:
                # Generate content
                content = generate_linkedin_post(
                    row['Topic'], 
                    row['Audience'], 
                    row['Tone']
                )
                
                # Add to Generated_Posts sheet
                posts_sheet.append_row([
                    row['Post_ID'],
                    content,
                    datetime.now().strftime('%Y-%m-%d %H:%M:%S'),
                    'Pending Review',
                    ''
                ])
                
                # Update status in Prompts sheet
                prompts_sheet.update_cell(i, 5, 'Generated')
                
                print(f"Generated post for: {row['Topic']}")
                time.sleep(2)  # Rate limiting
                
            except Exception as e:
                print(f"Error processing {row['Topic']}: {str(e)}")

# Run the automation
process_pending_posts()

4Prompt 4: Schedule and Deploy

Set up automated scheduling to run your content generation regularly.

Option 1: Manual Trigger

Run the Colab notebook manually whenever you want to generate new content from your pending prompts.

Option 2: Automated Scheduling

Use Google Apps Script to trigger the process automatically:

function triggerColabNotebook() {
  // This would call your Colab notebook via webhook
  // Set up a time-based trigger in Apps Script
  var url = 'your-colab-webhook-url';
  UrlFetchApp.fetch(url, {method: 'POST'});
}

The Complete Workflow in Action

  1. Monday: Add 5-7 post ideas to your Google Sheet "Prompts" tab
  2. Tuesday: Run the Colab script to generate AI content
  3. Wednesday: Review and approve generated posts in "Generated_Posts" tab
  4. Thursday-Sunday: Copy approved content to LinkedIn and post
  5. Repeat: The cycle continues with fresh ideas

Pro Tips for Maximum Impact

Content Strategy

  • Mix educational, personal, and industry insight posts
  • Use different tones: professional, conversational, thought-provoking
  • Target different audiences: beginners, experts, decision-makers
  • Include questions to drive engagement

Technical Optimization

  • Adjust OpenAI temperature for creativity vs consistency
  • Create prompt templates for different post types
  • Add error handling and retry logic
  • Track performance metrics in additional sheet tabs

What You've Built

Congratulations! You now have a complete LinkedIn content automation system that:

  • ✅ Generates audience-specific content using AI
  • ✅ Manages your content pipeline in Google Sheets
  • ✅ Requires zero server maintenance
  • ✅ Costs only for OpenAI API usage
  • ✅ Scales with your content needs
  • ✅ Maintains quality through human review

🚀 Ready to Take It Further?

This system is just the beginning. You could extend it to:

  • Auto-post to LinkedIn using their API
  • Generate images using DALL-E
  • Analyze post performance and optimize prompts
  • Create content for multiple social platforms

The possibilities are endless when you combine AI with smart automation!

Need Help Implementing This System?

At Nexovate, we specialize in creating custom automation workflows like this for professional service firms and small businesses. If you'd like help setting up this LinkedIn automation system or building other business automation solutions, book a strategy session with our team.

We also offer a complete LinkedIn Content Automation Toolkit that includes the Google Sheets template, Python scripts, and step-by-step setup guide. .

Share this article