// Emails: at least one email is required $emailHome = new \HelpScout\model\customer\EmailEntry(); $emailHome->setValue('*****@*****.**'); $emailHome->setLocation('home'); $emailWork = new \HelpScout\model\customer\EmailEntry(); $emailWork->setValue('*****@*****.**'); $emailWork->setLocation('work'); $customer->setEmails(array($emailWork, $emailHome)); // Social Profiles $facebook = new \HelpScout\model\customer\SocialProfileEntry(); $facebook->setValue('https://facebook.com/john.appleseed'); $facebook->setType('facebook'); $twitter = new \HelpScout\model\customer\SocialProfileEntry(); $twitter->setValue('https://twitter.com/johnappleseed'); $twitter->setType('twitter'); $customer->setSocialProfiles(array($facebook, $twitter)); // Chats // ~~~~~ $chatAim = new \HelpScout\model\customer\ChatEntry(); $chatAim->setValue('jappleseed'); $chatAim->setType('aim'); $chatGTalk = new \HelpScout\model\customer\ChatEntry(); $chatGTalk->setValue('*****@*****.**'); $chatGTalk->setType('gtalk'); $customer->setChats(array($chatAim, $chatGTalk)); $website1 = new \HelpScout\model\customer\WebsiteEntry(); $website1->setValue('http://www.johnappleseed.com'); $website2 = new \HelpScout\model\customer\WebsiteEntry(); $website2->setValue('http://www.appleseed.com'); $customer->setWebsites(array($website1, $website2)); $client->createCustomer($customer);
$emailWork = new \HelpScout\model\customer\EmailEntry(); $emailWork->setValue("*****@*****.**"); $emailWork->setLocation("work"); $customer->setEmails(array($emailWork, $emailHome)); // Social Profiles $facebook = new \HelpScout\model\customer\SocialProfileEntry(); $facebook->setValue("https://facebook.com/john.appleseed"); $facebook->setType("facebook"); $twitter = new \HelpScout\model\customer\SocialProfileEntry(); $twitter->setValue("https://twitter.com/johnappleseed"); $twitter->setType("twitter"); $customer->setSocialProfiles(array($facebook, $twitter)); // Chats // ~~~~~ $chatAim = new \HelpScout\model\customer\ChatEntry(); $chatAim->setValue("jappleseed"); $chatAim->setType("aim"); $chatGTalk = new \HelpScout\model\customer\ChatEntry(); $chatGTalk->setValue("*****@*****.**"); $chatGTalk->setType("gtalk"); $customer->setChats(array($chatAim, $chatGTalk)); $website1 = new \HelpScout\model\customer\WebsiteEntry(); $website1->setValue("http://www.johnappleseed.com"); $website2 = new \HelpScout\model\customer\WebsiteEntry(); $website2->setValue("http://www.appleseed.com"); $customer->setWebsites(array($website1, $website2)); $client->createCustomer($customer); } catch (HelpScout\ApiException $e) { echo $e->getMessage(); print_r($e->getErrors()); }