Parsing sms mesasge and forwarding

Hello!
I just got mikrotik router os 6.41. And i need to make a script that parses Recieved SMS messages. Any advice how to do it?
Because my “attemts” have failed miserably.
:global emessage [/tool sms inbox print detail where message=f]

/tool sms send usb3 xxxxxxxxxxx message=$emessage