I could fix it.
function SendJson(url, action, in_json, callback)
local json = require ( "json" )
local headers = {}
headers["Content-Type"] = "application/json"
headers["Accept-Language"] = "en-US"
headers["Authorization"] = "Basic 12121321313123" -- put your Rest API
local params = {}
params.headers = headers
params.body = json.encode( in_json )
network.request ( url, action, callback, params )
end
local function networkListener( event )
if ( event.isError ) then
print( "Network error!")
else
print ( "RESPONSE: " .. event.response )
end
end
local jsonToSend = {["app_id"] = "aaaaaa-222-222-33-3333333333", --put yours App ID
["contents"] = {["en"] = "George challenged you to beat his score!"},
["included_segments"] = "All",
["isAndroid"] = true,
["isIos"] = true,}
--["include_player_ids"] = ["(RECIPIENT_PLAYER_ID_HERE)"]}
SendJson("https://gamethrive.com/api/v1/notifications", "POST", jsonToSend, networkListener)
source
share