You might have noticed that I recently updated Idea factory.

For those who never visited this section of the website, Idea factory is a space where I am saving all the links / articles / medias that I found interesting.

On the technical side, Idea factory relies on WordPress, the super popular content management system. One big constraint with this CMS though, is the time to publish!
Consider this. To create an article I will have to:

  1.  Connect to WordPress
  2. Press « Add new article »
  3. Find a cover picture on the web
  4. Upload the cover picture
  5. Write the article
  6. Then finally click publish

End-to-end, the whole process can easily takes me more than 10 minutes!

So, I asked myself, how can I make this fits in less than 1 minute?

Challenge accepted

(Spoiler Zapier was the answer)

Zap what?

To present it briefly, Zapier is a platform as a service which gives you the ability to automate different tasks by connecting multiple services together.

For example: If I am sending a tweet with a specific hashtag (the trigger), then Zapier will post a new status for me on Facebook (first action) and also save the associated media on my Google drive (second action).

It’s worth mentioning that in Zapier, you can combined an unlimited amount of steps (not like IFTTT for instance ), write you own code or even push notifications directly from your browser using a dedicated Google Chrome extension!

If this do that and that and that and that and …

Let’s now come back to our initial problem and look at the general solution I put in place.

Step 1

Zapier trigger

As I explained earlier, if you install the Zapier Google Chrome extension you are given the ability to run a specific task on any webpage.

On the background, this is what happens the Chrome extension button is clicked:

  • Zapier will start the task.
  • Pass the page title I am on,
  • Pass the page URL,
  • Pass an optional text argument.

Zapier chrome extension


Step 2

custom code

This second step is a little bit more complex as it uses a custom code section.

Step 2

If you are not « Javascript fluent », let’s simplify and say that the function above checks whether or not the user sent a text input in step 1.

If the code is finding a text occurence, it returns it, otherwise it uses the page title.


Step 3

step 3

For this third step, I am using an external service: Apify.

This platform provides the ability to create web crawlers on the fly which are going to scrap the whole content of a given page.
As an input I am feeding my crawler with the URL retrieved in step 1. And on the Apify side, this code is executed on the page where the crawler runs:

See the Pen RMwaqB by Adrien Rahier (@FracArt) on CodePen.0

At first glance, this seems like a complicated piece of code. However, if you look closer the only thing I am doing here is getting the cover image of the webpage and the page description.


STEP 4

Step 4

The previous operation is going to take a couple of seconds to run. So, just to make sure that the process is now over, I am delaying the rest of the execution for 1 minute.


STEP 5

Step 5

Apify should now be done. Time to get back the results.


STEP 6

Step 6

Let’s now create an article using the WordPress API.

As a title I am passing the result of step 2. For the content and excerpt I am giving the results of the crawler (step 5).

Title

Wordpress content


Step 7

 Step 7

Finally, just to confirm that everything went fine I am pushing to myself a Slack notification with the link to the article.

Conclusion

We have seen in this article how I used Zapier to avoid the long and repetitive task of creating WordPress articles again and again.

If you have any questions regarding this workflow I am more than happy to share additional details.

Also, if you have other ideas of tasks that could be automated, feel free to leave a comment.