Auto-Send DMs to LinkedIn Keyword Commenters with ConnectSafely.AI

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

Description

Auto-Send DMs to LinkedIn Commenters Who Type a Specific Keyword using ConnectSafely.AI API

Who's it for

This workflow is built for content creators, coaches, course sellers, and marketers who use the "comment X to get the link" engagement strategy on LinkedIn. Perfect for anyone who wants to deliver lead magnets, code samples, templates, or resources automatically without spending hours manually DMing every commenter.

If you're tired of the manual grind—reading comments, checking connections, copy-pasting messages—this automation handles the entire fulfillment process while you focus on creating more content. Works especially well for viral posts where comment volume makes manual responses impossible.

How it works

The workflow monitors your LinkedIn post for specific keyword triggers and automatically sends personalized DMs to commenters who request your content.

The process flow:
You submit your post URL, trigger keyword, and resource link via a simple form
Fetches all comments from the specified LinkedIn post via ConnectSafely.ai API
Loops through each comment individually for processing
Detects if the comment contains your trigger keyword (case-insensitive)
Checks if the commenter is a 1st-degree connection (required for DMs)
Sends a personalized direct message with their name and your resource link
Applies random rate limiting (15-30 minutes) between messages for account safety
Continues until all matching comments are processed

The rate limiting and connection checks are built-in to protect your LinkedIn account from automation detection.

Setup steps

Step 1: Get Your ConnectSafely.ai API Key

Obtain API Key

Sign up at ConnectSafely.ai
Log into your dashboard
Navigate to Settings → API Keys
Generate a new API key and copy it

Add Credential in n8n

Go to Credentials in n8n
Click Add Credential → Search for ConnectSafely API
Paste your API key
Save the credential

This credential is used by all ConnectSafely nodes in the workflow.

Step 2: Connect Your LinkedIn Account

In your ConnectSafely.ai dashboard, click Connect LinkedIn
Follow the authorization flow
Ensure your account shows as "Connected" with a green status
Your LinkedIn is now accessible via the API

Step 3: Import and Configure the Workflow

Download the workflow JSON file
In n8n, go to Workflows → Import from File
Select the downloaded JSON
Open each ConnectSafely node and select your credential from the dropdown

Step 4: Test the Workflow

Click the Test Workflow button in n8n
Copy the form URL that appears in the Form Trigger node
Open the URL in a new browser tab
Fill in the form:
LinkedIn Post URL: Full URL of your post with comments
Trigger Keyword: The word commenters type (e.g., "code", "link", "example")
Content Link: The URL you want to send them
Your Name: For the message signature
Submit and watch the execution

Pro Tip: Test with your own post first where you've left a test comment containing the keyword.

Step 5: Activate for Production

Review the test execution to ensure messages sent correctly
Toggle the workflow to Active
Use the form URL whenever you post new "comment for link" content
The workflow processes comments and sends DMs automatically

Customization

Message Template

Edit the Send DM with Link node to customize your message:

Hey {{name}}! 👋

Thanks for your comment on my post!

As promised, here's the link you requested:
👉 {{link}}

If you have any questions or want more resources like this, just let me know!

Best,
{{your_name}}

Variables available:
{{ $('Loop: Process Each Comment').item.json.authorName }} - Commenter's name
{{ $('Form: Enter Post Details').item.json['Content Link to Send'] }} - Your resource link
{{ $('Form: Enter Post Details').item.json['Your Name (for signature)'] }} - Your name

Multiple Keywords

Edit the Detect Keyword Match code node to check for multiple trigger words:

// Multiple keyword detection
const keywords = ['code', 'example', 'template', 'link', 'send'];
const commentLower = commentText.toLowerCase();

const isMatch = keywords.some(keyword =>
commentLower.includes(keyword.toLowerCase())
);

return [{ json: { isKeywordMatch: isMatch, commentText } }];

Rate Limiting Adjustment

Edit the Wait: Rate Limiting node to change delays:

