Conure API

WordPress bot detection and email validation

A single-file must-use plugin that screens comments and registrations. No settings page, no dashboard widget, no upsell.

1. Install

Drop the file into wp-content/mu-plugins/ and create the folder if it is absent.

2. Add the file

wp-content/mu-plugins/conure-guard.php

<?php
/**
 * Plugin Name: Conure Guard
 * Description: Screens comments and registrations against Conure API.
 */

defined('ABSPATH') || exit;

function conure_request($path, $payload) {
    $key = defined('CONURE_API_KEY') ? CONURE_API_KEY : getenv('CONURE_API_KEY');
    if (empty($key)) {
        return null;
    }

    $response = wp_remote_post('https://uat.conureapi.com' . $path, [
        'timeout' => 3,
        'headers' => [
            'Authorization' => 'Bearer ' . $key,
            'Content-Type' => 'application/json',
        ],
        'body' => wp_json_encode($payload),
    ]);

    if (is_wp_error($response) || wp_remote_retrieve_response_code($response) !== 200) {
        return null; // fail open
    }

    $body = json_decode(wp_remote_retrieve_body($response), true);
    return is_array($body) ? $body : null;
}

add_filter('preprocess_comment', function ($comment) {
    $verdict = conure_request('/v1/bot-check', [
        'ip' => $_SERVER['REMOTE_ADDR'] ?? '',
        'user_agent' => $_SERVER['HTTP_USER_AGENT'] ?? '',
    ]);

    if ($verdict !== null && ! empty($verdict['is_bot'])) {
        wp_die(
            esc_html__('Your comment was blocked as automated traffic.', 'conure'),
            esc_html__('Comment blocked', 'conure'),
            ['response' => 403, 'back_link' => true]
        );
    }

    return $comment;
});

add_filter('registration_errors', function ($errors, $login, $email) {
    $verdict = conure_request('/v1/email-check', ['email' => $email]);

    if ($verdict !== null && ! empty($verdict['is_risky'])) {
        $errors->add('conure_email', __('Please register with a permanent email address.', 'conure'));
    }

    return $errors;
}, 10, 3);

3. Wire it up

// wp-config.php - above the "That's all, stop editing!" line
define('CONURE_API_KEY', 'your_key_here');

4. Verify

Confirm the API answers before you debug your WordPress wiring. The sample address sits inside a published AWS range, so a correct setup returns is_bot: true.

Notes

Other frameworks