All Projects → chrisfosterelli → Akismet Api

chrisfosterelli / Akismet Api

Licence: mit
Nodejs bindings to the Akismet (https://akismet.com) spam detection service

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Akismet Api

WordPress-IP-Geo-Block
A WordPress plugin that will blocks any comment, pingback and trackback spams posted from outside your nation. And it will also protect against malicious access to the login form, admin area and XML-RPC from undesired countries.
Stars: ✭ 26 (-35%)
Mutual labels:  spam
Laravel Moderation
A simple Content Moderation System for Laravel 5.* that allows you to Approve or Reject resources like posts, comments, users, etc.
Stars: ✭ 487 (+1117.5%)
Mutual labels:  moderation
Nginx Cleantalk Service
LUA configuration to filter any POST requests.
Stars: ✭ 13 (-67.5%)
Mutual labels:  spam
Kawaiideauther
Jam all wifi clients/routers.
Stars: ✭ 284 (+610%)
Mutual labels:  spam
Artificial Adversary
🗣️ Tool to generate adversarial text examples and test machine learning models against them
Stars: ✭ 348 (+770%)
Mutual labels:  spam
Bombers
SMS/Email/Whatsapp/Twitter/Instagram bombers Collection 💣💣💣 💥
Stars: ✭ 647 (+1517.5%)
Mutual labels:  spam
mediawiki-antispam
Antispam extension for MediaWiki.
Stars: ✭ 15 (-62.5%)
Mutual labels:  spam
Isometriksspambundle
Symfony3 Form Spam Protection
Stars: ✭ 38 (-5%)
Mutual labels:  spam
Smokedetector
Headless chatbot that detects spam and posts links to it to chatrooms for quick deletion.
Stars: ✭ 380 (+850%)
Mutual labels:  spam
Fs0c13ty Bot
🤖 A discord bot made to help you in moderation.
Stars: ✭ 24 (-40%)
Mutual labels:  moderation
Vortex
🌀 Discord Moderation Bot
Stars: ✭ 283 (+607.5%)
Mutual labels:  moderation
Troll
Language sentiment analysis and neural networks... for trolls.
Stars: ✭ 330 (+725%)
Mutual labels:  moderation
Laravel Honeypot
Preventing spam submitted through forms
Stars: ✭ 728 (+1720%)
Mutual labels:  spam
Loritta
💁 A multipurpose, multilanguage, customizable, modular, and very cute bot for Discord using JDA! ~Making your server more awesome~
Stars: ✭ 253 (+532.5%)
Mutual labels:  moderation
Discord Bot
🤖 Our BIG help in things about moderation and many more useful stuff on our Discord server.
Stars: ✭ 30 (-25%)
Mutual labels:  moderation
warnable
Simple Discord bot to moderate Discord servers, specifically to warn members.
Stars: ✭ 34 (-15%)
Mutual labels:  moderation
Esp8266 beaconspam
Creates up to a thousand WiFi access points with custom SSIDs.
Stars: ✭ 575 (+1337.5%)
Mutual labels:  spam
Remixbot
A multifunctional Discord bot in development that allows you to easily control your discord server.
Stars: ✭ 39 (-2.5%)
Mutual labels:  moderation
Emailobfuscator
Verschlüsselung von E-Mailadressen zum Schutz vor Spam
Stars: ✭ 34 (-15%)
Mutual labels:  spam
Pydnsbl
Async dnsbl spam lists checker based on asyncio/aiodns.
Stars: ✭ 18 (-55%)
Mutual labels:  spam

Akismet-api

Build Status Dependency Status Download Count License

Full Nodejs bindings to the Akismet (https://akismet.com) spam detection service.

Features:

  • API support for async/await, promises, and callbacks
  • Supports all active versions of node (10 to 15)
  • Supports all Akismet API features
  • Complete set of unit and integration tests
  • Idiomatic JS parameters (with backward compatability)
  • Trusted by many projects (like Coral!)

Upgrading to 5.0? The docs have changed a fair bit but everything is backward compatible on supported node versions, so you likely don't need to change anything! Check out the changelog.

These docs below are with ES6 async/await usage, but if you prefer another API you can also use this library with promises or with callbacks!

Installing

$ npm install --save akismet-api

Creating the Client

Your blog URL and API key are required by Akismet and are all you will need to get started! For a full list of available client parameters and alternative constructors, check out the client documentation.

import { AkismetClient } from 'akismet-api'

const key = 'myKey'
const blog = 'https://myblog.com'
const client = new AkismetClient({ key, blog })

Verifying your Key

It's a good idea to verify your key before use.

try {
  const isValid = await client.verifyKey()

  if (isValid) console.log('Valid key!')
  else console.log('Invalid key!')
} catch (err) {
  console.error('Could not reach Akismet:', err.message)
}

Creating a Comment

A comment, at the bare minimum, must have the commenter's IP and user agent. You can provide more than that for better accuracy and doing so is strongly recommended. The following is a basic example, but see our documentation on the comment data structure for a complete list of fields you can provide.

const comment = {
  ip: '123.123.123.123',
  useragent: 'CommentorsAgent 1.0 WebKit',
  content: 'Very nice blog! Check out mine!',
  email: '[email protected]',
  name: 'John Doe'
}

Checking for Spam

Once you have a comment, we can check it! This tells you if it is spam or not. If Akismet cannot be reached or returns an error, checkSpam will throw an exception.

try {
  const isSpam = await client.checkSpam(comment)

  if (isSpam) console.log('OMG Spam!')
  else console.log('Totally not spam')
} catch (err) {
  console.error('Something went wrong:', err.message)
}

Submitting False Negatives

If Akismet reports something as not-spam, but it turns out to be spam anyways, we can report this to Akismet to help improve their accuracy in the future.

try {
  await client.submitSpam(comment)
  console.log('Spam reported!')
} catch (err) {
  console.error('Something went wrong:', err.message)
}

Submitting False Positives

If Akismet reports something as spam, but it turns out to not be spam, we can report this to Akismet too.

try {
  await client.submitHam(comment)
  console.log('Non-spam reported!')
} catch (err) {
  console.error('Something went wrong:', err.message)
}

Testing

If you are running integration tests on your app with Akismet, you should set isTest: true in your comments! That way, your testing data won't affect Akismet.

To run the library's tests, just use npm test. To also run the optional integration tests, include a valid Akismet API key in the AKISMET_KEY environment variable.

npm test

Credits

Author and maintainer is Chris Foster. Development was sponsored by Two Story Robot

License

Released under the MIT license.

See LICENSE.txt for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].