Skip to main content

Introduction

Subscribe to product-related notifications and updates.

🔐 This method requires authorization.

What does this module do?

The Events module lets you subscribe users to product notifications - like getting an email when a product is back in stock, or an alert when the price drops.

Think of it as a product subscription system - users can subscribe to specific products and receive notifications when something changes.

Simple Explanation

Imagine you're running an online store and want to keep users informed about products:

  • Product back in stock - Notify users who are waiting for this item
  • Price drop - Alert users watching this product
  • New product added - Notify subscribers of a specific category
  • Limited stock warning - Inform interested users before it sells out

Instead of manually tracking who wants what:

  • Configure product events in OneEntry admin panel
  • Users subscribe to products they're interested in
  • Automatic notifications when something changes
  • Manage all subscriptions in one place

Real-world example:

Without Events Module (manual):
- User wants restock alert → Custom tracking code
- Product price drops → Manual notification logic
- Each product needs separate handling

With Events Module (automated):
- User subscribes to product → Stored automatically
- Product restocked → All subscribers notified
- All subscriptions managed centrally

Key Concepts

What is a Product Event?

A product event is a notification triggered by changes to a product:

  • Trigger - What happens to the product (e.g., "back in stock")
  • Notification - What subscribers receive (email, push, socket message)
  • Subscribers - Users who opted in for this product's updates
  • Template - The notification message content

Notification Channels

Three ways to notify subscribers:

ChannelDescriptionBest For
EmailSend email messagesRestock alerts, price drops, newsletters
Push NotificationMobile/browser alertsUrgent alerts, flash sales
Socket.IOReal-time websocket messagesLive inventory updates, instant price sync
IntegrationsIntegration messagesCustom notification workflows

Read more about Integrations

Event Flow Example

1. User subscribes to a product

2. Product status changes (restocked, price change, etc.)

3. Event detects the change

4. Event sends notifications to all subscribers

5. Subscribers receive the message

What You Need to Know

Common Product Event Triggers

Typical product events you might set up:

  • Product back in stock
  • Price drop alert
  • Low stock warning
  • Product discontinued
  • New variant available
  • Special offer on product

Read more about Event Triggers.

Template Variables

Use placeholders in notification templates to include product details like name, price, and availability.


Quick Reference Table - Common Methods

MethodWhat It Does
getAllSubscriptions()Get all product subscriptions
subscribeByMarker()Subscribe to a product event by marker
unsubscribeByMarker()Unsubscribe from a product event by marker

Note: Events are configured in OneEntry admin panel. The SDK manages subscriptions - use it to subscribe/unsubscribe users from product events.


Common Questions (FAQ)

How do I create or edit product events?

Events are managed in OneEntry admin panel:

  1. Log in to OneEntry admin
  2. Go to Events section
  3. Create or edit product events
  4. Configure triggers, channels, and templates
  5. Activate the event

What's the difference between Push Notification and Socket.IO?

Push Notification - Sent to device (works even when app is closed)

  • Appears in notification center
  • User can tap to open app
  • Best for: Restock alerts, price drops

Socket.IO - Real-time websocket message (only when app is open)

  • Instant delivery to connected clients
  • Live updates without refresh
  • Best for: Live inventory display, real-time price updates

Can I manually trigger a product event from my code?

The SDK doesn't support manual triggers. Events fire automatically based on configured triggers in OneEntry when product data changes.


Can I customize notification templates?

Yes! In OneEntry admin panel:

  • HTML email templates
  • Custom styling
  • Multi-language support
  • Product-specific variables

Important Notes

Event Naming Convention

Use clear, descriptive markers for product events:

Good markers:
- product_back_in_stock
- product_price_drop
- product_low_stock
- product_new_variant
- product_discontinued

Bad markers:
- event1
- notification
- product_event
- test

Best Practices

  • Use descriptive event markers that include "product"
  • Include relevant product details in notification templates
  • Localize event messages for different markets
  • Handle subscription errors gracefully
  • Allow users to easily unsubscribe

More information about the module's user interface https://doc.oneentry.cloud/docs/events/introduction


Definition of the Events module


const { Events } = defineOneEntry(
"your-project-url", {
"token": "your-app-token"
}
);