helpscout-api-php icon indicating copy to clipboard operation
helpscout-api-php copied to clipboard

Support hydrating embedded threads.

Open matt-h opened this issue 3 years ago • 0 comments

This pulls the code from https://github.com/helpscout/helpscout-api-php/pull/208

It keeps just the hydrating embedded threads part of that pull request while removing the part that added withEmbed to conversation filters.

I'm pulling this back up because when getting webhooks with the IncomingWebhook class the threads are all embedded in the request, but it is impossible to access them since they are never hydrated.

The only thing that might be missing here is getting the correct value for ->getThreadCount().

Currently the webhooks I'm getting are setting threads to 1 which in this code:

if (is_numeric($data['threads'])) {
     $this->setThreadCount($data['threads']);
}

Sets it to that. I'm not sure if embedded threads should do anything to change that without knowing how the underlying system works so I'll leave that up to you if that needs to be modified more. This change doesn't change that at all from how it currently works anyway. And this change allows me to use ->getThreads() which is the goal of what I'm trying to do with this.

matt-h avatar Mar 31 '22 02:03 matt-h