Closed emergingdzns closed 4 years ago
You can try creating 2 different clients.
$client = new Berkayk\OneSignal\OneSignalClient( 'APP_ID', 'REST_API_KEY', 'USER_AUTH_KEY';
$client->sendNotificationToUser( 'message', 'player Id' );
$client2 = new Berkayk\OneSignal\OneSignalClient( 'APP_ID2', 'REST_API_KEY2', 'USER_AUTH_KEY2';
$client2->sendNotificationToUser( 'message', 'player Id' );
Thanks Berkay. I am currently doing it like this:
$parameters = [
'include_player_ids' => [array of ids],
'headings' => [
'en' => 'Message Heading'
],
'contents' => [
'en' => 'Message Content'
],
'data' => ['link' => 'https://example.com'],
'ios_badgeType' => 'Increase',
'ios_badgeCount' => 1
];
$result = OneSignal::async()->sendNotificationCustom($parameters);
So would if I wanted to continue to send async how would I change the above? I'm trying to send one burst with a list of IDs. Would it just be like this?:
$client = new Berkayk\OneSignal\OneSignalClient( 'APP_ID', 'REST_API_KEY', 'USER_AUTH_KEY';
$client->async()->sendNotificationCustom( $parameters );
That should be working yes.
Is there a way to pass the app id and api key in the call to OneSignal? I have a situation where I've got two separate apps that share the same web application, with a few private areas for each app. But in the common areas, we need to send notifications to all users. But we now have users that have player ids coming from different OneSignal apps (since we can't use the same profile on two different apps). So I would like to be able to pass in the app id and api key into the call to the sendNotificationCustom function. Is this possible?