Skip to main content
npayload is launching soon.
npayloadDocs
Guides

Marketplace integration

Publish channels to the marketplace and subscribe to channels from other organizations

The npayload marketplace lets organizations share channels with each other. Publishers list channels for discovery, and consumers subscribe to receive messages. This guide walks through both sides.

Publishing a channel to the marketplace

Before listing a channel, make sure you have an active channel with a defined schema in the event catalogue.

Create a listing

const listing = await npayload.marketplace.createListing({
  channel: 'weather-alerts',
  name: 'Real-time Weather Alerts',
  description: 'Severe weather alerts for North America, updated every 30 seconds.',
  category: 'data-feeds',
  tags: ['weather', 'alerts', 'real-time'],
  pricing: {
    model: 'free',
  },
  documentation: {
    samplePayload: {
      event: 'alert.issued',
      region: 'US-EAST',
      severity: 'warning',
      message: 'Thunderstorm warning for New York metro area',
    },
    schemaRef: 'weather-alert-v1',
  },
});

console.log('Listing created:', listing.gid);

Pricing models

ModelDescriptionBest for
FreeNo chargeOpen data, community channels
Per-messageCharge per message deliveredVariable-volume consumers
Flat monthlyFixed monthly feePredictable pricing
Usage-basedTiered pricing based on volumeHigh-volume data feeds
// Per-message pricing
await npayload.marketplace.createListing({
  channel: 'stock-quotes',
  name: 'Real-time Stock Quotes',
  pricing: {
    model: 'per-message',
    pricePerMessage: 0.001, // $0.001 per message
    currency: 'USD',
  },
  // ...
});

Visibility controls

await npayload.marketplace.updateListing(listing.gid, {
  visibility: 'public',     // Anyone can discover and subscribe
  // visibility: 'unlisted', // Only accessible via direct link
  // visibility: 'invite-only', // Requires publisher approval
});

Consuming from the marketplace

Discover listings

// Search the marketplace
const results = await npayload.marketplace.search({
  query: 'weather',
  category: 'data-feeds',
  sort: 'rating',
  limit: 10,
});

for (const listing of results.items) {
  console.log(`${listing.name} - ${listing.rating}/5 (${listing.subscriberCount} subscribers)`);
}

Subscribe to a listing

const subscription = await npayload.marketplace.subscribe({
  listingId: 'lst_abc123',
  delivery: {
    type: 'webhook',
    endpoint: {
      url: 'https://myapp.com/webhooks/weather',
      method: 'POST',
    },
  },
});

console.log('Subscribed:', subscription.gid);

Once subscribed, messages arrive through your configured delivery method, just like any npayload subscription. Webhook deliveries include signature verification, retries, and DLQ support.

Monitor usage

const usage = await npayload.marketplace.getUsage({
  subscriptionId: subscription.gid,
  period: 'current-month',
});

console.log(`Messages received: ${usage.messageCount}`);
console.log(`Current cost: $${usage.cost}`);

Managing marketplace subscriptions

// Pause a marketplace subscription
await npayload.marketplace.pauseSubscription(subscription.gid);

// Resume
await npayload.marketplace.resumeSubscription(subscription.gid);

// Cancel
await npayload.marketplace.cancelSubscription(subscription.gid);

Publisher analytics

Track how your listings perform:

const analytics = await npayload.marketplace.getListingAnalytics({
  listingId: listing.gid,
  period: 'last-30-days',
});

console.log(`Views: ${analytics.views}`);
console.log(`Subscribers: ${analytics.activeSubscribers}`);
console.log(`Messages delivered: ${analytics.messagesDelivered}`);
console.log(`Revenue: $${analytics.revenue}`);

Marketplace subscriptions inherit all standard npayload delivery guarantees, including retries, circuit breaker protection, and dead letter queue.

Next steps

Was this page helpful?

On this page