encode/decode so i can save received messages