I used http://chessforeva.blogspot.com/2010/10/unity3d-chess-project.html as a starting point for my MacOS, iOS, Android, Windows Chess App/Game a few years back.
It uses algebraic notation using FEN and the meat and potatoes of what you want to do are in c0_4unity_chess.js, and Scriptings.js. Also StockFishCall.js, under the Update() function you will see a similar to GetBestMove() function above, like Ruzihm mentioned using ProcessLineIN() for "bestmove".
In the c0_4unity_chess.js script, there are functions called c0_get_FEN(), c0_put_to_PGN(), and set_pos() which should help point you in the right direction.
Update: https://chessforeva.gitlab.io/
There's the gitlab.io link.