Hyperse
  • Pricing
  • FAQs
Newsletter

Subscribe to our newsletter

Receive weekly updates with latest collections and exclusive offers, straight to your inbox.

Hyperse

Headless commerce solutions for brands, developers, and modern ecommerce teams.

Explore

  • Home
  • About Us
  • Partners
  • FAQs

Legal & resources

  • Proposal
  • Privacy Policy
  • Terms & Conditions

© 2026 Hyperse. All rights reserved.


  1. Home
  2. Vendure Plugins
  3. hps-plugin-subscribe
hps-plugin-subscribe

hps-plugin-subscribe

By Yingchun Tian

hps-plugin-subscribe is a Subscribe plugin in the Hub Growth group.hps-plugin-subscribe provides Subscribe plugin capabilities for Hub Growth. Growth, campaigns, loyalty, and customer engagement features. It is especially useful for growth workflows.

CoreVendure Plugins

Specifications

Technical details and package information for this product.

Package

@hyperse-hub/hps-plugin-subscribe

Support by

Yingchun Tian

Support languages

TypeScript, JavaScript, CSS, Prolog, Shell

Integration type

Core

Category

Vendure Plugins

Compatible with

^3.0.0

Latest version

1.0.13

Downloads

0

Repository

https://github.com/hyperse-hub/hub-growth

Last published

July 14, 2026

Description
Changelog
loading...

@hyperse-hub/hps-plugin-subscribe

Vendure plugin for marketing subscriptions: collect email or phone opt-ins per sales channel, optional subscribe topics, shop-side reCAPTCHA on signup, and double opt-in for email addresses created from the storefront.

Requirements

  • Vendure >= 3.6 (plugin compatibility >= 3.0.0)
  • Node >= 16
  • Runtime companions (the plugin imports these modules):
    • @hyperse-hub/hps-plugin-core — defines RecaptchaInput and GoogleRecaptchaService used by createSubscribe on the shop API.
    • @hyperse-hub/hps-plugin-email — registers verification and confirmation email handlers.
    • @hyperse-hub/hps-plugin-admin — admin UI extensions and related entities (e.g. Module) when the dashboard is used.

Installation

Add the package to your Vendure server and satisfy peer dependencies (@vendure/core, Nest, GraphQL, TypeORM, etc.) like your other plugins.

Registering the plugin

Register HpsPluginCore so the shop schema includes RecaptchaInput and verification can run. For storefront email signups you must provide buildEmailVerificationUrl so verification emails contain a correct link.

Minimal example:

Local dev server: config/dev-server.ts in this package.

Configuration

Options for HpsPluginSubscribe.init({ ... }) (see src/types.ts — HpsPluginSubscribeOptions):

OptionTypeDescription
initialSubscribeTopicsInitialSubscribeTopicInput[] or (ctx: { channelId: string }) => ... | Promise<...>If set, topics are upserted on bootstrap for the default channel (matched by code).
buildEmailVerificationUrl(args: { token, channelCode, languageCode }) => string | Promise<string>Required for shop createSubscribe with type: email. Builds the URL opened from the verification email.

Behaviour

Shop API

  • subscribeTopics — public list of opt-in topics for the active channel (for building signup UIs).
  • createSubscribe — requires recaptcha; channel comes from the request context. New email subscriptions are unverified until verifySubscribeEmail succeeds; phone subscriptions are treated as verified for the emailVerified flag.
  • verifySubscribeEmail — completes double opt-in using the token from the verification email; publishes SubscribeEmailVerifiedEvent.

Admin API

  • CRUD-style queries and mutations: subscribes, subscribe, createSubscribe, updateSubscribe, deleteSubscribe (no reCAPTCHA; Subscribe permissions apply).
  • Subscribe topics are managed per channel (subscribeTopic / subscribeTopics / create / update / delete).

Duplicate contacts

The same channel + normalized value (email or E.164 phone) maps to a single row; a new signup merges topic IDs with any existing subscription.

Events

EventWhen
SubscribeEventSubscribe created, updated, or deleted. Shop email signups do not emit created until verified (verification email is sent instead).
SubscribeVerificationEmailEventShop email signup needs a verification message (internal; used by email handlers).
SubscribeEmailVerifiedEventShop email double opt-in completed via verifySubscribeEmail. Use this to sync to ESP (e.g. EmailMarketingService.subscribeToList), not a generic SubscribeEvent updated.

Admin-created or phone subscriptions still emit SubscribeEvent created with emailVerifiedAt already set.

Example (sync to Klaviyo after verification):

End-to-end tests

From this package:

yarn test-e2e

Layout:

  • e2e/plugin-subscribe.e2e.spec.ts — main flows: shop listing, invalid email, email signup + DB-backed token + verifySubscribeEmail, phone signup, admin list/create. Uses HpsPluginCore.init({ devMode: true }) so reCAPTCHA is skipped (same pattern as other Hyperse plugin e2e suites).
  • e2e/plugin-subscribe-recaptcha.e2e.spec.ts — asserts failed verification for an empty token with devMode: false (calls Google siteverify; needs outbound network).
  • Helpers under e2e/data/ (subscribe-shop, subscribe-admin, subscribe-db).

The test server also registers HpsPluginAdmin.init({ ... }) so admin-extension bootstrap and the module table match a full integration setup.

If you change entities or plugins and see stale SQL.js errors, delete the generated __data__ directory under this package and re-run tests.

GraphQL codegen

With the dev server running (yarn serve or equivalent), refresh admin/shop TypeScript types:

yarn codegen

On this page

  • @hyperse-hub/hps-plugin-subscribe
    • Requirements
    • Installation
    • Registering the plugin
    • Configuration
    • Behaviour
      • Shop API
      • Admin API
      • Duplicate contacts
    • Events
    • End-to-end tests
    • GraphQL codegen

import { HpsPluginCore } from '@hyperse-hub/hps-plugin-core';
import { HpsPluginEmail } from '@hyperse-hub/hps-plugin-email';
import { HpsPluginSubscribe } from '@hyperse-hub/hps-plugin-subscribe';
export const config = {
plugins: [
HpsPluginCore.init({
reCaptchaV3SecretKey: process.env.RECAPTCHA_SECRET_KEY,
}),
HpsPluginEmail.init({/* transport, from-address, etc. */}),
HpsPluginSubscribe.init({
buildEmailVerificationUrl: ({ token, channelCode, languageCode }) =>
`https://shop.example.com/${channelCode}/${languageCode}/verify-subscribe?token=${encodeURIComponent(token)}`,
// optional:
// initialSubscribeTopics: [ ... ],
}),
],
};
import { SubscribeEmailVerifiedEvent } from '@hyperse-hub/hps-plugin-subscribe';
eventBus.ofType(SubscribeEmailVerifiedEvent).subscribe(async (event) => {
await emailMarketingService.subscribeToList(
event.ctx,
event.entity.value,
'WpeFJd'
);
});