Best Practices for Associating Images with Backend Artifacts in OnlyOffice

Description:
In our application, we handle DOCX documents that contain PNG images representing BPMN diagrams. A single document can contain multiple BPMN diagrams. In our backend, we store and track each diagram as an artifact in our database.

We also have a BPMN diagram editor where we want users to be able to edit these diagrams and insert the updated version back into the document using the OnlyOffice API.

Problem:

To enable users to edit the correct diagram, we need a way to associate backend artifact data with the actual image inside the document. Our goal is to allow users to right-click on an image, select a custom context menu item (e.g., “Edit BPMN Diagram”), and then fetch the correct XML string content from the backend to open in the editor.

Questions:

  1. How can we reliably associate an image in the DOCX with our backend artifact data?
  2. Is there a recommended approach to track images inside the document and map them to our backend artifacts?
  3. One idea: Since images in OnlyOffice seem to have an alternative text field, we could store a unique artifact ID in this field when inserting the image. Then, if there is a way to filter or retrieve images by alternative text, we could use it to map the selected image to its corresponding backend artifact. Would this be a viable approach? If yes can you point me to the right APIs?
  4. Are there other OnlyOffice APIs or best practices for embedding metadata into images to maintain this association?

Thanks!