In this simple tutorial, we'll demonstrate how to integrate WordPress with Airtable using an Airtable extension called Data Fetcher. We'll use Data Fetcher to import WordPress blog posts into Airtable with no-code. We'll also schedule this to happen automatically.
Add Data Fetcher to a new Airtable base via the Airtable marketplace. Sign up for a Data Fetcher account by entering a password and clicking 'Sign up for free'. Alternatively, you can use your Google login to create a new account. If you already have a Data Fetcher account use the 'Have an account?' text in the bottom left of the screen to log in.
Data Fetcher is a powerful Airtable extension that can be used to import different types of data from APIs or websites into Airtable.
Creating requests in Data Fetcher enables you to import data into your Airtable base. To begin, click 'Create your first request' on the home screen of the Data Fetcher extension.
For Application, select 'Custom' to set up the WordPress Airtable integration.
Next, enter the URL of the WordPress post you would like to import data from using this format: https://
your-site.com
/wp-json/wp/v2/categories?context=embed
(where your-site.com
is replaced by the URL of your post.)
Or for this example, you can use this URL: https://techcrunch.com/wp-json/wp/v2/posts?context=embed
By adding ?context=embed
to the end of the URL, it means we get an overview of the article rather than all the text from the page.
Our WordPress posts response will be split into separate 'pages'. This is called pagination. If you want to add pagination to your WordPress request and import all the pages, you can do this by scrolling down and opening the Advanced settings in Data Fetcher.
Scroll to Pagination and select 'Page' as well as the following options:
You can give your request a name, such as 'Import WordPress Data' and click 'Save & Run'.
The Data Fetcher request will run, and the Response field mapping modal will open. This is where we select which fields of data will be imported from WordPress to Airtable and how they will map to our output table.
Select 'Filter all' to clear all the pre-selected fields, and use the Find field search bar to locate and select the following fields: 'Date', 'Slug', 'Link' and 'Title rendered'.
These will all map to new fields in our Airtable base.
Click 'Save & Run'.
You'll now see that new fields have been created in Airtable and populated with our WordPress data.
You can also import different types of data from WordPress into Airtable using other endpoints and query strings.
For example, to import categories:
https://your-site.com/wp-json/wp/v2/categories
Comments:
https://your-site.com/wp-json/wp/v2/comments
Or pages:
https://your-site.com/wp-json/wp/v2/pages
You can find a full list of WordPress endpoints in the WordPress REST API reference.
For this example, we are not using authentication, which means we can only access public WordPress API endpoints. If we want to access a private endpoint, which requires login details, for example, draft WordPress posts, we can install a plugin like WordPress REST API Authentication.
This will give us an API key that we can add to our request as a bearer token.
Currently, you'd need to manually run the request each time you want to import any new data from your WordPress post. It is however possible to automatically run the WordPress Airtable integration on a chosen schedule using Data Fetcher's paid scheduling feature.
To upgrade your account, In Data Fetcher, scroll to Schedule and click 'Upgrade'.
Choose a plan from the different options depending on your needs and enter your payment details.
In Data Fetcher, click 'I've done this'.
Under Schedule click '+ Authorize'.
A window will open where you'll be prompted to authorize the Airtable bases you want Data Fetcher to have access to.
We recommended selecting 'All current and future bases in all current and future workspaces' to avoid needing to unauthorize bases in the future.
Click 'Grant access'.
In Data Fetcher, you'll see Schedule this request is now toggled to on.
Select a schedule for the WordPress Airtable integration to run. You can choose intervals of 'Minutes', 'Hours', 'Days' or 'Months', then click 'Save'.
Now, if changes are made to the WordPress post this will be imported into Airtable automatically on your chosen schedule.
Oct 7, 2024
•Zayyad Muhammad Sani
•Custom RequestsData FetcherSep 20, 2024
•Zayyad Muhammad Sani
•Custom RequestsSep 5, 2024
•Zayyad Muhammad Sani
•Anthropic