Skip to content

How to post to Pinterest with node.js

For another site I needed a way to automatically post to a Pinterest board. It’s a WordPress site, but I didn’t want the posting to be based on when a post went live. I needed a way to automatically post whatever the newest post was that hasn’t already been posted. I’ve already done something similar with Facebook, Twitter, and Tumblr; but since there isn’t a public API for Pinterest yet it wasn’t quite as easy.

What I found was a node.js library called pin-it-node that lets you post to Pinterest. Once that was loaded it was a pretty easy jump to write the following little script to take a couple of command line options and post to Pinterest.

So, I added an action to WP cron that fires every day around the same time that finds a post and then calls this script with the right command line options. At least for now, it’s working without a hitch.

If you’re running from the command line, it’ll look something like this.

$ node pin-it.js "Pin Title" "This is a description for the pin" "http://example/image.jpg"

If you’re interested, the board that’s getting filled is here. Each day there are two fonts – one recent and one random – pulled from DailyFont.com and added to the board. And I also put up a quick page to figure out the numeric board ID which you’ll need for this.

Published inComputers & Internet

2 Comments

  1. Denis Denis

    Hey
    What’ limits for posting on pinterest?
    Do you still pin only once a day? Or there are some ways to handle these limits?

    • Not sure what the limits are, or what happens if you hit that limit. I’ve never done more than a handful of posts a day, and usually separated by at least a few hours.

      That said, I don’t use this anymore. I’ve switched to a PHP library that interacts with the Pinterest API directly. At the time of this post there wasn’t a public API and I think the node library this used does its thing by directly logging in to Pinterest.

Leave a Reply

Your email address will not be published. Required fields are marked *