Move api call to messages into right place