I guess that the part you are missing is how to fetch the sender number from the received message.
So you need something like
:local senderNumber [tool sms inbox get [find message~“a regexp to check that it is the expected query message, not a spam”] number]
and then you can send the response, using $senderNumber:
/tool sms send phone-number=$senderNumber message=“the response” …
Having no 3G modem at hand, I cannot check it, so I hope it is sufficient like this. However, a script for actual deployment would have to use a foreach cycle to create a snapshot of the list of received messages and process it regardless whether some further SMS eventually arrive during the processing.
/tool sms {
:foreach msg in=[inbox find] do={
:if ([inbox get $msg message]~"regexp") do={
:local senderNumber [inbox get $msg phone]
send phone-number=$senderNumber message="it works"
}
inbox remove $msg
}
}
/