Publisher to ApiMessage and error handling