Closed Hesesses closed 8 years ago
Sure thing!
Basic usage for the postNotification() function would look like this:
use OneSignal;
$response = OneSignal::postNotification([
"isAnyWeb" => false,
"tags" => [ ["key" => "myKey", "relation" => "=", "value" => 1 ] ],
"contents" => ["en" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean et iaculis enim. Sed egestas porttitor laoreet."],
"headings" => ["en" => "Aliquam consectetur odio sed"],
"android_led_color" =>"FF0000FF",
"android_group" => "myKey",
"android_group_message" => [ "en" => "Aliquam consectetur odio sed has $[notif_count] new messages" ],
"adm_group" => "myKey",
"adm_group_message" => [ "en" => 'Aliquam consectetur odio sed has $[notif_count] new messages' ],
]);
var_dump( json_decode( $response->getBody()->getContents(), true) );
To get a list of apps associated with your OneSignal account:
$apps = json_decode( OneSignal::getApps()->getBody()->getContents(), true );
var_dump($apps);
If these examples get you on the right path, let me know or submit a pull request and I'll include them in the README.
Thank you :)
Hello,
Would you add some example code how to use the wrapper, thank you! :)