Created
August 26, 2013 07:54
-
-
Save kunal732/6338995 to your computer and use it in GitHub Desktop.
This file contains 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
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