Skip to content

Custom Model for Stock Notifications: How to Notify? #571

Answered by logeshswell
coderreco asked this question in Help
Discussion options

You must be logged in to vote

@coderreco This looks like an excellent Swell app idea. Do you want to try it?

Sending the notifications is where I am looking for guidance

https://developers.swell.is/guides/notifications

I would recommend following the below steps in addition to your thoughts:

  1. Create a custom event (products.restocked) in stocks collection with the right conditions.
  2. Trigger an async task (or webhook) when the above event is triggered from Swell.
  3. Create a custom notification associated with stock-notification model and trigger an email using $notify operator inside your webhook implementation.

On a side note, add an additional field (unsubscribed) in stock-notification model to stop sending an email …

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@coderreco
Comment options

@sags95
Comment options

@coderreco
Comment options

@sags95
Comment options

@coderreco
Comment options

Answer selected by logeshswell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment