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
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
recipient | string | yes | The watcher's user subject id: who is notified. |
|
merchant_id | string | yes |
| |
merchant_name | string | yes |
| |
merchant_url | string | yes | The merchant's page on Coupons. |
|
coupon_id | string | yes |
| |
coupon_url | string | yes | The coupon's page on Coupons. |
|
title | string | yes | The code's title as listed (what it gives). |
|
expires_at | string | null | yes | The stated expiry (ISO date or date-time), or null when unknown. |
|
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 }] }