JS Engage SDKを使用してsaveEmail APIを呼び出しています。私はAPI応答コールバックでエラーが発生しましたが、応答を取得できませんでした。Silverpop IBM SaveMailing APIの応答を取得
ibmIMCIntegration.oAuthClientId = value["IBMIMC"].oAuthClientId;
ibmIMCIntegration.oAuthClientSecret = value["IBMIMC"].oAuthClientSecret;
ibmIMCIntegration.oAuthRefreshToken = value["IBMIMC"].oAuthRefreshToken;
// var arrOfClickThroughs = [{clickThroughName:"ingagechatbutton",clickThroughType:2,clickThroughURL:$scope.messangerID}];
var parameters = {
header:{
mailingName:$scope.mailingName,
subject: $scope.subject,
listId: 85326,
fromName: $scope.fromName,
fromAddress: $scope.fromAddress,
replyTo: $scope.replyTo,
visibility: 1,
encoding: 6,
trackingLevel: 2,
clickHereMessage: false
},
messageBodies:{
htmlBody:newSource
},
// clickThroughs:{
// clickThrough:arrOfClickThroughs
// },
forwardToFriend:{
forwardType:0
}
};
ibmIMCIntegration.parameters = JSON.stringify(parameters);
var userJson = {
type:"saveMailing",
options:ibmIMCIntegration,
};
console.info("List IBM Template | User JSON:" +
JSON.stringify(userJson));
var url = 'api/db/invokeIBMIMCOperation.php';
$http.post(url, userJson)
.success(function(res) {
if (res) {
if(res.isSuccess === true) {
swal("", "Your template has been created successfully", "success");
document.getElementById("form1").reset();
}
else {
swal("", "Please try again", "error");
}
console.info(res);
}else{
swal("", "Please try again", "error");
}
});
は、ここに私のAPIのfunciton呼び出しです:
function saveMailing(engage,parameters,ctx){
engage.saveMailing(parameters,function(err, result) {
if (err) {
console.log('Failed to load Save aMailing: ' + err);
} else {
console.log(JSON.stringify(result));
}
});
}
私は今、結果の配列を取得しています。私が間違ったパラメータを送信している場合、エラーコンソールが表示されますが、テンプレートを保存するのに成功すると「{}」が表示されます。
とにかく私は応答を得ることができます。 ?