Registering interactions with UI in Adobe XD

Is there a way to register an interaction within a Adobe XD document?

For example if a user presses a button, can we send a response to an external server notifying that that event happened?

Reading the Adobe XD plugin documents it seems that most API’s are used for read only.

Any help appreciated and maybe pointers on what’s needed (websockets etc)

Yes, XD plugins can make external network requests using Web standards:
https://www.adobe.io/xd/uxp/develop/reference/uxp/network-index/
Here is an example plugin to illustrate:

As to how to trigger network calls, plugins can respond to a variety of events in the plugin’s panel, including clicking a button:
https://www.adobe.io/xd/uxp/develop/reference/uxp/events-index/#click
Additionally there is an update() callback that triggers whenever the user makes a change to the document:
https://www.adobe.io/xd/uxp/develop/reference/ui/panels/update/