💬 Send personalized LinkedIn DMs to profile visitors with ConnectSafely.ai and Google Sheets

221 views · 💬 Lead Nurturing & AI Sales Agents

💡 Pro Tip — If you’re pulling LinkedIn data through HTTP requests or dealing with API restrictions, there’s a community node called ScraperNode that handles this natively. It has dedicated scrapers for profiles, companies, jobs, and people search — you just pass a URL and get structured data back.

View All Scrapers

Description

Send Personalized DMs to LinkedIn Profile Visitors

Who’s it for

This workflow is built for sales professionals, recruiters, founders, and networkers who want to automatically reach out to people who viewed their LinkedIn profile. Perfect for anyone who knows that profile visitors are warm leads but doesn’t have time to manually check who visited, craft personalized messages, and send outreach one by one.

If you’re doing outbound sales, recruiting talent, building partnerships, or simply want to convert curiosity into conversations, this automation turns passive profile views into active outreach opportunities.

How it works

The workflow automatically identifies LinkedIn profile visitors and sends them personalized messages based on their connection status.

The process flow:

  1. Scheduled trigger runs weekly (or manually) to fetch recent profile visitors
  2. ConnectSafely.ai API retrieves all visitors from the past 7 days
  3. Splits visitors into individual records for processing
  4. Checks Google Sheets to avoid messaging the same person twice
  5. Routes based on connection degree:
    • 1st-degree connections → Sends a personalized DM
    • 2nd/3rd-degree connections → Sends a connection request with message
  6. Logs all outreach to Google Sheets for tracking
  7. Waits between messages to maintain natural activity patterns
  8. Loop continues until all visitors are processed

Setup steps

Step 1: Configure ConnectSafely.ai API Credentials

Obtain API Key

  1. Create an account at ConnectSafely.ai
  2. Connect your LinkedIn account in the dashboard
  3. Navigate to SettingsAPI Keys
  4. Generate a new API key

Add Bearer Auth Credential in n8n

  1. Go to Credentials in n8n
  2. Click Add CredentialHTTP Bearer Auth
  3. Name it “ConnectSafely.ai API”
  4. Paste your API key
  5. Save the credential

This credential is used by all three HTTP Request nodes: Fetch Profile Visitors, Send DM, and Send Connection Request.

Step 2: Configure Google Sheets Integration

2.1 Create Your Tracking Sheet

Create a new Google Sheet with the following columns:

Column NameDescription
NameVisitor’s full name
Linkedin URLVisitor’s profile URL
StatusOutreach status (DONE)

2.2 Connect Google Sheets Account

  1. Go to CredentialsAdd CredentialGoogle Sheets OAuth2
  2. Follow the OAuth flow to connect your Google account
  3. Grant access to Google Sheets

2.3 Update All Google Sheets Nodes

There are three Google Sheets nodes that need configuration:

  1. Check if Already Contacted - Looks up existing contacts
  2. Log DM Sent to Sheet - Records DMs sent
  3. Log Connection Request to Sheet - Records connection requests

For each node:

  1. Open the node
  2. Replace YOUR_GOOGLE_SHEET_ID with your actual sheet ID (from the URL)
  3. Select the correct sheet name
  4. Save

Step 3: Customize Your Message Templates

The workflow includes two Code nodes with message templates that you must customize:

For Connected Users (DMs)

Open the “Generate DM for Connected User” node and update:

// Sender footer - CUSTOMIZE THIS
const footer = `\n\n— Your Name`;

// Message bodies - CUSTOMIZE THESE
const messages = [
  "Noticed you recently checked out my profile... I've been working on [YOUR PRODUCT] — [BRIEF DESCRIPTION].",
  // Add more variations...
];

For New Connections (Connection Requests)

Open the “Generate Message for New Connection” node and update the same sections with your product/service details.

Tips for good messages:

Step 4: Adjust the Schedule

  1. Open the Weekly Schedule Trigger node
  2. Adjust based on your profile traffic:
    • High traffic: Daily
    • Medium traffic: Every 3 days
    • Low traffic: Weekly (default)

Step 5: Test the Workflow

  1. Click Test Workflow on the Schedule Trigger or add a Manual Trigger
  2. Verify:
    • Profile visitors are fetched correctly
    • Deduplication works (no existing contacts get messaged)
    • Connection degree routing works properly
    • Messages are personalized with visitor names
    • Google Sheets logs entries correctly

Customization

Time Range for Visitors

Edit the JSON body in the Fetch Profile Visitors node:

{"timeRange":"past_7_days","start":0,"fetchAll":true}

Options:

Message Personalization

Both Code nodes support multiple message variations. The workflow randomly selects one for each visitor, making your outreach feel more natural.

To add more variations:

  1. Open the relevant Code node
  2. Add new message strings to the messages array
  3. Use placeholders like [YOUR PRODUCT] and replace with your actual content

Wait Time Between Messages

The Wait Between Messages node adds delays between outreach. Adjust the duration to:

Recommended: 1-5 minutes between messages

Add More Tracking Fields

To track additional data in Google Sheets:

  1. Add columns to your sheet (e.g., Message Sent, Connection Degree, Date)
  2. Update the Google Sheets nodes to map these new fields
  3. Pull data from the workflow context using expressions

Filter by Company or Title

Want to only message visitors from specific companies or with certain titles?

  1. Add an IF node after Skip if Already Contacted
  2. Add conditions based on visitor data fields
  3. Route non-matching visitors directly to the Wait node

Use Cases


Troubleshooting

Common Issues & Solutions

Issue: No visitors returned from API

Issue: Duplicate messages being sent

Issue: Messages not sending

Issue: Wrong message type sent (DM vs Connection Request)

Issue: Profile ID extraction failing

Issue: Google Sheets not updating

Issue: Rate limit errors


Rate Limiting Best Practices

LinkedIn monitors automated activity. To stay safe:


Costs & Considerations

ServiceCost
ConnectSafely.aiFree trial available, then subscription
Google SheetsFree
n8nFree (self-hosted) or cloud pricing

No per-message costs - ConnectSafely.ai subscription includes API access for messaging.


Documentation & Resources

Official Documentation

Support Channels


Connect With Us

Stay updated with the latest automation tips and LinkedIn strategies:


Need Custom Workflows?

Looking to build sophisticated LinkedIn automation workflows tailored to your business needs?

Contact our team for custom automation development, strategy consulting, and enterprise solutions.

We specialize in:

🔗 Nodes Used

Google Sheets, HTTP Request, Schedule Trigger

📥 Import

Download workflow.json and import into n8n: Workflow menu → Import from File

📖 Importing guide · 🔑 Credential setup