Use OpenAI and Zapier to perform blog moderation automatically - no code required
Tags: openai, nocode, zapier, lowcode
Published: 2022-12-22 09:48:52

Nowadays, there has been an increasing number of people building their own blogs. However, moderate blogs can be time-consuming and tedious.

Fortunately, Zapier integrates OpenAI 2 weeks ago. With it, you can automate the moderation process for your blog and ensure that only appropriate content is published.

Just imagine when you write your blog. Zapier and OpenAI will moderate it automatically. Then the blog will be published automatically if it passes the moderation. Otherwise, you will receive a notification email.

Let's see how I achieve this - no code required.

# Set up your blog

> Ignore this step if you have built your own blog site.

Don't worry if you don't have your own blog site. Here is a simple [demo](https://github.com/tidbcloud/nextjs-prisma-example) that you can build a blog site in several minutes.

You can deploy it with Vercel or Netlify to publish your blog site to the internet. I just build it locally for convenience.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l05wagw4g8j69es9zb37.png)

This demo enables you to write a draft blog and then publish it. All blogs are stored in [TiDB Cloud Serverless Tier](https://tidbcloud.com/), a free and MySQL-Compatible HTAP database service.

# Use OpenAI and Zapier

Here is the Zap named `Blog moderation` I build.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vajnpsfwkdx5tatvsbjw.png)

- `New Row in TiDB Cloud` will trigger the whole workflow once you create a new draft (a new row will be added in Serverless Tier's `post` table)
- `Check Moderation in OpenAI` will check for hate, hate/threatening, self-harm, sexual, sexual/minors, violence, or violence/graphic content in your post.
- `Paths` will perform different actions according to the result of moderation.

Click view you can see the details of the `Paths`:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mya2dgi4qfegngwqvno9.png)

if your post passed the moderation of OpenAI(Flagged is false), Zapier will perform `Update Row in TiDB Cloud`. It will update the `published` field in the Serverless tier's `post` table so that the draft will be published.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zfi79tu3uh3i01bc1vij.png)

if your post doesn't pass the moderation of OpenAI(Flagged is true), Zapier will perform `Send Email in Gmail`. It will notify you by email with the moderation result.


# Try the workflow

Now, let's try it. Click `Create draft` on your blog site and create two drafts.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aepg4st450r8hkiz05yx.png)



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/psd6stn771qzqs2e7f0h.png)




Wait for a moment and you will find the first blog has been published, while the second blog is still a draft.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wypae6aeucfc53zu2kj0.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l56w55cfiolsg2t2dv6v.png)


Check your email, you will find the notification.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7xwnw99g1p22rw1mriyf.png)


# Summary

As you can see. OpenAI and Zapier can help you be freed from the repetitive moderation work. And a [Zap template](https://zapier.com/apps/tidb-cloud/integrations) is on the way to help you build such a workflow. You can also build by yourself, it isn't too difficult.

Hope the post will help you!