Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
PubNub IoT Time Series BLOCK w/ InitialState
export default (request) => {
const xhr = require('xhr');
const accessKey = "YOUR_ACCESS_KEY";
const bucketKey = "YOUR_BUCKET_KEY";
const event = request.message.event;
const http_options = {
"method": "POST",
"headers": {
"Content-Type": "application/json",
"X-IS-AccessKey": accessKey,
"X-IS-BucketKey": bucketKey,
"Accept-Version": "0.0.4"
},
body: JSON.stringify([event])
};
const url = "https://groker.initialstate.com/api/events";
return xhr.fetch(url, http_options).then((x) => {
request.message.is_result = x;
return request;
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.