helpscout / helpscout-api-php

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

Setting the "from" when adding a reply or a note to a conversation #268

Closed cmaassawesomemotive closed 3 years ago

cmaassawesomemotive commented 3 years ago

Current behavior

I am able to add a reply or a note to a conversation. However, the creator of the reply or note (as shown in HelpScout) is always the account owner.

Support sent me to this issue: https://github.com/helpscout/helpscout-api-php/issues/254#issuecomment-705685768 But adding setUser or setUserId to a thread (either Reply or Note) results in a 404 response from the HS API.

Steps to reproduce

This returns a 404 from the HS API:

$thread = new ReplyThread();
$thread->setText( $message );
$user = new User();
$user->setId($my_user_id);
$thread->setUser($user);

$client->threads()->create($conversation_id, $thread);

This returns a 404 from the HS API:

$thread = new ReplyThread();
$thread->setText( $message );

$thread->setUserId($my_user_id);

$client->threads()->create($conversation_id, $thread);

This works, but the creator is the account owner:

$thread   = new ReplyThread();
$thread->setText( $message );

$user = new User();
$user->setId($my_user_id);
$thread->setCreatedByUser($user);

$client->threads()->create($conversation_id, $thread);

The results are the same for new NoteThread().

cmaassawesomemotive commented 3 years ago

I was using the customer ID, not the user ID. From Support:

The ID you are looking for is actually within your own profile URL. So here... https://secure.helpscout.net/users/profile/12345678

The 12345678 is your user ID. You can get to that by clicking on your profile photo in the top right hand corner of your account, and you'll see that same URL as above. That goes for every user in your account, if you need someone's User ID, they can find that in the same way.