helpscout / helpscout-api-php

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

Validation error when creating Conversation when Customer has default photoType #190

Closed nwhetsell closed 5 years ago

nwhetsell commented 5 years ago

I’m trying to create a Conversation with a Customer whose photoType has the value 'default'. Catching the ValidationErrorException and running

var_dump($exception->getError()->getErrors());

shows:

array(2) {
  [0]=>
  object(HelpScout\Api\Http\Hal\VndError)#106 (4) {
    ["message":"HelpScout\Api\Http\Hal\VndError":private]=>
    string(102) "must be one of 'gravatar', 'twitter', 'facebook', 'googleprofile', 'googleplus', 'linkedin', 'unknown'"
    ["logRef":"HelpScout\Api\Http\Hal\VndError":private]=>
    NULL
    ["path":"HelpScout\Api\Http\Hal\VndError":private]=>
    string(18) "customer.photoType"
    ["errors":"HelpScout\Api\Http\Hal\VndError":private]=>
    array(0) {
    }
  }
  [1]=>
  object(HelpScout\Api\Http\Hal\VndError)#107 (4) {
    ["message":"HelpScout\Api\Http\Hal\VndError":private]=>
    string(102) "must be one of 'gravatar', 'twitter', 'facebook', 'googleprofile', 'googleplus', 'linkedin', 'unknown'"
    ["logRef":"HelpScout\Api\Http\Hal\VndError":private]=>
    NULL
    ["path":"HelpScout\Api\Http\Hal\VndError":private]=>
    string(29) "threads[0].customer.photoType"
    ["errors":"HelpScout\Api\Http\Hal\VndError":private]=>
    array(0) {
    }
  }
}

I didn’t set the photoType of this Customer (I actually wasn’t even aware that API existed until seeing this error).

Should 'default' be a valid value of photoType? If not, how does one avoid this error?

bkuhl commented 5 years ago

Hey! Thanks for reporting this. We've had a few other folks mention the same issue. The underlying issue seems to be that a recent (intended to be transparent) update to our API was describing the photoType as default and not unknown, so when that customer is re-saved it fails validation. Our API team applied a fix which should resolve this. Can you give it another go?

nwhetsell commented 5 years ago

This appears to be fixed, thanks!