Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
PubNub Workflow w/ Stamplay BLOCK
export default (request) => {
const xhr = require('xhr');
const STAMPLAY_HOOK = 'YOUR_STAMPLAY_WEBHOOK_URL';
const reqBody = Object.assign({}, { type: 'block_event' }, request.message);
const options = {
method: 'POST',
headers: {
'Accepts': 'application/json',
'Content-Type': 'application/json'
},
body: reqBody
};
return xhr.fetch(STAMPLAY_HOOK, options)
.then((response) => {
request.message.stamplay_response = JSON.parse(response.body);
return request.ok();
})
.catch((err) => {
console.log('error happened for XHR.fetch', err);
return request.ok();
});
}
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.