N
Novu•7mo ago
Rahul-evolvier

Remove details from subscribers

I want to remove the first name, email and phone from a subscriber. How can i achieve this? I tried sending null as value for these fields in the payload but only email is getting removed. I'm using self hosted Novu and using nodejs sdk to interact with it.
13 Replies
Ask Inkeep
Ask Inkeep•7mo ago
Hi @Rahul-evolvier, I'm an AI assistant for Novu. While a team member reviews this question, I'll see if I can find relevant sources for your question. ----------------------------- While I generate an answer, here are some sources that might be helpful: * React * NodeJS quickstart * How to send web push notifications with FCM and Novu * Subscribers -----------------------------
Ask Inkeep
Ask Inkeep•7mo ago
Answer To remove the first name, email, and phone from a subscriber using the Node.js SDK in Novu, you should consider updating the subscriber with empty strings instead of null. Sending null may not always work as expected for certain fields. Here is the code snippet to update these fields:
import { Novu } from '@novu/node';
const novu = new Novu('<NOVU_API_KEY>');

await novu.subscribers.update('subscriberId', {
firstName: '',
email: '',
phone: ''
});
import { Novu } from '@novu/node';
const novu = new Novu('<NOVU_API_KEY>');

await novu.subscribers.update('subscriberId', {
firstName: '',
email: '',
phone: ''
});
(1) , (2) , (3) This should effectively remove the values for firstName, email, and phone from the subscriber.
Rahul-evolvier
Rahul-evolvierOP•7mo ago
Still the values for firstname and phone persists in Novu
Ask Inkeep
Ask Inkeep•7mo ago
Got it. Tagging @Support for additional help.
Tomer Barnea
Tomer Barnea•7mo ago
Hey @Rahul-evolvier 🙂 Two solutions I can think of, one is to remove the subscribe and recrate them with the minimal fields you need, the other is to use the API directly, this seems to be an issue with the nodejs sdk. I'll reach out to the team and let them know. Would you mind sharing why do you want to remove this? how are you planing on using this data?
Rahul-evolvier
Rahul-evolvierOP•7mo ago
When the user in my app logs out i want all his related information be removed from his corresponding subscriber except the app's player id for push notifications. Will i be able to unset values using the API directly?
Tomer Barnea
Tomer Barnea•7mo ago
@Rahul-evolvier would you mind sharing why do want that behavior? @Rahul-evolvier yes, that is correct, using the API you can unset those fields (I just tested first name and last name)
Rahul-evolvier
Rahul-evolvierOP•7mo ago
The user might uninstall the app and then install at a later point of time when they install the app again then we will have two subscribers with same details except for player id.
Tomer Barnea
Tomer Barnea•7mo ago
@Rahul-evolvier I think another way to solve this is set the subscriberId to the play id, and then won't get duplication with subscriber, wdyt?
Rahul-evolvier
Rahul-evolvierOP•7mo ago
but play id will change when the user reinstalls the app.
Tomer Barnea
Tomer Barnea•7mo ago
oh got it, so not the right way to solve it
Rahul-evolvier
Rahul-evolvierOP•7mo ago
Yeah
Novu_Bot
Novu_Bot•7mo ago
@Rahul-evolvier, you just advanced to level 3!
Want results from more Discord servers?
Add your server