A simple fix would be to replace any single-quote with the Postgresql-friendly doubled single quote SELECT insert_data('I''m here'); (see ex below) but I wonder if there's a.... better way of solving more cases of user-input that could break this. So I asked on StackOverflow
Discovered this with some feedback from a fork of this. From https://github.com/mentalhealthawhereness/map/issues/1