Update token function and add message converter
Add test cases