helpscout / helpscout-api-php

PHP Wrapper for the Help Scout API
MIT License
99 stars 62 forks source link

Inactive Helpscout User Causing issue when getting conversations #294

Closed mlboudreau closed 2 years ago

mlboudreau commented 2 years ago

Thank you for taking the time to submit an issue with all the details shown below. Our engineering team monitors issues submitted and strives to respond with 1-2 business days.

Current behavior Our app is using helpscout. It has been working fine, however we have a user who is no longer with us and no longer shows as a user in helpscout that is causing an issue when trying to get conversations through the api. I am using the withClosedBy() function on the ConversationRequest when calling conversations()->list(). This throws this error: "Client error: GET https://api.helpscout.net/v2/users/508903 resulted in a 404 Not Found response"

508903 is the user id for the user that is no longer with us.

Expected behavior There should not be a 404 error as the conversation is still there and the user did once exist. Also I don't know how to work around this error.

Steps to reproduce

  1. ..

miguelrs commented 2 years ago

Hey @mlboudreau. Thanks for opening this issue!

What you're experiencing is actually the expected behavior right now. When you use the withClosedBy() function, you're explicitly saying "load the user that closed the conversation as well", and because that user can't be loaded, the API returns a 404.

We do understand your point of view and how this may not be the ideal behavior, and we will definitely consider it for future improvements. However, that'd be a fundamental change in behavior, which would need to be applied to all the endpoints across the library, in order to keep things consistent, so it's not a quick one.

For now, our suggestion would be to check the response, and if you get a 404 for the user, make another request to fetch the conversation without using withClosedBy(). Hope that this approach can help you move things forward for now 🤞