Onesignal + PHP (App Notification)

0

I have a code set up for PHP in it is sending the messages all ok for all applications, I want to configure the code to send only to an application. (What I did after installing the app on the phone it generates a player_id on the onesignal site). I took this id and pasted it into a field of mine on my {Player} form.

CODE:

function sendMessage(){

    $content = array(
        "en" => "Você Tem Um Novo Aviso Individual !!!"
    );

    $fields = array(
        'app_id' => "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",

        "include_player_ids" => ('all'),

       'data' => array("foo" => "bar"),
        'contents' => $content

    );

I want to know how to set "include_player_ids" => ('all') here, so that the code understands that from send to all ('ALL'), it sends to the player_id that is in this field {Player}.

    
asked by anonymous 08.05.2018 / 14:19

1 answer

0

According to the documentation

YoushouldusetheuseridintheapplicationintheUsers>AllUsersmenu.

Forexample,youwanttosendthenotificationtotheplayerwiththefollowingid:32c3b33a-3390-4985-9b90-fac83fecfc81,thenitwouldbe

$fields=array('app_id'=>"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
   "include_player_ids" => ["32c3b33a-3390-4985-9b90-fac83fecfc81"],
   'data' => array("foo" => "bar"),
   'contents' => $content

    );
    
20.06.2018 / 12:25