🔓 Unlock all 10,000+ workflows & prompts free Join Newsletter →
✅ Full access unlocked — explore all 10,000 AI workflow and prompt templates Browse Templates →
Home n8n Workflow
January 22, 2026

LinkedIn + ConnectSafely.ai, DMs sent to commenters

Lisa Granqvist Partner Workflow Automation Expert

“Comment link and I’ll send it over.” Then your post does well. Now you are stuck scrolling, checking who asked, copying the same DM, and hoping you don’t miss anyone (or message the same person twice).

This is the kind of LinkedIn DM automation that helps creators keep momentum, but it’s also a lifesaver for coaches and marketers running lead magnets. You deliver the resource fast, keep your follow-ups consistent, and stop losing leads in the comments.

Below is the exact n8n workflow that watches a post for a keyword, checks connection status, and sends a safe, paced DM through ConnectSafely.ai. You’ll see how it works, what you need, and where teams usually trip up.

How This Automation Works

The full n8n workflow, from trigger to final output:

n8n Workflow Template: LinkedIn + ConnectSafely.ai, DMs sent to commenters

The Problem: “Comment for link” turns into inbox chaos

On paper, “comment X and I’ll DM you” is simple. In real life, it’s a mess once comments stack up. You have to open the post, scan for the keyword, click each profile, check if they’re a 1st-degree connection, then send a message that doesn’t feel copy-pasted. Do that for 30 people and you’ve burned a chunk of your afternoon. Do it for a post that goes semi-viral and you will either give up, reply late, or make sloppy mistakes that cost trust (and leads).

It adds up fast. Here’s where the friction usually hits.

  • You end up doing the same “deliver the link” DM dozens of times per post, which quietly steals about 1–2 hours when engagement is high.
  • People who comment early get the resource, and everyone else waits, which makes you look inconsistent even if your content is solid.
  • You can’t DM non-connections, so you waste time clicking around just to discover you’re blocked from messaging them.
  • When you rerun the process later, duplicates happen, and frankly that’s the fastest way to feel spammy without meaning to.

The Solution: Keyword-triggered DMs sent safely via ConnectSafely.ai

This workflow turns your LinkedIn comments into an automated fulfillment pipeline. You submit three inputs in a simple form: your post URL, the trigger keyword (like “link” or “template”), and the resource URL you want to send. n8n then pulls every comment on that post using the ConnectSafely.ai API, loops through them one by one, and checks if the keyword appears (case-insensitive). If it matches, the workflow verifies the commenter is a 1st-degree connection, because that’s required for DMs. Then it sends a personalized message that includes their name and your link. Finally, it waits a randomized delay between sends to reduce the risk of LinkedIn flagging your account, and continues until it finishes the comment list.

The workflow starts with your form submission. It fetches and splits comments into individual items, checks keyword match, checks connection eligibility, then sends the DM and waits about 15–30 minutes before the next send. Slow on purpose. Safer, too.

What You Get: Automation vs. Results

Example: What This Looks Like

Say a post gets 60 comments, and 30 people type your keyword (“link”). Manually, even a quick routine is maybe 2 minutes per person to find them, confirm you can DM, paste the message, and send. That’s about an hour, and it’s boring work. With this workflow, you spend about 5 minutes filling the form once. Then it runs in the background and sends DMs with safe delays (so it can take several hours), but your hands-on time is basically done.

What You’ll Need

  • n8n instance (try n8n Cloud free)
  • Self-hosting option if you prefer (Hostinger works well)
  • ConnectSafely.ai for LinkedIn comments, connection checks, and DMs
  • LinkedIn account connected inside ConnectSafely.ai
  • ConnectSafely.ai API key (get it from Settings → API Keys)

Skill level: Beginner. You’ll mostly paste credentials, pick nodes, and test with a real post.

Don’t want to set this up yourself? Talk to an automation expert (free 15-minute consultation).

How It Works

You submit the post details. The workflow begins when you fill out the n8n form with the LinkedIn post URL, your trigger keyword, the content link to deliver, and your name for the signature.

Comments are fetched and cleaned up. n8n calls the ConnectSafely.ai LinkedIn endpoint to retrieve comments, then splits them into individual comment items so each one can be evaluated on its own.

Matching and eligibility checks happen before any DM goes out. A keyword check (case-insensitive) filters to only the people who actually asked. Then a second check verifies the commenter is a 1st-degree connection, since LinkedIn DMs don’t reliably work otherwise.

