berkayk / laravel-onesignal

OneSignal Push Notifications for Laravel
506 stars 176 forks source link

sendNotificationCustom method send to all instead of "include_aliases" #193

Open syamsoul opened 5 months ago

syamsoul commented 5 months ago

the code below will send to all instead of specific users...

however, i already found the issue,,, i will create PR for that

$params = [
      'contents' => [
          'en' => $message,
      ],
      'target_channel' => 'push',
      'include_aliases' => [
          'external_id' => ["user_{$user->id}"],
      ],
];

OneSignalClient::async()->sendNotificationCustom($params);
syamsoul commented 5 months ago

temporary workaround (while waiting fix released):

just add included_segments and put any random value...


$params = [
    'contents' => [
        'en' => $message,
    ],
    'target_channel' => 'push',
    'include_aliases' => [
        'external_id' => ["user_{$user->id}"],
    ],
    'included_segments' => ["not_exist_just_a_temp_workaround"], // TODO: this is for temporary, after the fix released, can update package and remove this
];

OneSignalClient::async()->sendNotificationCustom($params);