Changes to getPreference()?

Hi, I'm using
novu.subscribers.getPreference(subscriberId)
novu.subscribers.getPreference(subscriberId)
in my application settings to display preferences. I filter on preferences that includes in_app to display the in_app setting and vice versa for email. However I think the api has changed? because now the preferences include all channels even if my workflow only uses email?
{ email: true, sms: true, in_app: true, chat: true, push: true }
{ email: true, sms: true, in_app: true, chat: true, push: true }
11 Replies
Pawan Jain
Pawan Jain4w ago
@christian We recently fixed this issue with the underline API of the above sdk method https://github.com/novuhq/novu/pull/7101 Now this API returns all channels with false or true values. This behaviour can be changed with includeInactiveChannels api query param Updated SDK in this PR https://github.com/novuhq/novu/pull/7115 Checkout API reference https://docs.novu.co/api-reference/subscribers/get-subscriber-preferences
christian
christianOP4w ago
ok so I need to wait for the PR to be merged in order to fix this since I'm using the novu client
Pawan Jain
Pawan Jain4w ago
Yes, you will need to update node sdk version and add 2nd argument value as false
christian
christianOP4w ago
will it be merged today?
Pawan Jain
Pawan Jain4w ago
@christian I will push this PR to be merged today
christian
christianOP4w ago
Would be nice to get this in a version soon, the api changes broke my application and I don't want to move from using the client. think it'll be ready today @Pawan Jain , sorry to bother but in the current state my app is broken
Pawan Jain
Pawan Jain4w ago
@christian Apologies for delay I am looking into this on priority @christian We released new node SDK version 2.0.4 Could you try with this version?
christian
christianOP4w ago
it's not working for me with using fetch and api:
app:dev: { email: true, in_app: true }
app:dev: { in_app: true }
app:dev: { in_app: true }
app:dev: { email: true }
app:dev: { in_app: true }
app:dev: { email: true, in_app: true }
app:dev: { in_app: true }
app:dev: { in_app: true }
app:dev: { email: true }
app:dev: { in_app: true }
using client:
export async function getSubscriberPreferences({
subscriberId,
}: GetSubscriberPreferencesParams) {
const response = await novu.subscribers.getPreference(subscriberId, {
includeInactiveChannels: false,
});
return response.data;
}

app:dev: { email: true, sms: true, in_app: true, chat: true, push: true }
app:dev: { email: true, sms: true, in_app: true, chat: true, push: true }
app:dev: { email: true, sms: true, in_app: true, chat: true, push: true }
app:dev: { email: true, sms: true, in_app: true, chat: true, push: true }
app:dev: { email: true, sms: true, in_app: true, chat: true, push: true }
export async function getSubscriberPreferences({
subscriberId,
}: GetSubscriberPreferencesParams) {
const response = await novu.subscribers.getPreference(subscriberId, {
includeInactiveChannels: false,
});
return response.data;
}

app:dev: { email: true, sms: true, in_app: true, chat: true, push: true }
app:dev: { email: true, sms: true, in_app: true, chat: true, push: true }
app:dev: { email: true, sms: true, in_app: true, chat: true, push: true }
app:dev: { email: true, sms: true, in_app: true, chat: true, push: true }
app:dev: { email: true, sms: true, in_app: true, chat: true, push: true }
I'll just use the api instead
Novu_Bot
Novu_Bot4w ago
@christian, you just advanced to level 2!
Pawan Jain
Pawan Jain3w ago
@christian Could you please try with @novu/node version 2.0.5
christian
christianOP3w ago
export async function getSubscriberPreferences({
subscriberId,
}: GetSubscriberPreferencesParams) {
const response = await novu.subscribers.getPreference(subscriberId, {
includeInactiveChannels: false,
});

return response.data;
}



@app:dev: { email: true, sms: true, in_app: true, chat: true, push: true }
@app:dev: { email: true, sms: true, in_app: true, chat: true, push: true }
@app:dev: { email: true, sms: true, in_app: true, chat: true, push: true }
@app:dev: { email: true, sms: true, in_app: true, chat: true, push: true }
@app:dev: { email: true, sms: true, in_app: true, chat: true, push: true }
export async function getSubscriberPreferences({
subscriberId,
}: GetSubscriberPreferencesParams) {
const response = await novu.subscribers.getPreference(subscriberId, {
includeInactiveChannels: false,
});

return response.data;
}



@app:dev: { email: true, sms: true, in_app: true, chat: true, push: true }
@app:dev: { email: true, sms: true, in_app: true, chat: true, push: true }
@app:dev: { email: true, sms: true, in_app: true, chat: true, push: true }
@app:dev: { email: true, sms: true, in_app: true, chat: true, push: true }
@app:dev: { email: true, sms: true, in_app: true, chat: true, push: true }
same :/
Want results from more Discord servers?
Add your server