Skip to content

Instantly share code, notes, and snippets.

@wadewegner
Created November 9, 2012 17:50
Show Gist options
  • Save wadewegner/4047128 to your computer and use it in GitHub Desktop.
Save wadewegner/4047128 to your computer and use it in GitHub Desktop.
Call Parse Cloud Code from WinRT
var parameters = new Dictionary<string, object> { { "message", "Hello!" } };
await ParseCloud.CallFunctionAsync<IDictionary<string, object>>("sendsms", parameters);
@wadewegner
Copy link
Author

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);

@wadewegner
Copy link
Author

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