Last active
November 9, 2021 07:28
-
-
Save mulhoon/c8893a2f7a964bdcf3aa to your computer and use it in GitHub Desktop.
Revisions
-
mulhoon revised this gist
Feb 22, 2016 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ var request = require('request'); var sendMessage = function(device, message){ var restKey = '****'; var appID = '****'; request( @@ -15,7 +15,7 @@ var sendMessage = function(user, message){ body:{ 'app_id': appID, 'contents': {en: message}, 'include_player_ids': Array.isArray(device) ? device : [device] } }, function(error, response, body) { @@ -30,3 +30,4 @@ var sendMessage = function(user, message){ } sendMessage('a9fb63b1-b5cc-4ee9-92f0-5be15eb300c0', 'Hello!'); // Also accepts an array of devices -
mulhoon revised this gist
Feb 22, 2016 . 1 changed file with 5 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,8 @@ var request = require('request'); var sendMessage = function(user, message){ var restKey = '****'; var appID = '****'; request( { method:'POST', @@ -13,9 +13,9 @@ var sendMessage = function(user, message){ }, json: true, body:{ 'app_id': appID, 'contents': {en: message}, 'include_player_ids': [user] } }, function(error, response, body) { -
mulhoon revised this gist
Feb 22, 2016 . 1 changed file with 29 additions and 24 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,27 +1,32 @@ var request = require('request'); var sendMessage = function(user, message){ var restKey = ****; var appID = ****; request( { method:'POST', uri:'https://onesignal.com/api/v1/notifications', headers: { "authorization": "Basic "+restKey, "content-type": "application/json" }, json: true, body:{ 'app_id': appID, 'contents': {en: message}, 'include_player_ids': [user] } }, function(error, response, body) { if(!body.errors){ console.log(body); }else{ console.error('Error:', body.errors); } } ); } sendMessage('a9fb63b1-b5cc-4ee9-92f0-5be15eb300c0', 'Hello!'); -
mulhoon revised this gist
Feb 22, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,7 @@ var request = require('request'); var restKey = *****; var appID = *****; var user = *****; var message = 'Hello world!'; request( -
mulhoon revised this gist
Feb 22, 2016 . No changes.There are no files selected for viewing
-
mulhoon created this gist
Feb 22, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ var request = require('request'); var restKey = *****; var appID = *****; var user = *****; var message = 'Hello world!'; request( { method:'POST', uri:'https://onesignal.com/api/v1/notifications', headers: { "authorization": "Basic "+restKey, "content-type": "application/json" }, json: true, body:{ 'app_id': appID, 'contents': {en: message}, 'include_player_ids': [user] } }, function(error, response, body) { console.log(body); } );