How do I auto close "STOP" opt out messages?

After bulk marketing distributions, our Intercom instance gets flooded with incoming opt out messages (all read “STOP”). I want to set a rule to automatically close the tickets based on specific text contained in the message (e.g., if text = ‘stop’, then disposition=close).