Experimenting With GPT, WordPress, and Convoworks to Filter Spam
Discover how to use Convoworks, a no-code WordPress plugin, to build a GPT based spam filter for your website.
Hello everyone, as the founder and developer of Convoworks, I am excited to share with you one of our newest packages, GPT. This exciting new technology utilizes state-of-the-art language models to provide powerful classification capabilities.
While Convoworks was primarily designed to manage conversational services, we found that it can be used to solve other common issues webmasters face, such as spam filtering.
With the recent addition of the WordPress Hooks package, we used it to create a simple yet effective spam filtering solution.
The Functionality
We've prepared a service template that you can quickly download and apply to your website. It incorporates a spam filter for Contact Form 7 and posts comments. The system stores messages in a custom post type, allowing you to review its workings and assess its effectiveness.
For Contact Form 7, we're utilizing the "wpcf7_spam"
filter, while for comments, we use the "pre_comment_approved"
filter.
Setting Up
Getting started is straightforward:
Install, and activate the Convoworks WP plugin from WordPress.org.
Download, and install the Convoworks GPT plugin from our GitHub repository.
Download the Simple Spam Filter service definition from our website.
In the Convoworks admin GUI, navigate to the New service view, and upload the downloaded service definition.
Navigate to the Variables view in your new service, and enter your OpenAI API key.
Now, navigate to the Configuration view, and enable the WordPress Hooks platform. You can leave the default settings, and just click enable.
Service Workflow
Our service comprises a single step named "Hook Handler," which includes hook processors. There are three of these; each for a different hook. Two-handle the contact form and comments, and the third (optional) registers the custom post type.
When the system checks the incoming message, it first prepares complete message information to use in the GPT Prompt. The GPT's job is to return a simple classification: NOT_SPAM
, MAYBE_SPAM
, or SPAM
. Our logic then acts based on this classification.
In its current form, our service stores all messages, but it can be easily modified to store them only in certain cases. You can achieve this by dragging and dropping components or using the copy/paste feature.
We've implemented spam checking and database storage functionalities through reusable fragments for added convenience.
Custom Post Type
You can set which custom post type should be used with the CUSTOM_TYPE_SPAM_LOG
service variable (Variables view).
If you're using a plugin like ACF, you can register your custom post type through it. If not, our service hooks up to the "init"
action, registering a custom post type accessible through the WordPress admin interface (Spam log menu item).
If you're using an ACF-defined post type, you can remove this filter.
Otherwise, you can use the Admin Columns plugin to modify which columns on the Spam log view are displayed.
Experiment and Customize
I encourage you to play around with the service:
Tweak the prompts to better handle your usual contact form messages or comments.
Instead of custom post types, you can use Formidable Forms to store your messages. To do this, you'll need to enable the convo-forms and convo-wp-plugin-pack packages.
As a developer, I recognize the value of robust, adaptable, and easy-to-use tools. Convoworks exemplifies these qualities, and with the addition of our new spam filtering solution, it continues to evolve and grow. Give it a try, and let us know your thoughts.