Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
PubNub Message Copy - - Copy a Message between PubNub Keys 🎉
export default (request) => {
const xhr = require('xhr')
const pub_key = 'demo' // YOUR 2nd PUBLISH KEY
const sub_key = 'demo' // YOUR 2nd SUBSCRIBE KEY
const chncopy = request.channels[0]
const msgcopy = JSON.stringify(request.message)
const url = "" + [
pub_key, sub_key, 0, chncopy, 0, msgcopy
// Copy Message to your other keys.
return xhr.fetch(url)
.then( result => request.ok(result) )
.catch( result => request.ok(result) )
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.