How To Moderate Text Automatically Using Zapier & Moderation API

In this tutorial, I'll be showing you how to automatically detect and remove swear words from text using Zapier and the Moderation API.

How To Moderate Text Automatically Using Zapier & Moderation API

In this tutorial, I'll be showing you how to detect and remove swear words from text in Google Sheets automatically. We'll be using google sheets to input and output the data, but this could easily be done with data from a form on your website or anything that connects with Zapier.

TL:DR: We've created a Zapier template of this tutorial:
Update text in new Google Sheets rows with Moderation API
Need to make sure that your data is moderated the way you like it? Use this Zapier integration! Set it up to check for new text in Google Sheets, then automatically moderate and mask out swear words,...

Table of Contents

  1. Why automate your content moderation?
  2. How to remove profanity from text automatically?
  3. Next steps to automate

Why automate your content moderation?

Moderating content is an extremely tedious and soul-sucking activity. Automating it in every possible way will free up time for other important business activities.  

Automating complex human processes is extremely difficult to get right. Current moderation technology is still not 100% on human levels - but, we're almost there, and there are huge amounts of time to be saved.

"Clbuttic Mistake" - from the accidental replacement of ass in classic with the less offensive word butt.
People who make buttumptions about their search and replace code, will be embarbutted when they repeat this clbuttic mistake.

The Moderation API is the best solution available for text moderation that anyone can use. It uses state-of-the-art natural language processing to understand the context of words and the meaning of sentences so it can avoid situations like the "clbuttic mistake".

How to remove profanity from text automatically?

Let's get started with moderating your content automatically. First, you need to make sure that you have accounts set up for all the services that we'll use.


1. Create a profanity filter in Moderation API

Go to your moderation dashboard and create a new project. In the project settings, select "Profanity" and set up the filter as you like. You can pick different levels of sensitivity (we recommend starting with "Normal"), and enter a value to replace the swear words with. Make sure to switch on "Enabled" and "Masking" to make the filtering work.

Moderation API Dashboard with Profanity switched on
Moderation API Dashboard

Afterward, you can test if the filter works as expected with the input field.

Moderation API Profanity response with swear words filtered out
Moderation API Profanity response

2. Prepare a sheet in Google Sheets

In this tutorial, we set up automatic moderation on new rows in Google sheets, but you can easily use any other app that connects with Zapier. For example moderate a new post on your WordPress site, an Airtable entry, or a new form entry in Google Forms or Typeform.

First, create a new sheet, and prepare 3 columns. We plan to make the first column contain the original text, the second should contain the auto-moderated text, and the third column indicates if the text contains swear words.

It's important to fill out the first row with labels, and a value in the first column, otherwise Zapier will complain about it later.

Google Sheet prepared for Moderation
Google Sheet prepared for Moderation

3. Set up a Zap to remove swear words

Now to the fun part: stitching everything together in Zapier.

Begin by creating a new Zap and select Google Sheets and Moderation API. Select the trigger "New Spreadsheet Row" and the action "Get Moderated Text".

Zap connecting Google Sheets with Moderation API
Zap connecting Google Sheets with Moderation API

Connect Google Sheets:

Next, you want to make sure that your Google Sheets is connected and select the sheet we just created before.

If you didn't fill out the first value in your sheet yet, do that now. Then, test your trigger and continue to the next step.

Connect Moderation API:

Now we're setting up the Moderation Step. First, you need to make sure that Zapier can connect to Moderation API, so go back to your project settings in moderation API and copy the API key.

Go back to the Zap you're working on, and press "connect a new account" under "Choose account". Paste the API key in the popup window.

You only need to do this once. For the next Zap you're planning to create, you can just pick the project you've already connected.

Set up the Moderation Action:

Now, set up the action to use the text from the Google Sheets row like you see on this screenshot:

Press "Test & Continue". You should see the following output:

We're almost there... we just need to write the moderated content back to Google Sheets.

Add data back into Google Sheets:

Add a new step in the Zap by pressing the plus button. Select the Google Sheets app and the "Update spreadsheet row" action.

Select the same sheet file as we did in the first step.

Now, we always want to output the data to the same row that the input data is coming from. So, under row click "Custom", pick "1. New spreadsheet row in Google Sheets" and then pick "1. Row ID".

Pick the input row ID for update row

Now, for the output fields, we want to use the data coming from Moderation API. You can leave the Content field empty to keep the original text in that column. In the end, the action looks something like this:


Now we're ready to test the integration! So go to the next step and press "Test & Review". If all goes well, you can go back in your sheet and see the updated fields.

Let's turn on the Zap, to make it detect when we enter new data in the sheet. The text we tested with doesn't contain any swear words, so let's try to make it detect some profanity. Go ahead and fill in a new row in the sheet with a text containing some nasty words.

Note: It might take a few minutes for Zapier to pick up the new data from Google Sheets depending on what Zapier plan you're on.

The fields should be updated after some time. Check it out!

Moderation Result

Next steps to automate

This tutorial should get you started using Zapier and Moderation API, but you might want to make your automation flow even more powerful. Here are some ideas going forward with your automation activities:

  • Detect and moderate personal identifiable information using additional filters in Moderation API.
  • Forward the moderated text to the end-user using an email action in Zapier.
  • Automate the data entry in Google Sheets with another Zap.

I hope you found this tutorial useful, don't hesitate to contact me if you're having trouble setting everything up.