Adding new buttons to ExternalLinkActions

I’m currently trying to write my first Nextcloud plugin. It should talk to a YOURLS or Polr instance to shorten the shared nextcloud url. Now I need to add a new option to the ExternalLinkActions list. The javascript function registerAction currently only supports setting a url, to which the user is redirected (inspired by: https://github.com/nextcloud/socialsharing/blob/master/socialsharing_twitter/js/socialsharingtwitter.js#L24). But I want to execute a AJAX POST query to one of my app routes to receive the shortened link so that the user can copy it.

So my problem is that I don’t know how to add a new button to the share panel of the file sharing app, that is capable of doing ajax calls. Also I dont’ have a clue how to add a text field where the shortened link can be copied out of.

It would be nice if someone knows how to do that. Thanks and have some nice hollidays :slight_smile: