Cannot get global preference for a subscriber (status: 400)
If I try to use the endpoint
https://api.novu.co/v1/subscribers/{subscriberId}/preferences/global
(so with the level set to global
), I get back 400 and the following message:
This happen also with the client on https://docs.novu.co/api-reference/subscribers/get-subscriber-global-preferences
The api key I'm using and the subscriber IDs are both valid.
--- EDIT
I get the same response also when using level template
6 Replies
Hi @Giøn, 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:
* Preferences
* Get subscriber preferences by level
* Update subscriber global preferences
* Messages
-----------------------------
Answer
It seems you're encountering an issue with fetching the global preferences for a subscriber using Novu's API. Based on the information you've provided, the error message indicates a problem with how you're specifying the
level
in your request URL. However, after reviewing the official Novu documentation, it appears that the correct approach to fetching global preferences does not involve specifying level
in the URL path directly as you've described.
To retrieve a subscriber's global preference, the Novu API expects you to use the following endpoint without mentioning level
in the URL path:
(1)
This code snippet suggests you should be using a method from Novu's Node.js SDK (or a corresponding method in another SDK or directly via the API using the correct endpoint) without appending /global
or specifying the level as part of the URL. The method getGlobalPreference
takes the subscriberId
as an argument and should retrieve the global preferences without additional URL path specifications.
If you're still encountering issues, ensure that:
- Your Novu API key (<NOVU_API_KEY>
) is correctly placed.
- The subscriberId
is valid and correctly included in your method call.
- You are using the latest version of Novu's SDK if you're utilizing one.
For direct API calls, refer to the official documentation or the SDK documentation for the correct endpoints and usage patterns. The documentation link you've mentioned takes you to the right method for getting the global preferences, so make sure to follow the usage patterns as documented.Got it. Tagging @Support for additional help.
I'm getting the same issue...
Plus the response from
novu.subscribers.getGlobalPreference
is untyped making using it a little annoyingGot it. Tagging @Support for additional help.
Hey all, we are working on a fix, will follow up soon.
Hey all. I wanted to follow up and let you know this was resolved. Can you please check that on your end and update if it's working as expected?
Thanks!