In the messaging world, it is mostly used by marketing departments to communicate special promotional offers, last minute deals or changes in terms and conditions.
Often, the opt-in option is offered through zero rated short codes, meaning the customer can opt-in without any additional price per message. Opt-in is tightly connected with opt-out which is used so the customer can unsubscribe from the messages he receives.
The practice differs around the world and in some countries the opt-out function is a mandatory part of message text. At the end of a message, there are instructions on how to opt-out. Chat applications like Viber have an opt-out option for A2P messages at the top of the chat group.