norkunas / onesignal-php-api

OneSignal API for PHP
MIT License
233 stars 82 forks source link

Regarding Config and send Notificaion using API #84

Closed rameshwebmaster closed 6 years ago

rameshwebmaster commented 6 years ago

Hello, i have updated composer and i have following concerns

$config = new Config(); $config->setApplicationId('your_application_id'); $config->setApplicationAuthKey('your_application_auth_key'); $config->setUserAuthKey('your_auth_key');

    $guzzle = new GuzzleClient([
    // ..config
    ]);

    $client = new HttpClient(new GuzzleAdapter($guzzle), new GuzzleMessageFactory());
    $api = new OneSignal($config, $client);

I am new to this api. i have checked backend of Onesignal and they provided only REST API and Auth key but above there are three keys that need to update so i confused here which keys are for what?

Thanks,

norkunas commented 6 years ago

Hello @rameshwebmaster,

User auth key is used for apps requests, so you could create/update/view your apps and for all other endpoints app auth key is used because all other resources and directly related with your application.

If you don't plan to modify your application data in your backend you can skip the user auth key :)

rameshwebmaster commented 6 years ago

ok thanks, what setting need to write in config ? $guzzle = new GuzzleClient([ // ..config ]);

norkunas commented 6 years ago

You can use defaults or read the guzzle documentation

2017-12-11 12:54 "rameshwebmaster" notifications@github.com rašė:

ok thanks, what setting need to write in config ? $guzzle = new GuzzleClient([ // ..config ]);

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/norkunas/onesignal-php-api/issues/84#issuecomment-350690240, or mute the thread https://github.com/notifications/unsubscribe-auth/ACmMOK339flzEDroqbwMbPyPUqSrAOerks5s_Qn7gaJpZM4Q9Gq0 .

rameshwebmaster commented 6 years ago

how to handle exception using this package? and how to print error to end user? i have used this exception catch (\OneSignal\Exception\OneSignalException $e) { dd($e->getMessage()); }

norkunas commented 6 years ago

Looks ok.