{"id":5055,"date":"2026-11-20T18:35:43","date_gmt":"2026-11-20T17:35:43","guid":{"rendered":"https:\/\/glueck-wunsch.de\/testimonial381b\/akismet-introducing-the-official-akismet-javascript-sdk\/"},"modified":"2026-11-20T18:35:43","modified_gmt":"2026-11-20T17:35:43","slug":"akismet-introducing-the-official-akismet-javascript-sdk","status":"publish","type":"post","link":"https:\/\/glueck-wunsch.de\/testimonial381b\/akismet-introducing-the-official-akismet-javascript-sdk\/","title":{"rendered":"Akismet: Introducing the official Akismet JavaScript SDK"},"content":{"rendered":"<div class=\"wp-block-jetpack-markdown\">\n<p>Spam doesn\u2019t care what your site runs on. A contact form on a Next.js app or a comment box on a Cloudflare Worker gets the same junk a WordPress blog does. After the <a href=\"https:\/\/akismet.com\/blog\/introducing-the-official-akismet-php-sdk\/\">PHP SDK<\/a> in June, we\u2019re excited to release the official JavaScript SDK for Akismet.<\/p>\n<h2>Who is this for?<\/h2>\n<p><code>@automattic\/akismet<\/code> is a TypeScript client for the Akismet API. It\u2019s for developers adding spam protection to comments, contact forms, or signups in a JavaScript backend.<\/p>\n<ul>\n<li>It covers the whole <a href=\"https:\/\/github.com\/Automattic\/akismet-api\">Akismet API<\/a>.<\/li>\n<li>It runs on Node.js 22 and later, and on Bun, Deno, and Cloudflare Workers.<\/li>\n<li>It comes with typechecked examples for Express, Fastify, Hono, Next.js, and plain <code>node:http<\/code>.<\/li>\n<\/ul>\n<h2>A two-minute quick start<\/h2>\n<pre><code class=\"language-bash\">npm install @automattic\/akismet\n<\/code><\/pre>\n<p>Then check each submission in the route that receives it. In a Next.js app, that\u2019s <code>app\/api\/comments\/route.ts<\/code>:<\/p>\n<pre><code class=\"language-ts\">import {\n  Akismet, AkismetError, ContentType, SpamVerdict,\n} from '@automattic\/akismet';\n\nconst akismet = new Akismet({\n  apiKey: process.env.AKISMET_API_KEY!,\n  site: 'https:\/\/your-site.com',\n  isTest: process.env.AKISMET_TEST_MODE === '1', \/\/ Disable learning\n});\n\nexport async function POST(request: Request) {\n  const { comment, name, email } = await request.json();\n  try {\n    const result = await akismet\n      .forRequest(request, { trustedProxyHops: 1 })\n      .check({\n        body: comment,\n        authorName: name,\n        authorEmail: email,\n        type: ContentType.Comment,\n      });\n    console.log(result.verdict);\n    if (result.verdict === SpamVerdict.Discard) {\n      \/\/ Akismet is sure it's spam. Drop it.\n    } else if (result.isSpam) {\n      \/\/ Hold it for moderation.\n    } else {\n      \/\/ Publish it.\n    }\n  } catch (error) {\n    if (!(error instanceof AkismetError)) throw error;\n    \/\/ Safe to log: the SDK redacts the API key.\n    console.error(error);\n    \/\/ Akismet failed or rejected the input. Hold it for review.\n  }\n  return new Response(null, { status: 202 });\n}\n<\/code><\/pre>\n<\/div>\n<div class=\"wp-block-jetpack-markdown\">\n<p><code>site<\/code> is the front page of your site. Check out the <a href=\"https:\/\/github.com\/Automattic\/akismet-sdk-js\/blob\/trunk\/README.md\">README<\/a> for details on how the the <a href=\"https:\/\/github.com\/Automattic\/akismet-sdk-js\/blob\/trunk\/README.md#client-ip\">Client IP<\/a> is configured.<\/p>\n<\/div>\n<figure class=\"wp-block-jetpack-videopress jetpack-videopress-player\">\n<div class=\"jetpack-videopress-player__wrapper\">\n<div class=\"jetpack-video-wrapper\"><\/div>\n<\/div>\n<\/figure>\n<div class=\"wp-block-jetpack-markdown\">\n<p>Every framework follows the same flow: check the submission, then act on the verdict. You can check out some <a href=\"https:\/\/github.com\/Automattic\/akismet-sdk-js\/tree\/trunk\/examples\">examples<\/a> for Express, Fastify, Hono, <code>node:http<\/code>, and Next.js Server Actions.<\/p>\n<h2>What\u2019s in 1.0<\/h2>\n<ul>\n<li><strong>Spammers can\u2019t fake their IP.<\/strong> Trust only the headers from proxies you allow.<\/li>\n<li><strong>Your API key stays out of your logs.<\/strong> Log every error worry free.<\/li>\n<li><strong>You can tell Akismet when it gets one wrong.<\/strong> Keep the content you checked and its verdict, when a moderator finds missed spam or a false positive, report it. Akismet learns from those reports, check out the <a href=\"https:\/\/github.com\/Automattic\/akismet-sdk-js\/blob\/trunk\/README.md#feedback\">README<\/a> for how.<\/li>\n<\/ul>\n<h2>Get started<\/h2>\n<p>The Akismet SDK is open source under the MIT license.<\/p>\n<ul>\n<li>Find it on <a href=\"https:\/\/www.npmjs.com\/package\/@automattic\/akismet\">npm<\/a>.<\/li>\n<li>Read the code and docs on <a href=\"https:\/\/github.com\/Automattic\/akismet-sdk-js\">GitHub<\/a>.<\/li>\n<li>Building with an AI coding agent? Tell it to read the <code>SKILL.md<\/code> that ships with <code>@automattic\/akismet<\/code>.<\/li>\n<\/ul>\n<p>You\u2019ll need an Akismet API key. The <a href=\"https:\/\/akismet.com\/pricing\/\">Personal plan<\/a> is name-your-price for personal sites and blogs, and commercial sites need a paid plan sized to their traffic. Your code stays the same whichever plan you\u2019re on.<\/p>\n<p>Found a bug, or something that doesn\u2019t fit your stack? <a href=\"https:\/\/github.com\/Automattic\/akismet-sdk-js\/issues\">Open an issue<\/a> on GitHub.<\/p>\n<\/div>\n<p class=\"wp-block-paragraph\">\n<\/p>","protected":false},"excerpt":{"rendered":"<p>Spam doesn\u2019t care what your site runs on. A contact form on a Next.js app or a comment box on a Cloudflare Worker gets the same junk a WordPress blog does. After the PHP SDK in June, we\u2019re excited to release the official JavaScript SDK for Akismet. Who is this for? @automattic\/akismet is a TypeScript [&hellip;]<\/p>\n","protected":false},"author":22,"featured_media":0,"comment_status":"","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","ocean_front_end_style_editor":"no","ocean_post_layout":"","ocean_both_sidebars_style":"","ocean_both_sidebars_content_width":0,"ocean_both_sidebars_sidebars_width":0,"ocean_sidebar":"","ocean_second_sidebar":"","ocean_disable_margins":"enable","ocean_add_body_class":"","ocean_shortcode_before_top_bar":"","ocean_shortcode_after_top_bar":"","ocean_shortcode_before_header":"","ocean_shortcode_after_header":"","ocean_has_shortcode":"","ocean_shortcode_after_title":"","ocean_shortcode_before_footer_widgets":"","ocean_shortcode_after_footer_widgets":"","ocean_shortcode_before_footer_bottom":"","ocean_shortcode_after_footer_bottom":"","ocean_display_top_bar":"default","ocean_display_header":"default","ocean_header_style":"","ocean_center_header_left_menu":"","ocean_custom_header_template":"","ocean_custom_logo":0,"ocean_custom_retina_logo":0,"ocean_custom_logo_max_width":0,"ocean_custom_logo_tablet_max_width":0,"ocean_custom_logo_mobile_max_width":0,"ocean_custom_logo_max_height":0,"ocean_custom_logo_tablet_max_height":0,"ocean_custom_logo_mobile_max_height":0,"ocean_header_custom_menu":"","ocean_menu_typo_font_family":"","ocean_menu_typo_font_subset":"","ocean_menu_typo_font_size":0,"ocean_menu_typo_font_size_tablet":0,"ocean_menu_typo_font_size_mobile":0,"ocean_menu_typo_font_size_unit":"px","ocean_menu_typo_font_weight":"","ocean_menu_typo_font_weight_tablet":"","ocean_menu_typo_font_weight_mobile":"","ocean_menu_typo_transform":"","ocean_menu_typo_transform_tablet":"","ocean_menu_typo_transform_mobile":"","ocean_menu_typo_line_height":0,"ocean_menu_typo_line_height_tablet":0,"ocean_menu_typo_line_height_mobile":0,"ocean_menu_typo_line_height_unit":"","ocean_menu_typo_spacing":0,"ocean_menu_typo_spacing_tablet":0,"ocean_menu_typo_spacing_mobile":0,"ocean_menu_typo_spacing_unit":"","ocean_menu_link_color":"","ocean_menu_link_color_hover":"","ocean_menu_link_color_active":"","ocean_menu_link_background":"","ocean_menu_link_hover_background":"","ocean_menu_link_active_background":"","ocean_menu_social_links_bg":"","ocean_menu_social_hover_links_bg":"","ocean_menu_social_links_color":"","ocean_menu_social_hover_links_color":"","ocean_disable_title":"default","ocean_disable_heading":"default","ocean_post_title":"","ocean_post_subheading":"","ocean_post_title_style":"","ocean_post_title_background_color":"","ocean_post_title_background":0,"ocean_post_title_bg_image_position":"","ocean_post_title_bg_image_attachment":"","ocean_post_title_bg_image_repeat":"","ocean_post_title_bg_image_size":"","ocean_post_title_height":0,"ocean_post_title_bg_overlay":0.5,"ocean_post_title_bg_overlay_color":"","ocean_disable_breadcrumbs":"default","ocean_breadcrumbs_color":"","ocean_breadcrumbs_separator_color":"","ocean_breadcrumbs_links_color":"","ocean_breadcrumbs_links_hover_color":"","ocean_display_footer_widgets":"default","ocean_display_footer_bottom":"default","ocean_custom_footer_template":"","ocean_post_oembed":"","ocean_post_self_hosted_media":"","ocean_post_video_embed":"","ocean_link_format":"","ocean_link_format_target":"self","ocean_quote_format":"","ocean_quote_format_link":"post","ocean_gallery_link_images":"on","ocean_gallery_id":[],"footnotes":""},"categories":[1],"tags":[],"class_list":["post-5055","post","type-post","status-publish","format-standard","hentry","category-allgemein","entry"],"featured_image_src":null,"author_info":{"display_name":"Christian Bergerhoff","author_link":"https:\/\/glueck-wunsch.de\/testimonial381b\/author\/bergerhoff\/"},"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"ocean-thumb-m":false,"ocean-thumb-ml":false,"ocean-thumb-l":false},"uagb_author_info":{"display_name":"Christian Bergerhoff","author_link":"https:\/\/glueck-wunsch.de\/testimonial381b\/author\/bergerhoff\/"},"uagb_comment_info":0,"uagb_excerpt":"Spam doesn\u2019t care what your site runs on. A contact form on a Next.js app or a comment box on a Cloudflare Worker gets the same junk a WordPress blog does. After the PHP SDK in June, we\u2019re excited to release the official JavaScript SDK for Akismet. Who is this for? @automattic\/akismet is a TypeScript&hellip;","_links":{"self":[{"href":"https:\/\/glueck-wunsch.de\/testimonial381b\/wp-json\/wp\/v2\/posts\/5055","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/glueck-wunsch.de\/testimonial381b\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/glueck-wunsch.de\/testimonial381b\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/glueck-wunsch.de\/testimonial381b\/wp-json\/wp\/v2\/users\/22"}],"replies":[{"embeddable":true,"href":"https:\/\/glueck-wunsch.de\/testimonial381b\/wp-json\/wp\/v2\/comments?post=5055"}],"version-history":[{"count":0,"href":"https:\/\/glueck-wunsch.de\/testimonial381b\/wp-json\/wp\/v2\/posts\/5055\/revisions"}],"wp:attachment":[{"href":"https:\/\/glueck-wunsch.de\/testimonial381b\/wp-json\/wp\/v2\/media?parent=5055"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/glueck-wunsch.de\/testimonial381b\/wp-json\/wp\/v2\/categories?post=5055"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/glueck-wunsch.de\/testimonial381b\/wp-json\/wp\/v2\/tags?post=5055"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}