Best way to sync subscribers settings with Postgres database
I have my backedn using postgres db. I have a table
user
:
How can I sync this table with the subscriber setting in Novu ? I could use Postgres trigger when there is a change in postgres db and make the request too Novu ?7 Replies
@loup, you just advanced to level 1!
Hi @loup looking on the docs about subscribers (https://docs.novu.co/concepts/subscribers), there multiple fields that fit your needs. Check out the image
Novu
What is Novu - Novu
Novu is a full-stack (UI Components, API, and Framework) open source notification infrastructure platform for building, managing, delivering, and monitoring all types of end-user notifications.
Im using Supabase as backend so my idea is when
user
table is updated, I launch an edge function which gonna update the subscriber in NovuMakes sense 👍
Btw, when Novu send a notification, its raw msg right ? I means by that. Imagine I have translation for each notification. The user have as main language 'en-US'. So he receive an english notification. But 2 days later he change to 'fr-FR', the previous notifications wouldnt be translated right ?
@loup
Yes you are right, old message will not be translated to fr-FR
@loup
Do you need more help in this?
There is my solution. Ive created an
ExpressJS
api to make communicate my backend (Supabase
) with Novu
. And inside this express if create a worflow with the new code based method, there is an example :
To manage translation I have a dictionnaries (en-US.json
, fr-FR.json
, ...). And the language depend of the user language. Is it a good configuration ?