Hi,i have problem with callback is not trigger when change in Document
the configration is
const payload = {
document: {
fileType: “docx”,
key: “Khirz6x2Pvmd5”,
title: “sample5”,
url: “http://localhost:3001/sample.docx”,
},
documentType: “word”,
editorConfig: {
callbackUrl: “http://localhost:3001/track”,
},
};
and callback endpoint is
app.post(‘/track’, (req, res) => {
//res.sendFile(path.join(__dirname, ‘documents’, ‘sample.docx’)); // Adjust the path as needed
console.log(“is enter”);
var updateFile = function (response, body, path) {
if (body.status == 2)
{
var file = syncRequest(“GET”, body.url);
fs.writeFileSync(path, file.getBody());
}
response.write(“{"error":0}”);
response.end();
}
var readbody = function (request, response, path) {
var content = “”;
request.on(“data”, function (data) {
content += data;
});
request.on(“end”, function () {
var body = JSON.parse(content);
updateFile(response, body, path);
});
}
if (req.body?.hasOwnProperty(“status”)) {
updateFile(res, req.body, “/documents/”);
} else {
readbody(req, res, “/documents/”)
}
});