DMs are sent, then paced out. When someone qualifies, the workflow sends a personalized DM with the promised link, waits a randomized delay for account safety, and loops to the next comment until it reaches the end.

You can easily modify the keyword logic to support multiple trigger words, or adjust the wait time to be more conservative. See the full implementation guide below for customization options.

Step-by-Step Implementation Guide

Step 1: Configure the Form Trigger

Set up the input form that captures the LinkedIn post URL, keyword, and link to send before the workflow begins processing comments.

  1. Add and configure 1️⃣ Capture Post Inputs as the trigger.
  2. Set the Form Title to 🤖 LinkedIn Keyword Auto-Responder.
  3. Confirm the form fields exist with labels: LinkedIn Post URL, Trigger Keyword, Content Link to Send, and Your Name (for signature) (all required).
  4. Keep the Form Description content as provided to guide users through the submission.
The Flowpast Branding sticky note is informational only and does not affect execution—feel free to keep it for documentation.

Step 2: Connect LinkedIn and Load Comments

Retrieve comments from the specified LinkedIn post and prepare them for batch processing.

  1. Open 2️⃣ Retrieve Post Comments and set Post URL to ={{ $json['LinkedIn Post URL'] }}.
  2. Set Account ID to your LinkedIn account identifier (replace [YOUR_ID]).
  3. Credential Required: Connect your ConnectSafely LinkedIn credentials in 2️⃣ Retrieve Post Comments.
  4. In 3️⃣ Separate Comment Items, set Field to Split Out to comments.
  5. Keep 4️⃣ Iterate Through Comments as the batch controller to loop through each comment item.
⚠️ Common Pitfall: If [YOUR_ID] is not replaced in 2️⃣ Retrieve Post Comments, the API call will fail.

Step 3: Set Up Keyword Matching and Routing

Evaluate each comment for the trigger keyword and verify if the commenter is a first-degree connection before sending a DM.

  1. In 5️⃣ Evaluate Keyword Match, keep the provided JavaScript logic for case-insensitive matching.
  2. Verify that 6️⃣ Keyword Match Check uses the condition Left Value ={{ $json.isKeywordMatch }} with the boolean operator set to true.
  3. Configure 7️⃣ Verify Connection Status with Profile ID set to ={{ $('4️⃣ Iterate Through Comments').item.json.publicIdentifier }} and replace [YOUR_ID] in Account ID.
  4. Credential Required: Connect your ConnectSafely LinkedIn credentials in 7️⃣ Verify Connection Status.
  5. In 8️⃣ Connection Approved?, confirm the condition Left Value is ={{ $json.connected }} with the boolean operator set to true.
  6. Route non-matching or unapproved connections to ⏭️ Skip Non-qualifiers, which loops back to 4️⃣ Iterate Through Comments.
You can customize the keyword logic inside 5️⃣ Evaluate Keyword Match to support multiple keywords or regex patterns.

Step 4: Configure DM Dispatch and Rate Control

Send the personalized DM to qualified commenters and add a randomized delay to avoid rate limits.

  1. Open 9️⃣ Dispatch DM with Link and set Message to =Hey {{ $('4️⃣ Iterate Through Comments').item.json.authorName }}! 👋 Thanks for your comment on my post! As promised, here's the link you requested: 👉 {{ $('1️⃣ Capture Post Inputs').item.json['Content Link to Send'] }} If you have any questions or want more resources like this, just let me know! Best, {{ $('1️⃣ Capture Post Inputs').item.json['Your Name (for signature)'] }}.
  2. Set Recipient Profile ID to ={{ $('4️⃣ Iterate Through Comments').item.json.publicIdentifier }} and replace [YOUR_ID] in Account ID.
  3. Credential Required: Connect your ConnectSafely LinkedIn credentials in 9️⃣ Dispatch DM with Link.
  4. In 🔟 Delay for Rate Control, set Amount to ={{ Math.floor(Math.random() * (1800 - 900 + 1)) + 900 }} to pause 15–30 minutes between messages.
  5. Confirm the loop: 9️⃣ Dispatch DM with Link🔟 Delay for Rate Control4️⃣ Iterate Through Comments, and the final completion node ✅ Comments Processing Done.
⚠️ Common Pitfall: Skipping the delay in 🔟 Delay for Rate Control can trigger LinkedIn rate limits.

Step 5: Test and Activate Your Workflow

