Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
exports = function(changeEvent) {
const http ="salesHTTP");
const fullDocument = changeEvent.fullDocument;
url: "",
body: {
token: context.values.get("PUSHOVER_API_TOKEN"),
user: context.values.get("PUSHOVER_USER"),
title: 'New Sale',
message:`${fullDocument.productName} - ${fullDocument.price}`,
sound: 'cashregister'
encodeBodyAsJSON: true
.then(response => {
// The response body is encoded as raw BSON.Binary. Parse it to JSON.
const ejson_body = EJSON.parse(response.body.text());
return ejson_body;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment