Publishing MicroBlog Entries to a separate WordPress website – Zapier Method

Post written by Hudson Atwell
On Tuesday, December 11th, 2018

Through the combination of our Feeds Component + Zapier we are able to take an RSS feed of our Twitter scheduling pattern and extend our publishing capabilities to a separate WordPress instance. 

Requirements:

Zapier Free or Zapier Premium Account

Zapier is a 3rd party data routing service that allows users to port data from one service to another. They provide limited free usage and premium usage accounts. 

TweetBoostPRO plugin

TweetBoostPRO is a powerful social media marketing automation plugin that assists WordPress users with crafting and scheduling microblogging campaigns across multiple platforms. 

Minor PHP + WordPress skills

In this article we’ll show how to send the microblog status data to a self hosted WordPress, but we’ll need to write a bit of code into the receiving WordPress site in order to catch and publish the data. Click to skip directly to the section dealing with custom code.

Step 1: Secure your publishing feed

TweetBoostPRO, through our Feeds Component, automatically creates an RSS Feed of our status updates. 

We also provide feed formats in XML and JSON, but in this method we’ll only require the RSS Feed. 

Head into WordPress Administration->TweetBoostPRO->My Feeds and find the RSS feed URL for the Twitter account we’ll use as a scheduling pattern.

Our feed looks something like this:

https://wptweetboost.wpengine.com?action=tbp-rss-generate-feed&token=not-so-secret-key-12&username=wptweetboost

Find your link that’s similar to the above and copy it to your clipboard. 

Step 2: Create a Zap

Zapier calls their automation rules “Zaps“.  We’ll want to log into our Zapier account and create a new Zap.

When inside the Zap creation screen you will be asked to define a trigger. Search for the phrase ‘RSS‘ and then select the trigger app ‘RSS by Zapier

This image shows us searching Zapier trigger apps for the RSS by Zapier app.

Next you’ll be asked to choose a trigger action. We don’t have many options here so let’s select ‘New Item in Feed‘. Press ‘Save+Continue‘. 

In this image it shows additional trigger options related to the RSS App provided by Zapier.

Next we will setup our RSS feed. Paste the RSS feed URL you copied earlier from the TweetBoostPRO Feeds Component into the input area labeled Feed URL

Besides the URL of the RSS feed, all your other setup options will already have the correct inputs. In the section What Triggers a New Feed Item, you will want to make sure Different Guid/URL is selected.

Click Continue.

This image shows the RSS setup section provided by Zapier. We'll want to paste our RSS feed URL here.

In the next step you will be asked to select a RSS sample item for testing the connection. If you have content in your feeds you will see 3 available items. Choose any one and continue. 

This image shows three sample RSS items provided by Zapier.

This image displays the contents of one of our sample RSS items returned from Zapier.

After clicking continue, Zapier prompts us that we now need to add an action:

In this image we point out that Zapier is now asking us to add an action step.

After adding a new action step, search for the ‘Webhooks by Zapier‘ action app and go ahead and select it:

In this image we're selecting Webhooks by Zapier as our action app.

Next it will ask us to select the webhook method. For our needs we’ll select the POST method and press Save+Continue. 

In this image we show that we are going to want our Zapier webhook to use the POST method.

The next step will be the most complicated of the Zap setup process. It will ask us where we want to send the data, the payload time, and it will have us setup which data parts from the RSS Feed Item we want to send in our data payload. 

Input 1: URL

In this input we are going to want to paste our destination WordPress URL. For now just add this and replace ‘mydomain’ with your WordPress site’s domain name. Also replace ‘supersecretkey’ with a secret password phrase that only you will know:

https://www.mydomain.com/?action=create-custom-status&token=supersecretkey

Input 2: Payload Type

For this input choose ‘form’

Input 3: Data

Here we we’re given the ability to create custom key value pairs. Go ahead and pick and choose which elements to include in your webhook POST request. Give each one an easy to remember key (We will use these keys later when setting up our custom PHP code). 

  • permalink -> Link
  • tags -> Raw Tags
  • status_nolink ->Raw Status No Link
  • status_full -> Title
  • featured_image -> Raw Attachment URL
  • status_pubdate -> Raw Pub Date
  • status_nohashtag_nolink -> Raw Status No Link No Hashtags
  • channel – > Add a custom value here like ‘Tweet Boost PRO’

Input 4: Wrap request in array

Set to no.

Input 5: File

Leave blank.

Input 6: Unflatten

Set to yes, but would still work if we had it set to no.

Input 7: Basic Auth

In this setup we are not leveraging Basic Authorization so leave this field blank. 

Input 8: Headers

This setup requires no additional headers to be added. Leave Blank.

Screenshots for reference:

This image shows how we've used Zapier webhooks to setup our POST data.

Now you are all done. You can press continue. 

Our Zap is nearly complete!

Next it will ask you to test your setup. But don’t test yet! We still need to head over to our remote WordPress and create our data handlers. 

Step 3: Receiving the data at our remote WordPress site. 

This part of the setup involves editing PHP code and adding it to your remote blog’s functions.php file to complete the integration.

We understand that this can part can be challenging. It will require that your remote blog have a custom post type named news and also custom taxonomies named news_tags and news_categories.  You will also have to edit the secret key to match the one you inputted into the Zapier webhook URL. 

If you need extra assistance, contact support through your account page, or head over to Codeable.io where there are agents ready to exchange their assistance for USD. 

The Code:

The Final Steps: Test and Enable Zap

The final next step is to test your Zap to make sure the connection works. 

Head back into your Zapier Zap creation page and press ‘Send Test to Webhooks By Zapier‘.

This image shows Zapier has a test ready to send. Before we send we have to setup our webhook listener on our WordPress site.

If all is well with your test then you should find you now have a new entry into your WordPress blog. 

This image depicts microblog entries that made it from Zapier into our WordPRess CPT

In this image we're showing how the CPT entries are displayed on the frontend of our remote WordPress Blog

Go ahead and give your new Zap a name, and turn it on.

And you are all set up!

Way to hang end there! Congratulations!

Hudson Atwell

Hudson Atwell has 10 years experience in WordPress product development and is a founding member of TweetBoostPRO, as well as the Inbound PRO plugin suite. You can check out his work on out on GitHub, and Codeable.io, and Twitter