{"id":28364027,"url":"https://github.com/chrisfosterelli/akismet-api","last_synced_at":"2025-06-23T22:30:35.614Z","repository":{"id":462109,"uuid":"10847877","full_name":"chrisfosterelli/akismet-api","owner":"chrisfosterelli","description":"Nodejs bindings to the Akismet (https://akismet.com) spam detection service","archived":false,"fork":false,"pushed_at":"2024-03-30T11:13:03.000Z","size":753,"stargazers_count":56,"open_issues_count":8,"forks_count":15,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-04T22:32:07.133Z","etag":null,"topics":["akismet","javascript","moderation","node","spam"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chrisfosterelli.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-06-21T17:14:30.000Z","updated_at":"2025-03-08T13:27:56.000Z","dependencies_parsed_at":"2024-06-18T14:15:55.265Z","dependency_job_id":null,"html_url":"https://github.com/chrisfosterelli/akismet-api","commit_stats":{"total_commits":266,"total_committers":13,"mean_commits":20.46153846153846,"dds":0.4887218045112782,"last_synced_commit":"f2c5276733b802d224b9e9f767fff1a4604a5c0e"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/chrisfosterelli/akismet-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisfosterelli%2Fakismet-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisfosterelli%2Fakismet-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisfosterelli%2Fakismet-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisfosterelli%2Fakismet-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chrisfosterelli","download_url":"https://codeload.github.com/chrisfosterelli/akismet-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisfosterelli%2Fakismet-api/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261566998,"owners_count":23178072,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["akismet","javascript","moderation","node","spam"],"created_at":"2025-05-28T19:41:09.928Z","updated_at":"2025-06-23T22:30:35.602Z","avatar_url":"https://github.com/chrisfosterelli.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Akismet-api\n===========\n\n[![Build Status][img:build]][build]\n[![Download Count][img:downloads]][downloads]\n[![License][img:license]][license]\n\nFull Nodejs bindings to the Akismet (https://akismet.com) spam detection\nservice.\n\nFeatures:\n* Typescript support \n* API support for async/await, promises, and callbacks\n* Supports all active versions of node (14 to 19)\n* Supports all Akismet API features\n* Complete set of unit and integration tests\n* Idiomatic JS parameters (with backward compatability)\n* Trusted by many projects (like [Coral][coral]!)\n\n_Upgrading to 6.0?_ Changes are fairly minimal as long as you're on an active\nversion of node, but check out the [changelog][changelog] for full details.\n\n**These docs below are with ES6 async/await usage, but if you prefer another\nAPI you can also use this library [with promises][promises] or [with\ncallbacks][callbacks]!**\n\nInstalling\n----------\n\n```bash\n$ npm install --save akismet-api\n```\n\nCreating the Client\n-------------------\n\nYour blog URL and API key are required by Akismet and are all you will need to\nget started! For a full list of available client parameters and alternative\nconstructors, check out the [client documentation][client].\n\n```javascript\nimport { AkismetClient } from 'akismet-api'\n\nconst key = 'myKey'\nconst blog = 'https://myblog.com'\nconst client = new AkismetClient({ key, blog })\n```\n\nVerifying your Key\n------------------\n\nIt's a good idea to verify your key before use.\n\n```javascript\ntry {\n  const isValid = await client.verifyKey()\n\n  if (isValid) console.log('Valid key!')\n  else console.log('Invalid key!')\n} catch (err) {\n  console.error('Could not reach Akismet:', err.message)\n}\n```\n\nCreating a Comment\n------------------\n\nA comment, at the bare minimum, must have the commenter's IP and user agent.\nYou can provide more than that for better accuracy and doing so is strongly\nrecommended. The following is a basic example, but see our documentation on the\n[comment data structure][comments] for a complete list of fields you can\nprovide.\n\n```javascript\nconst comment = {\n  ip: '123.123.123.123',\n  useragent: 'CommentorsAgent 1.0 WebKit',\n  content: 'Very nice blog! Check out mine!',\n  email: 'not.a.spammer@gmail.com',\n  name: 'John Doe'\n}\n```\n\nChecking for Spam\n-----------------\n\nOnce you have a comment, we can check it! This tells you if it is spam or not.\nIf Akismet cannot be reached or returns an error, `checkSpam` will throw an\nexception.\n\n```javascript\ntry {\n  const isSpam = await client.checkSpam(comment)\n\n  if (isSpam) console.log('OMG Spam!')\n  else console.log('Totally not spam')\n} catch (err) {\n  console.error('Something went wrong:', err.message)\n}\n```\n\nSubmitting False Negatives\n--------------------------\n\nIf Akismet reports something as not-spam, but it turns out to be spam anyways,\nwe can report this to Akismet to help improve their accuracy in the future.\n\n```javascript\ntry {\n  await client.submitSpam(comment)\n  console.log('Spam reported!')\n} catch (err) {\n  console.error('Something went wrong:', err.message)\n}\n```\n\nSubmitting False Positives\n--------------------------\n\nIf Akismet reports something as spam, but it turns out to not be spam, we can\nreport this to Akismet too.\n\n```javascript\ntry {\n  await client.submitHam(comment)\n  console.log('Non-spam reported!')\n} catch (err) {\n  console.error('Something went wrong:', err.message)\n}\n```\n\nTesting\n-------\n\nIf you are running integration tests on your app with Akismet, you should set \n`isTest: true` in your comments! That way, your testing data won't affect\nAkismet.\n\nTo run the library's tests, just use `npm test`. To also run the optional\nintegration tests, include a valid Akismet API key in the `AKISMET_KEY`\nenvironment variable.\n\n```bash\nnpm test\n```\n\nCredits\n-------\n\nAuthor and maintainer is [Chris Foster][chrisfosterelli].\nDevelopment was sponsored by [Two Story Robot][twostoryrobot]\n\nLicense\n-------\n\nReleased under the MIT license.\n\nSee [LICENSE.txt][license] for more information.\n\n[img:build]: https://img.shields.io/github/actions/workflow/status/chrisfosterelli/akismet-api/main.yml?style=flat-square\u0026branch=main\n[img:downloads]: https://img.shields.io/npm/dm/akismet-api.svg?style=flat-square\n[img:license]: https://img.shields.io/npm/l/akismet-api.svg?style=flat-square\n[build]: https://github.com/chrisfosterelli/akismet-api/actions\n[deps]: https://david-dm.org/chrisfosterelli/akismet-api\n[downloads]: https://www.npmjs.com/package/akismet-api\n[license]: /LICENSE.txt\n[coral]: https://github.com/coralproject/talk\n[changelog]: /CHANGELOG.md\n[chrisfosterelli]: https://github.com/chrisfosterelli\n[twostoryrobot]: https://github.com/twostoryrobot\n[comments]: /docs/comments.md\n[promises]: /docs/promises.md\n[callbacks]: /docs/callbacks.md\n[client]: /docs/client.md\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrisfosterelli%2Fakismet-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchrisfosterelli%2Fakismet-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrisfosterelli%2Fakismet-api/lists"}