Skip to content

Commit

Permalink
Updating company intercom listener
Browse files Browse the repository at this point in the history
  • Loading branch information
willdoran committed Jun 9, 2017
1 parent ae741bb commit 77f74e4
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions application/classes/Ushahidi/Listener/IntercomCompanyListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,21 @@ class Ushahidi_Listener_IntercomCompanyListener extends AbstractListener
public function handle(EventInterface $event, $data = null)
{
$intercomAppToken = getenv('INTERCOM_APP_TOKEN');
if ($intercomAppToken) {
if ($intercomAppToken) {
try {
$client = new IntercomClient($intercomAppToken, null);
$domain = service('site') ? service('site') : $_SERVER['HOST'];

$client = new IntercomClient($intercomAppToken, null);

try {
$company = [
"company_id" => service('site')
"company_id" => $domain,
"custom_attributes" => $data
];

$company->custom_attributes = $data;
// Update company
$client->companies->create($company);

} catch(ClientException $e) {
Kohana::$log->add(Log::ERROR, print_r($e,true));
}
}
} catch(ClientException $e) {
Kohana::$log->add(Log::ERROR, print_r($e,true));
}
}
}
}

0 comments on commit 77f74e4

Please sign in to comment.