Validate the workflow end-to-end using a real LinkedIn post and keyword before turning it on for production use.

  1. Click Execute Workflow and submit the form in 1️⃣ Capture Post Inputs with a valid post URL and keyword.
  2. Confirm that 2️⃣ Retrieve Post Comments returns comment data and 3️⃣ Separate Comment Items splits them correctly.
  3. Verify a matching comment routes through 6️⃣ Keyword Match Check7️⃣ Verify Connection Status8️⃣ Connection Approved? and triggers 9️⃣ Dispatch DM with Link.
  4. Check that non-matching comments route through ⏭️ Skip Non-qualifiers and still allow the batch loop to continue.
  5. Once successful, toggle the workflow to Active to run in production.
🔒

Unlock Full Step-by-Step Guide

Get the complete implementation guide + downloadable template

Common Gotchas

  • ConnectSafely.ai credentials can expire or lose permissions. If things break, check your ConnectSafely.ai dashboard connection status (it should show LinkedIn as connected) before editing anything in n8n.
  • If you’re using Wait nodes or external processing, timing is not guaranteed. This workflow intentionally waits about 15–30 minutes between DMs, so increase the delay if downstream nodes fail or LinkedIn starts throwing “cannot send message” errors.
  • Default message templates are polite but generic. Add your brand voice in the “Dispatch DM with Link” step, or you’ll end up rewriting messages manually anyway.

Frequently Asked Questions

How long does it take to set up this LinkedIn DM automation automation?

About 30 minutes if your ConnectSafely.ai account is already connected to LinkedIn.

Do I need coding skills to automate LinkedIn DM automation?

No coding is required for the basic setup. You’ll mainly paste your API key, choose the right credentials in the ConnectSafely nodes, and run a test submission.

Is n8n free to use for this LinkedIn DM automation workflow?

Yes. n8n has a free self-hosted option and a free trial on n8n Cloud. Cloud plans start at $20/month for higher volume. You’ll also need to factor in ConnectSafely.ai costs based on your plan.

Where can I host n8n to run this automation?

Two options: n8n Cloud (managed, easiest setup) or self-hosting on a VPS. For self-hosting, Hostinger VPS is affordable and handles n8n well. Self-hosting gives you unlimited executions but requires basic server management.

Can I customize this LinkedIn DM automation workflow for multiple keywords?

Yes, and it’s one of the best tweaks to make. In the “Evaluate Keyword Match” code step, you can switch from a single keyword to a simple list (for example: “code”, “template”, “link”). You can also tighten matching so “link” doesn’t match unrelated words, which helps when comments get noisy.

Why is my ConnectSafely.ai connection failing in this workflow?

Usually it’s an expired API key or your LinkedIn session inside ConnectSafely.ai is no longer connected. Regenerate the API key (Settings → API Keys), update the credential in n8n, and confirm your LinkedIn status shows as connected in the ConnectSafely.ai dashboard. If the post is private or the URL is incomplete, comment retrieval can fail too. Also worth checking: some commenters can’t be messaged even if they’re connected, because their messaging settings are restricted.

How many comments can this LinkedIn DM automation automation handle?

A lot, but it will take time because of the built-in 15–30 minute delay between messages. Practically, many accounts stick to about 30–50 DMs per day for safety, and higher-volume accounts often spread sends across multiple days for the same post.

Is this LinkedIn DM automation automation better than using Zapier or Make?

Often, yes, because this workflow depends on looping through many comments, adding logic checks, and pacing sends safely. Zapier/Make can handle simple triggers, but they get awkward (and expensive) when you need batching, conditional routing, and waits between items. n8n also gives you the self-hosting option, which matters once you’re processing lots of engagement. If you want help deciding based on your volume and risk tolerance, Talk to an automation expert.

Once this is live, your posts can take off without creating a DM backlog you dread. Set it up once, then let the workflow handle delivery while you stay focused on the next piece of content.

Need Help Setting This Up?

Our automation experts can build and customize this workflow for your specific needs. Free 15-minute consultation—no commitment required.

Lisa Granqvist

Workflow Automation Expert

Expert in workflow automation and no-code tools.

×

Use template

Get instant access to this n8n workflow Json file

💬
Get a free quote today!
Get a free quote today!

Tell us what you need and we'll get back to you within one working day.

Get a free quote today!
Get a free quote today!

Tell us what you need and we'll get back to you within one working day.

Launch login modal Launch register modal