Call RPG Maker functions from DOM Element outside game

Hello !
I was wondering if I could trigger some game event from a DOM element whitch is "outside" of the game itself.

Here's an exemple :

1521748184-exemple.png

My game will only run in a web browser, I would like to have a text input and a send button to send some text to the game and display it with $gameMessage.add(text_that_have_been_written_inside_input);

Any suggestions ? ☺️
You might be able to study this plugin for some insight.
https://forums.rpgmakerweb.com/index.php?threads/keyboard-input-dialog.66908/

It's not exactly what you describe, but there are some similarities.
All of MVs code is in global scope so you can use MVs code from anywhere on the same page. For your send button simply put $gameMessage.add() for the buttons action.
It works great thank you !
Now is there a way to call a plugin command the same way ? I don't think that plugins commands are exposed to global scope, so there must be a way to call a plugin command via a core game function right ?

EDIT :
Did it !

All I had to do was to do was to inject Game_Interpreter into my page script like so :
HTML:
<script>
var $gameInterp = new Game_Interpreter();

function test() {
  // Call TTK Message plus plugin function
  $gameInterp.pluginCommand('MessagePlus', 'setBallon 1'.split(" "));

  // show bubble
  $gameMessage.add('test');
}

</script>

Then I call test() on click on a button element inside index.html

Original thread: https://forums.rpgmakerweb.com/threads/call-rpg-maker-functions-from-dom-element-outside-game.93059/