Created
November 9, 2012 17:50
-
-
Save wadewegner/4047128 to your computer and use it in GitHub Desktop.
Call Parse Cloud Code from WinRT
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 parameters = new Dictionary<string, object> { { "message", "Hello!" } }; | |
await ParseCloud.CallFunctionAsync<IDictionary<string, object>>("sendsms", parameters); |
For those curious, this is the Cloud Code that's executing:
var message = request.params.message;
var phonenumber = request.params.phonenumber;
var twilio = require('twilio');
twilio.initialize('myAccountSid', 'myAuthToken);
twilio.sendSMS({
From: "+12245883104",
To: phonenumber,
Body: message
},
{
success: function(httpResponse) {
console.log(httpResponse);
response.success("SMS sent!");
},
error: function(httpResponse) {
console.error(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
My bad. Missed that CallFunctionAsync defined the response object. Here's the functional code:
var parameters = new Dictionary { { "message", "Hello!" } }; await ParseCloud.CallFunctionAsync("sendsms", parameters);