Beyond Coding: API Synchronization with WordPress
In the evolving digital landscape, integrating APIs has become a common, yet technically challenging requirement. We recently had an opportunity to help a client who planned to launch a crowdfunding campaign on Tiltify and needed to display campaign-related data on their WordPress website. This would typically require a complex API integration – a task outside of their in-house capabilities. However, we offered a less costly and more efficient solution through Convoworks, our no-code platform.
In this case study, we’ll walk through the process of setting up API synchronization using Convoworks, demonstrating its power, simplicity, and efficiency. To aid in understanding, we’ll also provide two Convoworks service definitions that you can import into your own Convoworks installation for trial purposes.
Check out how to test your import using a Tiltify dummy API in this blog post Create Your Dummy API with Convoworks to Streamline Development
The Challenge
Tiltify’s V5 API, while well-documented and defined through the OpenAPI Specification, presents a certain degree of technical complexity, especially in the domain of OAuth2 Application level authentication. Additionally, our client’s requirement was to import data from several API endpoints into distinct custom post types. Processes like that are requiring monitoring and control mechanisms, like start/stop, and we decided to implement it through a chat interface.
The Convoworks Solution
We divided our solution into two discrete services: the Tiltify Scheduler and the Tiltify Importer. The Scheduler, a lightweight service, was designed to handle ‘init’ action hooks. The Tiltify Importer, the heavyweight of the two, managed the actual data import and is loaded and executed only through the wp-cron calls.
While the principle remains the same as in our real-world case, the services provided below have been simplified to serve the purposes of this article. As such, only two endpoints are covered in this demonstration.
Tiltify Importer (JSON) Tiltify Scheduler (JSON)
Installation/Configuration:
Firstly, download the two service definitions attached to this post and import them into your Convoworks. Navigate to create a new service, name it, and select the appropriate file to upload.
Importer service has to be configured to use Tiltify API. How to create Tiltify application (and their access keys) you can check here. Once the Tiltify application is set up, navigate to the Variables view to enter your API keys and credentials.
Both Convoworks services will need to enable the WordPress Hooks configuration (simply enable, no additional config required).
OAuth Process:
We saved the current auth token as a WordPress option ’tiltify_auth_token’. We implemented logic to check the validity of this saved auth token, fetch a new one if required, and save it for future use.
Synchronization of ‘Schedules’ endpoint:
Data from the API endpoint was fetched and updated for each item through a reusable fragment. In our example, we trimmed the ‘Top Donors’ post type by removing items not present in the latest API response.
Updating Custom Post Type:
This fragment accepts several variables (req_post_type, req_item, etc.) which it uses to fetch an existing item (by ‘req_key’ meta field) and either insert or update the post based on the result.
Operational Insights:
By default, synchronization occurs as a scheduled task every hour (defined in Tiltify Scheduler service). However, during development, you may want on-demand testing. Therefore, we implemented a simple chat mechanism to handle commands like ‘enable’, ‘disable’, ‘test’, ‘sync’, and ‘reset’ to offer complete control over the synchronization process.
Results and Benefits
Through Convoworks, we were able to deliver a seamless solution quickly, eliminating the need for traditional coding. Everything was configurable and customizable, demonstrating the power and flexibility of Convoworks.
Wrapping Up
API integration, often considered an advanced technique, can intimidate even seasoned coders. However, with Convoworks, we’ve shown that such tasks can be accomplished by a more general public, like webmasters and page builder users. This case study epitomizes the possibilities Convoworks offers, making technically daunting tasks manageable and cost-effective, without the need for coding expertise. Your path to power and flexibility in web development is here.
Related posts
A Dead Simple RAG Setup for WordPress: AI Chatbots for Small Websites
Discover how to set up a dead-simple RAG-based AI chatbot on your small WordPress website. With Convoworks, you can easily enable a chatbot that retrieves information directly from your pages, enhancing user experience with minimal setup. Perfect for small sites looking to leverage GPT-powered chat functionality in minutes!
VIEW FULL POSTHow to Modify Your robots.txt to Prevent GPTBot from Crawling Your Site with Convoworks
Introduction Ensuring that your website’s content is accessed on your terms is essential. With an increasing number of web…
VIEW FULL POST