Social Media Analysis and Automated Email Generation n8n Workflow Template

n8n workflow template · 13 nodes · OpenAI

Social Media Analysis and Automated Email Generation is a free n8n workflow template that starts from the Google Sheets Trigger node and works with OpenAI, Email (SMTP) and Google Sheets. It has 13 nodes, 3 of them AI nodes (OpenAI Chat Model, Structured Output Parser and Basic LLM Chain). To run it, you add your own credentials for Google Sheets OAuth2, Google Sheets Trigger OAuth2, HTTP Header Auth, OpenAI API and SMTP.

At a glance

Trigger
Google Sheets Trigger (Google Sheets Trigger)
Nodes
13
Apps
OpenAI, Email (SMTP) and Google Sheets
AI nodes
3
Credentials
5 types
Category
Email automation

Apps and integrations

  • OpenAI
  • Email (SMTP)
  • Google Sheets

Node types used

  • Edit Fields (Set)
  • HTTP Request
  • Code
  • OpenAI Chat Model
  • Structured Output Parser
  • Basic LLM Chain
  • Send Email
  • Google Sheets Trigger
  • Google Sheets
  • If

How it works

The text below comes from the sticky notes inside the workflow. We removed links, code samples and anything that looks like a key or token.

Personalize here

Set

  • your name
  • your company name
  • your company activity, used to find a match with your leads
  • your email, used as the sender

Here you can modify the prompt

  • make it better by adding some examples
  • Follow a known framework

Setup notes

The text below comes from the sticky notes inside the workflow. We removed links, code samples and anything that looks like a key or token.

Social Media Analysis and Automated Email Generation

> by Thomas Vie

Who is this for?

This template is ideal for marketers, lead generation specialists, and business professionals seeking to analyze social media profiles of potential leads and automate personalized email outreach efficiently.

What problem is this workflow solving?

Manually analyzing social media profiles and crafting personalized emails can be time-consuming and prone to errors. This workflow streamlines the process by integrating social media APIs with AI to generate tailored communication, saving time and increasing outreach effectiveness.

What this workflow does

  1. Google Sheets Integration: Start with a Google Sheet containing lead information such as LinkedIn URL, Twitter handle, name, and email.
  2. Social Media Data Extraction: Automatically fetch profile and activity data from Twitter and LinkedIn using RapidAPI integrations.
  3. AI-Powered Content Generation: Use OpenAI's Chat Model to analyze the extracted data and generate personalized email subject lines and cover letters.
  4. Automated Email Dispatch: Send the generated email directly to the lead, with a copy sent to yourself for tracking purposes.
  5. Progress Tracking: Update the Google Sheet to indicate completed actions.

Setup

  1. Google Sheets
  • Create a sheet with the columns: LinkedIn URL, name, Twitter handle, email, and a "done" column for tracking.
  • Populate the sheet with your leads.
  1. RapidAPI Accounts
  • Sign up for RapidAPI and subscribe to the Twitter and LinkedIn API plans.
  • Configure API authentication keys in the workflow.
  1. AI Configuration
  • Connect OpenAI Chat Model with your API key for text generation.
  1. Email Integration
  • Add your email credentials or service (SMTP or third-party service like Gmail) for sending automated emails.

How to customize this workflow to your needs

  • Modify the AI Prompt: Adapt the prompt in the AI node to better align with your tone, style, or specific messaging framework.
  • Expand Data Fields: Add additional data fields in Google Sheets if you require further personalization.
  • API Limits: Adjust API configurations to fit your usage limits or upgrade to higher tiers for increased data scraping capabilities.
  • Personalize Email Templates: Tweak email formats to suit different audiences or use cases.
  • Extend Functionality: Integrate additional social media platforms or CRM tools as needed.

By implementing this workflow, you’ll save time on repetitive tasks and create more effective lead generation strategies.

Create a Gooogle sheet with the following columns

  • linkedin_url
  • twitter_handler

And put some data in it except in "done" that should remain empty.

Call RapidAPI Twitter API Profile Data

You have to create an account in RapidAPI and subscribe to Twiiter API. With a free account you will be able to scrape 500 tweets / month. After your subscription you will have to choose as Generic Auth Type: Header Auth and then put as header name: "x-rapidapi-key" and the value given in the RapidAPI interface

Call RapidAPI Fresh Linkedin Profile Data

You have to create an account in RapidAPI and subscribe to Fresh LinkedIn Profile Data. With a free account you will be able to scrape 100 profile / month. After your subscription you will have to choose as Generic Auth Type: Header Auth and then put as header name: "x-rapidapi-key" and the value given in the RapidAPI interface

Nodes in this workflow

The 13 nodes in file order (sticky notes excluded). Branches and connections determine execution order in n8n:

  1. Set your company's variables (Edit Fields (Set))
  2. Get linkedin Posts (HTTP Request)
  3. Get twitter ID (HTTP Request)
  4. Get tweets (HTTP Request)
  5. Extract and limit Linkedin (Code)
  6. Exract and limit X (Code)
  7. OpenAI Chat Model (OpenAI Chat Model)
  8. Structured Output Parser (Structured Output Parser)
  9. Generate Subject and cover letter based on match (Basic LLM Chain)
  10. Send Cover letter and CC me (Send Email)
  11. Google Sheets Trigger (Google Sheets Trigger)
  12. Google Sheets (Google Sheets)
  13. If (If)

Credentials you need

  • Google Sheets OAuth2 – used by Google Sheets
  • Google Sheets Trigger OAuth2 – used by Google Sheets Trigger
  • HTTP Header Auth – used by Get linkedin Posts, Get tweets and Get twitter ID
  • OpenAI API – used by OpenAI Chat Model
  • SMTP – used by Send Cover letter and CC me

Configure your own credentials after importing. Create each credential in n8n, then select it in the node.

How to import into n8n

  1. Download the JSON file with the button above.
  2. In n8n, open a new workflow, select the ... menu and choose Import from File. You can also paste the JSON straight into the editor canvas.
  3. Open each node that shows a warning and select or create its credential.
  4. Read the notes on the canvas, test the workflow with sample data, then activate it.

Do you need somewhere to run it? Read our guide to self-hosted n8n.

Need this customised?

We can adapt this workflow to your apps, data and process, then deploy and support it.

Contact Us