Save document capture response

I have been struggling with this for a little over 2 weeks now. Here is our scenario:

User opens document from our software which sends the document information to the OnlyOffice page, OnlyOffice opens the document perfectly fine. User makes edits as needed and needs/wants to save the document, I am able to save the document using the PHP example that is posted in the API Documentation, this works with no problem, however I need some way to know that they hit the save button so I can fire off a custom javascript function to go in and update the case record in our custom software.

I know that the OnlyOffice when using the forcesave feature, it gets a response from the callback url on success of {error:0} and then the status bar shows that the document was saved, I need to be able to capture this in some way so that I can then have a function run from Javascript.

We have the document server running for example on server 192.168.214.70 and our software runs on 192.168.214.50, I have even tried to add in an ajax function but then it tries to fire off right away on document load.

I just need to be able to know when the user hits the save button and how I can tie into this. Please it is driving me crazy trying to get this one last thing working.

Hello, status 6 is being sent to the callback handler each time a document is forcesaved, you can observe status 6 messages and link your function to callback getting status 6 - ONLYOFFICE Api Documentation - Callback handler

Hello, I guess I’ve also encountered a similar problem

My business scenario is that users need to click on a custom button in the browser, such as the “Save” button, to control whether to save in Word, rather than automatically saving through OnlyOffice or clicking the save button in OnlyOffice before saving

May I ask how can I use my custom button to call the callback interface for saving documents?

If there are any good methods or suggestions, please guide me. Thank you very much!

@fengyue97 Hello,
You can use this Command Service method to save the current version of the edited document without closing it: ONLYOFFICE Api Documentation - Command service . You can link function sending the forcesave request to your custom button. Here you can learn more about the logic of forcesave: ONLYOFFICE Api Documentation - Saving File

Can you provide an example of the eventlistener that could be added to achieve this? This would be perfect if I knew how to capture the status 6.

Unfortunately, we do not provide such code examples, you have to implement it yourself.

Thanks for the reply, I think I may have it figured out by having the app.js sending a postmessage to the parent window of the iframe and then capturing that as a variable.

This will work for now.

Alright, you are welcome