add pagination feature to message API