Resources
What's in this guide
This agent is a little different because it can't stand on its own, but we need it to be able to process all the comments across multiple pages on a LinkedIn post.
👉 Here's why: LinkedIn limits the comments you can pull for any LinkedIn post to 50 comments (one page) at a time. If you are automating comment logging and replying, and you are lucky enough to get more than 50 comments on a post, you need to run any agent that processes comments multiple times, once for each page of 50 comments.
But how many batches of 50 comments does the agent need to process? This workflow does the math for you to count the number of batches. Then, it automatically calls the lead logging workflow once for each page of comments:
Every Monday
Get all your posts from the last week
For each post, find how many pages of comments it has
Tell the lead logging agent to run on every page of found comments
Here's how you build it.
1. Import the LinkedIn Comment Manager template
Get started by importing the AI agent template LinkedIn Comment Manager.

2. Also import the LinkedIn Lead Logger template
The Comment Manager agent calls the Lead Logger agent, so let's have that agent ready as well for us to link to in the last step: LinkedIn Lead Logger
We'll set it up in detail in the next setup guide.

3. Review the scheduled trigger (step #1)
This agent runs automatically every Monday.

4. Add your profile URL to the Get posts step (step #2)
This step finds all posts made in the last week. Update the profile URL to point to your own LinkedIn profile.

5. Review the loop (step #3)
Next, we need a loop to take action on every post found. This step is already set up.

6. Review the custom code step (step #4)
This custom code step is already set up for you. As an input, it takes the number of comments on a post. As output, it gives you a list of the numbers, one page number for each page of comments. We need this to be able to tell the Lead Logger agent which page of comments to process.


7. Review the nested loop (step #5)
Next, we need to take action for every resulting page of comments. This is set up as a loop:

8. Set the Trigger manual workflow step to point to your Lead Logger agent (step #6)
The last step in this agent calls your lead logging flow. Because this step is inside a loop, the Lead Logger agent will be called once per page of comments on every post. To set this up:
Choose the LinkedIn Lead Logger (the agent you imported from the template above) as the workflow to call
Set the postURL input to be the post's Activity URL
Set the pageNumber input to be the number from the custom code step
This agent generates the Activity URL and the page number to process. These outputs become the inputs for the Lead Logger agent to direct it which post to process, and which page of comments.

Build the second half of this process in the Lead Logger agent setup guide
Let's jump to the Lead Logger agent to set that up. We'll test the Comment Manager and Lead Logger together.