# Akismet: Use for existing posts?

**URL:** https://meta.discourse.org/t/akismet-use-for-existing-posts/163910
**Category:** Support
**Tags:** akismet
**Created:** [September 13, 2020, 9:12pm UTC](https://meta.discourse.org/t/akismet-use-for-existing-posts/163910 "2020-09-13T21:12:41Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [September 13, 2020, 9:12pm UTC](https://meta.discourse.org/t/akismet-use-for-existing-posts/163910/1 "2020-09-13T21:12:41Z")

</div>

Hi, a quick question.

Do you think [Discourse Akismet](https://meta.discourse.org/t/discourse-akismet-anti-spam/109337) can somehow be used to detect spam in the existing posts?

I’m importing a forum with a lot of spam and I can’t clean it up all before importing to Discourse.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [September 15, 2020, 1:29pm UTC](https://meta.discourse.org/t/akismet-use-for-existing-posts/163910/2 "2020-09-15T13:29:06Z")

</div>

I think that I might do that it in import script, though I’m not quite sure just how.

---

<div class="post-metadata">

### Author: ![Roman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/roman/32/157504_2.png) [@Roman](https://meta.discourse.org/u/Roman)
#### Post date: [September 15, 2020, 2:25pm UTC](https://meta.discourse.org/t/akismet-use-for-existing-posts/163910/3 "2020-09-15T14:25:39Z")

</div>

It’s possible, but I think you’ll have to make changes to the import script.

You’ll need to be able to instantiate this class in the script:

> <https://github.com/discourse/discourse-akismet/blob/main/lib/akismet.rb>

You may need to copy the code and adapt it to work without Discourse specific code like `Discourse.base_url`, `SiteSetting.akismet_api_key`, etc.

The client `#comment_check` method expects a body, so you’ll have to build something like this:

> <https://github.com/discourse/discourse-akismet/blob/main/lib/discourse_akismet/posts_bouncer.rb#L82>

More info about this [here](https://akismet.com/development/api/#comment-check).

Then you could do something like this:

```ruby
# Check if a post is spam.
client = Akismet.build_client
body = <your code>

is_spam = client.comment_check(body)

```
