CouponsWatchMatchedPayload coupons.watch.matched@1

Generated at from openvibe-contracts v0.188.2 and openvibe-sdk v0.46.0.

Version
1.0.0
Owner
coupons
Visibility
first-party
Status
active
Compatibility
backward
Schema
https://openvibe.network/contracts/events/payloads/coupons.watch.matched.v1.json

coupons.watch.matched v1 (OpenVibe.Coupons server/domain/watches.js notifyWatchers). A code for a merchant a person watches became publicly listed (created published, or approved from review), inside the same transaction. One event per (watcher, coupon): never for the person who submitted the code, never twice. Internal visibility, the envelope subject is the coupon; recipient is who OpenVibe.Network notifies. The payload carries no code text: the notification links the coupon page, where its restrictions and reports are.

Fields

FieldTypeRequiredDescriptionConstraints
recipientstringyesThe watcher's user subject id: who is notified.
  • pattern ^usr_[0-9A-HJKMNP-TV-Z]{26}$
merchant_idstringyes
  • pattern ^mer_[0-9A-HJKMNP-TV-Z]{26}$
merchant_namestringyes
  • minLength 1
  • maxLength 200
merchant_urlstringyesThe merchant's page on Coupons.
  • pattern ^https?://
  • format uri
  • maxLength 2048
coupon_idstringyes
  • pattern ^cpn_[0-9A-HJKMNP-TV-Z]{26}$
coupon_urlstringyesThe coupon's page on Coupons.
  • pattern ^https?://
  • format uri
  • maxLength 2048
titlestringyesThe code's title as listed (what it gives).
  • minLength 1
  • maxLength 500
expires_atstring | nullyesThe stated expiry (ISO date or date-time), or null when unknown.
  • maxLength 40

Examples

From the contract's own test fixtures: valid ones validate, rejected ones must fail.

Valid: new-code
{
  "recipient": "usr_01JAB2C3D4E5F6G7H8J9K0MNPR",
  "merchant_id": "mer_01JAB2C3D4E5F6G7H8J9K0MNPS",
  "merchant_name": "Example Outdoor Store",
  "merchant_url": "https://openvibe.coupons/m/example-outdoor-store",
  "coupon_id": "cpn_01JAB2C3D4E5F6G7H8J9K0MNPT",
  "coupon_url": "https://openvibe.coupons/c/cpn_01JAB2C3D4E5F6G7H8J9K0MNPT",
  "title": "15% off orders over $50",
  "expires_at": "2026-11-30"
}
Valid: no-expiry
{
  "recipient": "usr_01JAB2C3D4E5F6G7H8J9K0MNPR",
  "merchant_id": "mer_01JAB2C3D4E5F6G7H8J9K0MNPS",
  "merchant_name": "Example Outdoor Store",
  "merchant_url": "https://openvibe.coupons/m/example-outdoor-store",
  "coupon_id": "cpn_01JAB2C3D4E5F6G7H8J9K0MNPV",
  "coupon_url": "https://openvibe.coupons/c/cpn_01JAB2C3D4E5F6G7H8J9K0MNPV",
  "title": "Free shipping",
  "expires_at": null
}
Rejected: carries-code
{
  "recipient": "usr_01JAB2C3D4E5F6G7H8J9K0MNPR",
  "merchant_id": "mer_01JAB2C3D4E5F6G7H8J9K0MNPS",
  "merchant_name": "Example Outdoor Store",
  "merchant_url": "https://openvibe.coupons/m/example-outdoor-store",
  "coupon_id": "cpn_01JAB2C3D4E5F6G7H8J9K0MNPT",
  "coupon_url": "https://openvibe.coupons/c/cpn_01JAB2C3D4E5F6G7H8J9K0MNPT",
  "title": "15% off",
  "expires_at": null,
  "code": "SAVE15"
}
Rejected: numeric-recipient
{
  "recipient": "42",
  "merchant_id": "mer_01JAB2C3D4E5F6G7H8J9K0MNPS",
  "merchant_name": "Example Outdoor Store",
  "merchant_url": "https://openvibe.coupons/m/example-outdoor-store",
  "coupon_id": "cpn_01JAB2C3D4E5F6G7H8J9K0MNPT",
  "coupon_url": "https://openvibe.coupons/c/cpn_01JAB2C3D4E5F6G7H8J9K0MNPT",
  "title": "15% off",
  "expires_at": null
}

Validate

const contracts = require('openvibe-contracts');
contracts.validate('coupons.watch.matched@1', value);   // { valid, errors: [{ path, message }] }