| Risk Level | Wait Time | Formula |
|------------|-----------|---------|
| 🟢 Safest | 30-60 min | Math.floor(Math.random() * (3600 - 1800 + 1)) + 1800 |
| 🟡 Moderate (Default) | 15-30 min | Math.floor(Math.random() * (1800 - 900 + 1)) + 900 |
| 🔴 Faster (Risky) | 5-15 min | Math.floor(Math.random() * (900 - 300 + 1)) + 300 |

Warning: Shorter delays increase the risk of LinkedIn flagging your account.

Add Connection Requests (Optional)

To also send connection requests to non-connected commenters:

Add a ConnectSafely LinkedIn node after the "If: Connected?" FALSE path
Set operation to sendConnectionRequest
Map the publicIdentifier from the loop
Add a personalized connection message

Use Cases

Lead Magnet Distribution**: Automatically deliver PDFs, guides, or checklists to everyone who comments
Code Sample Sharing**: Share GitHub repos, code snippets, or template files to developers who request them
Course Previews**: Send free lesson links or course previews to interested commenters
Template Giveaways**: Distribute Notion templates, spreadsheets, or design files
Webinar Registrations**: Send signup links to commenters interested in your events
Community Building**: Deliver exclusive Discord/Slack invite links to engaged followers
Podcast Promotion**: Share episode links or show notes with interested listeners
Newsletter Growth**: Send subscription links with a teaser of your best content

Troubleshooting

Common Issues & Solutions

Issue: No comments returned from post
Solution**: Verify the post URL is correct and complete (should include the full linkedin.com/posts/... URL)
Solution**: Ensure the post is public or you're the post author
Solution**: Check that the post actually has comments

Issue: "Cannot send message" errors
Solution**: You can only DM 1st-degree connections on LinkedIn; non-connections are automatically skipped
Solution**: The commenter may have messaging disabled in their settings

Issue: Messages not being sent
Solution**: Verify your ConnectSafely.ai credentials are valid and connected
Solution**: Check that your LinkedIn account is properly connected in ConnectSafely dashboard
Solution**: Review the execution log for specific error messages

Issue: Keyword not matching comments
Solution**: Keywords are case-insensitive, but check spelling
Solution**: Ensure the keyword appears exactly in the comment (partial matches work)
Solution**: Test with a simple, unique keyword first

Issue: Workflow seems slow
Solution**: This is intentional! The 15-30 minute delays between messages protect your account
Solution**: Large batches (50+ comments) will take several hours to complete safely

Issue: LinkedIn account warnings
Solution**: Stop the workflow immediately
Solution**: Wait 24-48 hours before resuming
Solution**: Increase rate limiting delays when you restart
Solution**: Reduce daily volume

Issue: Duplicate messages sent
Solution**: Don't run the workflow multiple times on the same post
Solution**: Consider adding a Google Sheets node to track processed commenters

Safety Best Practices

LinkedIn Account Protection

| Do ✅ | Don't ❌ |
|-------|---------|
| Use random delays (built-in) | Send messages without delays |
| Process 20-30 comments per batch | Process 100+ comments at once |
| Run during business hours | Run 24/7 continuously |
| Stop if you see warnings | Ignore LinkedIn restrictions |
| Keep messages helpful | Send salesy/spammy content |
| Respond to genuine requests | Use for cold outreach |

Daily Limits (Approximate)

| Account Type | Recommended Max DMs/Day |
|--------------|------------------------|
| Free Account | 30-50 |
| Premium | 50-80 |
| Sales Navigator | 80-100 |

These are conservative estimates. LinkedIn doesn't publish exact limits.

Documentation & Resources

Official Documentation
ConnectSafely.ai Docs**: https://connectsafely.ai/docs
API Reference**: Available in ConnectSafely.ai dashboard
n8n Form Trigger**: https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.formtrigger/
n8n Code Node**: https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.code/

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, LinkedIn strategies, and platform updates:

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 (1)

Code
n8n-nodes-base.code