0
我一直在試圖獲取解析用戶的對象ID,以便我可以將它發送給用戶的電話號碼。雲代碼是在我不熟悉的JavaScript中完成的。我相信問題出在我的代碼上。這是我迄今爲止所做的:如何使用twilio模塊發送解析用戶objectI
var twilio = require("twilio");
twilio.initialize("myAccountSid","myAuthToken");
// Create the Cloud Function
Parse.Cloud.define("inviteWithTwilio", function(request, response) {
// getting objectId from Parse
var query = new Parse.Query("objectId");
query.equalTo("username", request.params.number);
query.find({
success: function(httpResponse){
response.success("Code found");
},
error: function(httpResponse){
response.error("Code not found");
}
});
// Use the Twilio Cloud Module to send an SMS
twilio.sendSMS({
From: "myTwilioPhoneNumber",
To: request.params.number,
Body: "Start using Parse and Twilio!" + query
}, {
success: function(httpResponse) { response.success("SMS sent!"); },
error: function(httpResponse) { response.error("Uh oh, something went wrong"); }
});
});
我需要幫助使此代碼工作。我可以閱讀的書籍建議可以提高我對JavaScript的理解。