Blog -

How to Use Gravity Forms OpenAI for Content Moderation

the Gravity Forms community By the Gravity Forms community Published June 28, 2023

OpenAI

Written by the Editorial team at Gravity Wiz…

We recently published a deep-dive on ways you can use AI inside Gravity Forms right now: no fluff, just real, tangible applications in WordPress using our free Gravity Forms OpenAI plugin.

We also promised to explore how to set up each use case we mentioned. Here we are with our first: using AI for moderation.

OpenAI provides a moderation endpoint that allows you to intercept or flag content that doesn’t comply with their usage policies, which you’ll find are pretty in line with most content moderation policies. In addition to blocking content, it also provides a score for how much it thinks a given submission falls into a specific category.

Why use AI for moderation? AI is only getting better. And like anything AI is touching, it can make existing processes more efficient and scalable. OpenAI can be more effective at detecting and understanding the nuances in inappropriate content than typical WordPress spam plugins — for now — which are often based on static indicators like keywords or other behaviors. That is, it works for more than just spam. And lastly, it’s affordable!

OpenAI

We’ll show you how to integrate Gravity Forms with the Gravity Forms OpenAI plugin to take advantage of the moderation endpoint and build a moderation (and notification) system on any form you use.

 

Gravity Wiz is a third-party certified developer and its add-ons are not supported by Gravity Forms. As always, we recommend you extensively evaluate all plugins to ensure their suitability for your purpose before installation on your website.

Setting Up AI-based Moderation in Gravity Forms

Following up on our previous example, let’s pretend you’re hosting a webinar and presenters can opt in to receive anonymous feedback. And you want to prevent hosts from receiving inappropriate content. Here’s how we would set this up.

Step One: Create a simple feedback form

We’re going to keep ours beautifully simple, with one field, specifically for Feedback.

OpenAI

Step Two: Set up an OpenAI feed

Navigate over to the Gravity Forms OpenAI plugin within your form, and create an OpenAI feed.

  1. Set the endpoint to Moderations.
  2. Use the text-moderation-stable model (there’s two here — your call!).
  3. Choose the input: we’re using the {all_fields} merge tag to output all data within our form.
  4. Set Behavior: we’re going to select mark entry as spam. Here’s your options.
    1. Mark entry as spam — logs the rating and marks inappropriate content as spam.
    2. Do nothing — logs the rating without doing anything. Useful if you want to get an idea of how OpenAI assesses entries.
    3. Prevent submission by showing validation error — prevents the form submission and shows the user a validation error.

OpenAI

Step Three: Test inappropriate submissions

Once your feed is configured, and, optionally, your form is live and published, it’s time to mess about! Here’s an example designed to flag OpenAI’s moderation policies.

OpenAI

Pro tip: Any time a notification is marked as spam Gravity Forms uses its default confirmation. If you’ve customized your confirmation and still see the default, this means it’s been successfully flagged.

You can verify the submission has been marked as spam by navigating to the spam folder in your form’s entries.

OpenAI

Select the entry to see why it was flagged by OpenAI, how it was scored, and, optionally, mark it as not spam.

In this example, we can see the entry was flagged for violence, and scores above 0.7.

OpenAI

Feel free to play around with different inappropriate ideas (go nuts 😂) to see how OpenAI scores your submissions.

With that, you’re good to go!

We’re exploring new ways to use OpenAI’s moderation meta (scoring, reasons for flagging, etc) elsewhere in Gravity Forms and WordPress. If this is something you would like to see, let us know!

Taking it Further: Set up notifications and catch false positives

Depending on the spam protection plugin you use (we offer one too!), false positives can happen. Depending on why a form is being used, it may be essential not to miss these.

With Akismet, for example, we noticed submissions can sometimes be improperly flagged and put in the spam folder.

To help make sure no one is missing anything important, we developed a free Gravity Forms Spam Notification plugin that delivers email notifications when an entry is marked as spam, which makes it easy to double check as it happens. Here’s how you can set that up.

Once you’ve downloaded that plugin (and followed the associated installation instructions):

  1. Create a new notification in your form’s settings and give it a name.
  2. Select the Entry Marked as Spam event under Event type.
  3. Choose an email address to send it to — we’re using the {admin_email} merge tag.
  4. Set a subject line — we’re using “Entry flagged for moderation — #{entry_id}”
  5. In the body — we’ve used the {all_fields} merge tag to output all form fields, as well as a link to view the entry.

OpenAI

This will deliver a quick email notification when an entry is marked as spam that you can review and optionally mark as not spam.

And that’s it!

We’re excited to see where you take this! We recently released support for GPT-4 with Gravity Forms OpenAI, which is ten times more advanced than GPT 3.5 Turbo in nearly all areas — notably, creativity, problem-solving, and programming abilities. And worth mentioning again — it’s totally free.

Download Gravity Forms OpenAI.