What are envelopes in my friends' towns for?

Envelopes are bonuses you get for visiting and helping your friends. Every time you help a friend, you gain reputation points, and when you reach a certain amount of them, you achieve new reputation level. Every level of reputation increases the amount of prizes you receive for visiting friends, as well as the size of the additional reward for your friend’s profession when you take them with you to explore a room. You can see your profession by tapping on your name in the left upper corner under the experience bar.