knocklabs / knock-node

Official Node SDK for interacting with the Knock API
MIT License
41 stars 6 forks source link

[Bug] Get user messages `engagement_status` unarchived status #81

Open hizegi opened 1 week ago

hizegi commented 1 week ago

With the recent release of v0.6.15 for getting user messages, I was trying to retrieve unarchived messages by using the newly added engagement_status filter.

The API docs state that I could use

engagement_status:
One or more of `read`, `unread`, `seen`, `unseen`. Limits results to messages with the given engagement status(es).

And the code changes in the release PR seem to allow other parameters to be filterable for engagement_status:

engagement_status?: MessageEngagementStatusFilter[];
...
type MessageEngagementStatusFilter =
  | MessageEngagementStatus
  | "unseen"
  | "unread"
  | "unarchived";

Reproduce

await knockClient.users.getMessages(userId, {
    engagement_status: ['unarchived'],
  })

Returns the error:

 Error GenericServerException {
    status: 500,
   requestID: 'GAohPiG2hN3ZvLYE2A6B',
   name: 'GenericServerException',
   message: 'The request could not be completed.'
 }

Other filters like status are continuing to work as expected.

Is there a way to fetch a user's unarchived messages? Thank you.

mattmikolay commented 1 week ago

Hi @hizegi! Thanks for reporting this issue, and I’m sorry you encountered trouble.

This is due to a bug in Knock’s backend that prevents filtering messages by "archived", "unarchived", "interacted", and "link_clicked" engagement statuses. We’re actively working on a fix, and we’ll let you know when we have an update.