How To Detect and Hide Emails, Phone Numbers, and Contact Details in Text with Zapier

How To Detect and Hide Emails, Phone Numbers, and Contact Details in Text with Zapier

In this tutorial, I'll be showing you how to automatically detect and remove contact details from unstructured text. We'll be using Zapier to automate the workflow, and the Moderation API integration to do detect and moderate text coming from TypeForm submissions. In this example the data comes from Typeform, but it can easily be replaced with data from a Google Sheet or anything that connects with Zapier.

Table of Contents

  1. Why detect personal information in text automatically?
  2. How to remove contact details from text?
  3. Next steps to automate

Why detect personal information in text automatically?

Manually moderating content is extremely tedious but mundane. Automating it has obvious benefits like increased productivity, but also increases your companies privacy compliance and can reduce the risk of embarrassing data leaks by removing personal information.

In some cases, speed is what you're out for, for example in real-time chat's where having human moderators is simply infeasible. Many online marketplaces rely on commissions from transactions happening through the platform, but if people can simply share a link to their Paypal, the platform is leaking revenue.

Automating complex human processes is extremely difficult to get right. If you're a developer, you probably know how impossible it is to write perfect regex filters, and even if you create a regex that works 90% of the time, it's only a matter of time before the users find ways to bypass it. It becomes a game of cat and mouse.

That's why The Moderation API uses AI to detect attempts to share emails, social media handles, phone numbers, and other contact details. It uses state-of-the-art natural language processing to understand the context of words and the meaning of sentences, so it doesn't accidentally removes harmless information.

How to remove contact details from text?

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.

Prerequisites:

1. Create a data recognition filter in Moderation API

Go to your moderation dashboard and create a new project. In the project settings, select the personal data types you'd like to detect. We'll pick "Email", "Phone number" and "Address". You can pick different levels of sensitivity (we recommend starting with "Normal"). Make sure to switch on "Enabled" and "Masking" for all the personal data types you want to hide.

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

2. Set up a Zap to remove emails, phone numbers and URLs

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

Begin by creating a new Zap and select Typeform and Moderation API. Select the trigger "New Entry" and the action "Get Moderated Text".

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

Connect your form from Typeform:

Next, you want to make sure that your Typeform account is connected and select the form you want to use.

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 Form submission like you see on this screenshot:

Press "Continue" and then "Test & Review". You should see that any email, phone number, or address has been filtered out.

We're almost there... we just need to store the moderated content somewhere.

Send the moderated content to your email:

In this demo, I'll be sending the moderated content to my own email, but you can do anything you want like saving it to a Google Sheet or forwarding it to an email list.

Add a new step in the Zap by pressing the plus button. Select the Gmail app, and insert the moderated data as the body. Press continue.

Pick the moderated data as the message

AND WE'RE DONE!

Now we're ready to test the integration! So go to the next step and press "Test & Review". If all goes well, you should receive an email with the moderated content.

Let's turn on the Zap, to start receiving all new entries from Typeform as moderated data.

Note: It might take a few minutes for Zapier to pick up the new form entries depending on what Zapier plan you're subscribed to.

Here's the email I received. 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:

  • Enable the profanity filter to moderate swear words and toxic content. See this tutorial.
  • Integrate the Typeform on your website and start moderating real data.
  • Forward the moderated content to an email list of suppliers.

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