Hello guys,
I’m trying to post all conversations from one ticket to another ticket in this process I’m receiving an error as {status: 429, headers: {…}, message: "You have exceeded the limit of 50 requests per minute", errorSource: "APP"}
Is there any alternative for posting all conversation history from one ticket to another ticket within Freshdesk?
Here I’m using SMI to fetch all conversations with pagination on button click and posting it to another ticket. Please find the below code snippet I tried
//button click in the ticket sidebar
$("#create").click(function () {
var page = 1; var arr = [];
getConvByPage(client, page, arr);
});
//Getting conversations by page
function getConvByPage(client, page, arr) {
var options = {
ticketid: ticketid,
page: page
};
client.request.invoke("getConversations", options).then(function (convdata) {
console.log(convdata.response);
var res = convdata.response;
if (res.length !== 0) {
for (var i = 0; i < res.length; i++) {
arr.push(res[i])
}
page++;
getConvByPage(client, page, arr);
} else
createInOtherTicket(client, arr);
}, function (error) {
console.log(error);
});
}
//Creates conversations in other ticket
function createInOtherTicket(client, res) {
if (res.length !== 0) {
var count = 0;
postNote(res, count);
function postNote(res, count) {
if (res[count].source !== 0 && res[count] !== undefined) {
var options = {
body: res[count].body,
private: res[count].private
};
client.request.invoke("postConv", options).then(function (data) {
console.log(data);
count++;
console.log(count)
postNote(res, count);
}, function (error) {
console.log(error)
});
} else {
count++;
console.log(count)
postNote(res, count);
}
}
}
}
-Soujanya.