I know this is a little old, but here is one way to approach this.
Create a webhook endpoint on the server, then use a websocket to push messages to the frontend.
Register the buttons with the database, giving them a UUID.
Split the API route based on button actions, passing the button's UUID as the parameter.
Assign the URL as an action to the botton, i.e. ".../button/action/uuid
Hope that helps