Added function to return a json list of messages with a given cid