Automatically posting new article to linkedIn

Hi All,

So, I have a new site in Modx - all finished.
Now the client has thrown a curveball!!
He wants any new blog posts to be automatically shared on LinkedIn.
It would only be posts within the blog - not ALL resources.

I’ve been searching around the web and the community, but cannot find any solutions - has anyone every done anything like this?

If not, does anyone fancy building something and I will get the client to pay?

Let me know if anyone has any ideas on this!


I came across this not so long ago: Share on LinkedIn - LinkedIn | Microsoft Docs.

By the looks of things, you should be able to use something like Guzzle to make the necessary HTTP requests. You’ll also need to authenticate your app using OAUTH (LinkedIn 3-Legged OAuth Flow - LinkedIn | Microsoft Docs). And you’ll need a developer account:

Once you get that all tied up, you should be able to create a plugin that posts to LinkedIn on the " OnDocFormSave" event: OnDocFormSave - System Events | MODX Documentation

1 Like

Assuming that your blog posts all have the same parent, your plugin code can have somethings like this at the top:

if ($resource->get('parent') != 12) {

/* Code to send notice to LinkedIn here */

I had the same challenge a while back. I created a XML resource containing all posts that needed to be published on social. Next up you connect to a service like Hootsuite, Zapier or Integromat. They will push it to wherever you want.

1 Like

Thansk Bob - it’s the code to send to linkedIn that I’m struggling with unfortunately.

This sounds interesting - I will haev a play with XML resources. So how did the XML resource update when you had a new post?

Thanks - this is way beyond what I’m capable of though I’m afraid. Unless someone wants to quote on building it for me!?

It is quite easy. The XML update automatically as long as you call it uncached. see: Connect your Rss to Linkedin integration in 2 minutes | Zapier

1 Like

This looks perfect - thank you! I’ll give it a try.