Any incoming message that you receive with a ‘STOP’ keyword will mark the Lead/Contact (Salesforce record) field ‘SMS Optout’ as true. You can also define Opt-out Keywords of your own in the General Settings of the App and use them as per your business use case.