Musings of a software engineer, dad, and geek at heart.

Automation eliminates excuses. Here's how I used Pipedream to send my blog posts to LinkedIn

Sometimes the best way to stop procrastinating is to remove the excuses.

As a few folks know, I've been slow to post on LinkedIn. With my last essays I tried using Typeshare for the cross-platform posting. Unfortunately it created enough friction (manually editing the posts to get formatting right? No thanks) to fuel my procrastination.

Today I eliminated that excuse.

Since I've been cross-posting each atomic essay over to my blog*, I have a lovely RSS feed to use as a trigger for automations. Here's how I turned an RSS feed into nicely formatted LinkedIn posts and eliminated my excuses.

The magic is in the Pipedream.

Think IFTTT, but with code to do the dirty work. I've barely touched it in the past, but thanks to good docs I was up and running in <20 minutes, reading included.

Essentially you just need to create a workflow with 3 steps:

1. Trigger – New Item In Feed

Add a trigger with the RSS New Item in Feed component and an RSS source pointed at your blog's feed URL.

2. Code – The Magic

For the entries received from my blog, there will be a Title and an encoded content block with HTML. We want to turn that content block into an automatically formatted text (line breaks, UPCASING for headers, etc), prefix it with the title, then send that to LinkedIn.

Pipedream sets itself apart with the ability to write Nodejs, with modules, as a step. Add a step of Node –> Run Node Code.

Grabbing the html-to-text package and a little bit of cleanup (my blog always includes an email signup form after the last <hr/> that I want removed for LinkedIn) this was trivial. Full code of the step:

import { convert }  from 'html-to-text';

export default defineComponent({
  async run({ steps, $ }) {
    const title = steps.trigger.event.title;
    const body = steps.trigger.event["content:encoded"]["#"]
    const html = body.slice(0, body.lastIndexOf("<hr/>"));

    const content = convert(html, {wordwrap: false});
    $.export("content", title + "\n\n" + content);
  },
})

3. Action – Post to LinkedIn

Posting to LinkedIn is a prebuilt action in Pipedream.

Simply add the Post to LinkedIn step, configured for type Text (not Article), Public Visibility, and Text set to {{steps.code.content}}. Voila, automatic posting, with nice formatting.

As easy as this was, I think I need to explore more use cases with Pipedream. If you use it, or something else, I'd love to hear what excuses you eliminate through automation.

This was the Day 17 #ship30for30 #atomicEssay.


Thanks for reading. If you enjoyed the article subscribe via RSS feed or enter your email in the box below 👇