/** * Run in your JavaScript console. * * To run this example, open your JavaScript console, paste the JavaScript code * hereafter and replace the variables where necessary. */ var apiKey = "YOUR_API_KEY"; var userid = "johndoe"; var APIdazeClientObj = new APIdaze.CLIENT({ apiKey: apiKey, debug: true, userKeys: { command: "auth", userid: userid }, onReady: function() { console.log("Logged in !"); console.log("You may now just run the following cURL command to receive text here"); console.log("curl -X POST 'https://api4.apidaze.io/" + apiKey + "/chat/send' --data 'api_secret=YOURAPISECRET&from=me&to=" + userid + "&ws_server=" + APIdazeClientObj._wsUrl + "&text=Hello'") }, onExternalMessageReceived(messageObj) { console.log("Received", JSON.stringify(messageObj)); alert("Message from " + messageObj.from + " : " + messageObj.body); }, onError: function(errorMessage){ alert("Got error : " + errorMessage); } });