Skip to content

Instantly share code, notes, and snippets.

@kunal732
Created August 26, 2013 07:54
Show Gist options
  • Save kunal732/6338995 to your computer and use it in GitHub Desktop.
Save kunal732/6338995 to your computer and use it in GitHub Desktop.
var sendgrid = require("sendgrid");
sendgrid.initialize("SendGrid_Auth_User", "SendGrid_Auth_token");
// Use Parse.Cloud.define to define as many cloud functions as you want.
// For example:
Parse.Cloud.define("hello", function(request, response) {
response.success("Hello world!");
});
Parse.Cloud.define("emailGrocery", function(request, response) {
sendgrid.sendEmail({
to: "[email protected]",
from: "[email protected]",
subject: "Here is your grocery list",
text: request.params.text,
html: request.params.text
}, {
success: function(httpResponse) { response.success("Email sent!"); },
error: function(httpResponse) { response.error("Uh oh, something went wrong"); }
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment