Multiple feed identifiers subscription

Hi, I'm trying to fetch notifications through the novu/headless using multiple feed identifiers but it doesn't seem to be working. If I set the feedIdentifier value with a string it works as expected but setting in an array value for the query parameter is failing, is there something I'm missing?
8 Replies
Pawan Jain
Pawan Jain3w ago
@sandsower Can you share the code snippet you are using?
sandsower
sandsowerOP3w ago
unsubscribe = headlessService.fetchNotifications({
listener: (l) => {
// Handle the listener here if needed
setLoading(l.isLoading);
},
onSuccess: (response) => {
// Handle the fetched notifications here.
setLoading(false);
setNotifications((prev) => ({
...prev,
[response.page]: response.data,
}));
setHasMore(response.hasMore); // Set hasMore state to indicate if there are more notifications to fetch
setPageNum(response.page); // Set the page number to the current page
setUnseen(response.data.filter((x) => !x.seen).length); // Set the unseen count
},
onError: (error) => {
console.error("Error fetching notifications:", error);
// Implement error handling if needed
unsubscribe && unsubscribe();
},
page: pageNum, // page number to be fetched
query: {
feedIdentifier: [feedId, "all"], // <------------ This is where the issue is
},
});
unsubscribe = headlessService.fetchNotifications({
listener: (l) => {
// Handle the listener here if needed
setLoading(l.isLoading);
},
onSuccess: (response) => {
// Handle the fetched notifications here.
setLoading(false);
setNotifications((prev) => ({
...prev,
[response.page]: response.data,
}));
setHasMore(response.hasMore); // Set hasMore state to indicate if there are more notifications to fetch
setPageNum(response.page); // Set the page number to the current page
setUnseen(response.data.filter((x) => !x.seen).length); // Set the unseen count
},
onError: (error) => {
console.error("Error fetching notifications:", error);
// Implement error handling if needed
unsubscribe && unsubscribe();
},
page: pageNum, // page number to be fetched
query: {
feedIdentifier: [feedId, "all"], // <------------ This is where the issue is
},
});
Novu_Bot
Novu_Bot3w ago
@sandsower, you just advanced to level 3!
sandsower
sandsowerOP3w ago
if I assign just the feedId or "all" instead of an array I do get the messages
Pawan Jain
Pawan Jain3w ago
but setting in an array value for the query parameter is failing, is there something I'm missing?
What is the response with array or you are getting an error?
Pawan Jain
Pawan Jain3w ago
do you have "all" feedidentifier?
sandsower
sandsowerOP3w ago
yes no messages there though, just the feed and the feed office has more than 10 elements, none are returned either my understanding is that it should return both, right? since you can only assign each workflow to a specific feed, so no way to send a single workflow to both feeds
Want results from more Discord servers?
Add your server