Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
PubNub IoT Messaging BLOCK w/ Wia
export default (request) => {
const xhr = require('xhr');
const authKey = request.message.authKey;
const url = "https://api.wia.io/v1/events";
const http_options = {
"method": "POST",
"headers": {
"Content-Type": "application/json",
"Authorization": "Bearer " + authKey
},
body: JSON.stringify(request.message.event)
};
return xhr.fetch(url, http_options).then((response) => {
request.message.wia_reply = JSON.parse(response.body);
return request;
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment