Created
November 7, 2018 10:20
-
-
Save mickaelramanitrera/64ff8bc2ddf47b341eb4a6cd03b44d6f to your computer and use it in GitHub Desktop.
Podio JS push notifications
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const podio = new PodioJs.api({ | |
authType: "password", | |
clientId: process.env.PODIO_CLIENT_ID, | |
clientSecret: process.env.PODIO_CLIENT_SECRET, | |
}, { | |
enablePushService: true, | |
}); | |
podio.authenticateWithCredentials(process.env.PODIO_USER_EMAIL, process.env.PODIO_USER_PWD, (err) => { | |
if (err) { console.log("Error", err); } | |
//this is for a space sub | |
//must get the space to get the push configurations of this space | |
podio.request("get", `/space/${process.env.SPACE_ID}`) | |
.then((space: any) => { | |
console.log("Space infos", space); | |
// add push exts | |
podio.push(space.push).subscribe((event: any) => { | |
console.log("------EVENT RECEIVED---------", event); | |
}).then(() => { | |
console.log("Subscription added!"); | |
}); | |
}) | |
.catch((erro: any) => { | |
console.log("ERR", erro); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment