WP Manifestindependent plugin directory
manifest / email / brevo-rest-subscribe

Brevo REST Subscribe

WordPress plugin exposing Brevo (Sendinblue) newsletter forms over a versioned REST API — subscribe contacts from headless front-ends, mobile apps and server-to-server integrations, reusing the site's existing Brevo forms, lists, double opt-in and CAPTCHA settings.

by aiarnob · github.com/aminurislamarnob/brevo-rest-subscribe · website

0stars
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/aminurislamarnob/brevo-rest-subscribe/archive/refs/heads/main.zip

Readme

For dev. environment

Run the following command for development environment.

composer update

For production environment

Run the following command for production environment to ignore the dev dependencies.

composer update --no-dev

Coding standards

composer phpcs
composer phpcbf

Project shape

  • Bootstrap: brevo-rest-subscribe.php guards with ABSPATH, defines BREVO_REST_SUBSCRIBE_FILE, loads Composer autoload, exposes welabs_brevo_rest_subscribe() returning BrevoRestSubscribe::init().
  • Namespace: WeLabs\BrevoRestSubscribe\ (PSR-4: includes/ per composer.json).
  • Core class: BrevoRestSubscribefinal, singleton via init(), lightweight container accessed with magic __get.
  • Classes register their own hooks in their constructor; they are instantiated in init_classes() on init priority 4.
Class Responsibility
Dependencies Verifies the Brevo plugin is active and new enough; renders the admin notice.
SubscribeController WP_REST_Controller subclass: routes, schema, permissions.
SubscriptionService Talks to Brevo, mirrors SIB_Manager::signup_process() in a REST-safe way.
FormRepository Read access to Brevo form rows; strips CAPTCHA secrets.
CaptchaVerifier reCAPTCHA / Cloudflare Turnstile verification.
RateLimiter Fixed-window per-client throttle backed by transients.

Endpoints

POST    /wp-json/brevo-rest/v1/subscribe
GET     /wp-json/brevo-rest/v1/forms/<id>
OPTIONS /wp-json/brevo-rest/v1/subscribe    # generated JSON Schema

API documentation

Frontend integrators (human or agent) should start here:

  • docs/rest-api.md — the full integration contract: auth, CORS, every field, every error code, attribute and list semantics, CAPTCHA and double opt-in flows, rate limiting, and copy-paste JS/React/cURL examples.
  • docs/openapi.yaml — OpenAPI 3.1 description of the same API, for client generation.

OPTIONS /wp-json/brevo-rest/v1/subscribe returns the live JSON Schema and is the authoritative source if the two ever disagree.

Read the full README on GitHub →