buildMessage should only add metadata if there are metadata keys