helpscout / helpscout-api-php

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

Note added to existing conversation as created by account owner #254

Closed jproy418 closed 3 years ago

jproy418 commented 3 years ago

Current behavior

Hi,

When adding a note (or other threads ) to an existing conversation, it always the owner who is set as the creator of the note. Even if I use setCreatedByUser().

But it's working, when the note is added when conversation is created. eg. $conversation->setThreads(new Collection($reply_thread,$note));

Maybe I'm not doing it the right way.

Steps to reproduce

My code:

$thread = new NoteThread();
$thread->setCreatedByUser($user);
$thread->setText($msg);
$thread->setStatus($status);
$client->threads()->create($conversation_id, $thread);

Thank you

bkuhl commented 3 years ago

Hey,

This is definitely a bit confusing. The NoteThread is a multipurpose object that's used when creating threads and when fetching a conversation's threads. When creating, $thread->setUser() or $thread->setUserId() should be used to have this value set correctly. When fetching this thread $thread->getCreatedByUser() should be used. Seems to be an unfortunate side effect of some design/reusability choices we made in the SDK, so I'm sorry about the confusion!

jproy418 commented 3 years ago

It's working! Thanks for the fast answer!