Skip to content

Commit

Permalink
Add Multi App with api_key parameter
Browse files Browse the repository at this point in the history
send api_key to sendNotificationCustom with multi api_key in one app
  • Loading branch information
masucip authored Aug 30, 2017
1 parent 45db6ed commit 0b2ff8c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/OneSignalClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,14 @@ public function sendNotificationToSegment($message, $segment, $url = null, $data
public function sendNotificationCustom($parameters = []){
$this->requiresAuth();
$this->usesJSON();

// By Sucipto
if ($parameters['api_key']) {
$this->headers['headers']['Authorization'] = 'Basic '.$parameters['api_key'];
}
// Make sure to use app_id
$parameters['app_id'] = $this->appId;
if (!$parameters['app_id']) {
$parameters['app_id'] = $this->appId;
}

// Make sure to use included_segments
if (empty($parameters['included_segments']) && empty($parameters['include_player_ids'])) {
Expand Down Expand Up @@ -294,4 +299,4 @@ public function put($endPoint) {
}
return $this->client->put(self::API_URL . $endPoint, $this->headers);
}
}
}

0 comments on commit 0b2ff8c

Please sign in to comment.