updated api requests to respond via onMessage