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

Go to Workflow
0 views
Built by ConnectSafely ConnectSafely
Created on June 07, 2026

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

Setup steps

Step 1: Configure ConnectSafely.ai API Credentials

Obtain API Key

Create an account at ConnectSafely.ai
Connect your LinkedIn account in the dashboard
Navigate to Settings → API Keys
Generate a new API key

Add Bearer Auth Credential in n8n

Go to Credentials in n8n
Click Add Credential → HTTP Bearer Auth
Name it "ConnectSafely.ai API"
Paste your API key
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 Name | Description |
|-------------|-------------|
| Name | Visitor's full name |
| Linkedin URL | Visitor's profile URL |
| Status | Outreach status (DONE) |

2.2 Connect Google Sheets Account

Go to Credentials → Add Credential → Google Sheets OAuth2
Follow the OAuth flow to connect your Google account
Grant access to Google Sheets

2.3 Update All Google Sheets Nodes

There are three Google Sheets nodes that need configuration:

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

For each node:
Open the node
Replace YOUR_GOOGLE_SHEET_ID with your actual sheet ID (from the URL)
Select the correct sheet name
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:
Keep under 300 characters for connection requests
Personalize with their name (already included)
Mention something specific about why you're reaching out
Include a clear but soft call-to-action
Have 3-5 variations to avoid repetitive messaging

Step 4: Adjust the Schedule

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

Step 5: Test the Workflow

Click Test Workflow on the Schedule Trigger or add a Manual Trigger
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:
past_7_days - Last week's visitors (default)
past_30_days - Last month's visitors
past_90_days - Last quarter's visitors

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:
Open the relevant Code node
Add new message strings to the messages array
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:
Increase if you want more conservative pacing
Decrease if you have premium LinkedIn and higher limits

Recommended: 1-5 minutes between messages

Add More Tracking Fields

To track additional data in Google Sheets:
Add columns to your sheet (e.g., Message Sent, Connection Degree, Date)
Update the Google Sheets nodes to map these new fields
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?
Add an IF node after Skip if Already Contacted
Add conditions based on visitor data fields
Route non-matching visitors directly to the Wait node

Use Cases

Sales Prospecting**: Automatically reach out to decision-makers who are researching you before a sales cycle
Recruiting**: Engage passive candidates who are checking out your profile after seeing job posts
Founder Networking**: Connect with investors, partners, and potential hires who show interest
Consulting/Freelance**: Convert profile visitors into discovery calls by reaching out while you're top of mind
Personal Branding**: Build your network by engaging everyone who takes time to view your profile

Troubleshooting

Common Issues & Solutions

Issue: No visitors returned from API
Solution**: Ensure your LinkedIn account is connected in ConnectSafely.ai dashboard. Also verify you've had recent profile views (check LinkedIn's native viewer count).

Issue: Duplicate messages being sent
Solution**: Verify the Google Sheets lookup is working correctly. Check that the Linkedin URL column matches exactly what the API returns. Make sure all three Google Sheets nodes point to the same sheet.

Issue: Messages not sending
Solution**: Check your ConnectSafely.ai API key is valid. Verify the HTTP Request nodes have the Bearer Auth credential attached. Check the API response for error messages.

Issue: Wrong message type sent (DM vs Connection Request)
Solution: The routing is based on connectionDegree field. Verify this field is being returned correctly from the API. Check the **Check if 1st Degree Connection node conditions.

Issue: Profile ID extraction failing
Solution: The **Extract Profile ID from URL Code node parses the LinkedIn URL. Check that visitors have valid navigationUrl values.

Issue: Google Sheets not updating
Solution**: Verify your Google Sheets credential has write access. Check that the sheet ID is correct and the sheet name matches.

Issue: Rate limit errors
Solution: Increase the wait time in the **Wait Between Messages node. Consider reducing the frequency of the schedule trigger.

Rate Limiting Best Practices

LinkedIn monitors automated activity. To stay safe:

Start slow**: Begin with 10-15 messages per day
Gradually increase**: Add 5 more per week up to 50/day max
Use random delays**: The workflow includes built-in waits
Pause if warned**: If LinkedIn shows any warnings, stop for 24-48 hours
Keep messages personal**: Avoid spammy, salesy language
Don't run 24/7**: Schedule during business hours

Costs & Considerations

| Service | Cost |
|---------|------|
| ConnectSafely.ai | Free trial available, then subscription |
| Google Sheets | Free |
| n8n | Free (self-hosted) or cloud pricing |

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

Documentation & Resources

Official Documentation
ConnectSafely.ai Docs**: https://connectsafely.ai/docs
ConnectSafely.ai API Reference**: Available in dashboard
Google Sheets API**: https://developers.google.com/sheets

Support Channels
Email Support**: [email protected]
Documentation**: https://connectsafely.ai/docs
Custom Workflows**: Contact us for custom automation

Connect With Us

Stay updated with the latest automation tips and LinkedIn strategies:

LinkedIn**: linkedin.com/company/connectsafelyai
YouTube**: youtube.com/@ConnectSafelyAI-v2x
Instagram**: instagram.com/connectsafely.ai
Facebook**: facebook.com/connectsafelyai
X (Twitter)**: x.com/AiConnectsafely
Bluesky**: connectsafelyai.bsky.social
Mastodon**: mastodon.social/@connectsafely

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:
Multi-channel engagement workflows
AI-powered personalization at scale
Lead scoring and qualification automation
CRM integration and data synchronization
Custom reporting and analytics pipelines

Nodes Used (3)

Code
n8n-nodes-base.code
Google Sheets
n8n-nodes-base.googleSheets
HTTP Request
n8n-nodes-base.httpRequest