replace messages with tokens