All you need to do is a create a rule.
When setting up, select “receiving SMS”.
You can select to assign customer who only send SMS to Shared Numbers or a particular dedicated number of yours. If you want to assign contacts to different groups regardless of the number they are being sent to, pick “Any Number”.
You can then enter as many keywords as you please if you only want to assign customers depending on the keyword(s) contained in the message. If you would like all incoming SMS contacts to be assigned to your groups of choice regardless of keywords, leave these boxes blank.
Go to the next step, and select “Assign contact to following group(s)”.
A box will display. Start typing (or select from the auto-complete list) the group(s) you’d like to assign the contacts to. Remember to separate them with a comma.
Click Save Rule and… Voila! All inbound messages that meet these conditions will be assigned to the groups of your choice!