Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Bug Report: Missing server api endpoints compared to client #5051

Closed
2 tasks done
lwuethrich-devedis opened this issue Jan 5, 2024 · 5 comments
Closed
2 tasks done
Labels

Comments

@lwuethrich-devedis
Copy link

📜 Description

I think the server api is missing certain functionality compared to the client's one.

  1. Delete all messages
    This is possible in the client sdk implementation when the feed id is set to null but the server api specifies that the feedId
    is required

  2. Fetch all messages given a filter
    In the client sdk we can fetch unread/read messages, the server api does not provide a filter. It is possible to fetch notifications and restrict them to a channel but nothing more.

  3. It does not seem possible to fetch a single message given their id. This is of relevance due to point 4.

  4. Something that I noticed is that a client can delete a notification given the messageId only. I assume the endpoint checks the given subscriber id, so a subscriber can only delete their own messages. On the server api there is only a delete given the message's id. In order to check if the message actually belongs to the user then I would need to fetch the message first which I think is not possible due to (3.). The server should probably accept the subscriber id as well and only delete the message if it actually belongs to the subscriber.

I went through the api reference (https://docs.novu.co/api-reference/overview) but I might have gotten something wrong. I am happy for all clarifications.

👟 Reproduction steps

  1. I compared the server api vs the novu headless service api

👍 Expected behavior

The server api should at least have the same capabilities as the client sdk api in allr egards

👎 Actual Behavior with Screenshots

They do not match see my description in the bug report

Novu version

Novu SaaS

npm version

No response

node version

No response

📃 Provide any additional context for the Bug.

No response

👀 Have you spent some time to check if this bug has been raised before?

  • I checked and didn't find a similar issue

🏢 Have you read the Contributing Guidelines?

Are you willing to submit PR?

None

Copy link

linear bot commented Jan 5, 2024

@github-actions github-actions bot added the triage label Jan 5, 2024
@VishalMCF
Copy link

VishalMCF commented Jan 7, 2024

@lwuethrich-devedis I am confused here. Referring to point 1. How can we delete messages with a feed ID? Feed ID will delete only feeds right? Also can you please mention which client SDK you are specifically referring to? I have seen that many SDKs are not consistent in respect to the APIs they are implementing.

@lwuethrich-devedis
Copy link
Author

@VishalMCF I am mentioning the headless-service javascript sdk.

For example, to delete all messages (1.) following method signature exists on the HeadlessService:

 removeAllNotifications({ feedId, listener, onSuccess, onError, }: {
        feedId?: string;
        listener: (result: UpdateResult<void, unknown, undefined>) => void;
        onSuccess?: () => void;
        onError?: (error: unknown) => void;
    }): Promise<void>;

The feed id here is optional and if not passed all notifications of a user are deleted.

In the server api reference there exists:

There is also a section about notifications without a delete. As it seems it is not possible to delete all messages or messages in bulk is this correct?
For me it was also hard to distinguish the difference between 'message' and 'notification' in this regard. The client sdk talks about 'notifications' which corresponds to some api endpoints under 'messages' in the server api I believe.

Also fetching all messages (2.) given the filter does not seem possible in the server api as well if I am not mistaken.

 fetchNotifications({ page, storeId, query, listener, onSuccess, onError, }: {
        page?: number;
        storeId?: string;
        query?: IStoreQuery;
        listener: (result: FetchResult<IPaginatedResponse<IMessage>>) => void;
        onSuccess?: (messages: IPaginatedResponse<IMessage>) => void;
        onError?: (error: unknown) => void;
    }): () => void;

The server api https://docs.novu.co/api-reference/messages/get-messages does not have the same query options.

@linear linear bot closed this as not planned Won't fix, can't repro, duplicate, stale Jul 22, 2024
@lwuethrich-devedis
Copy link
Author

I believe this issue has to be opened again. Currently it is not possible to implement a custom notification panel with some functionality as 'delete all notifications' and fetching all messages given a specific filter.

@lwuethrich-devedis
Copy link
Author

@VishalMCF See my previous answer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants