Connect MIkrotik to Shelly AP device

Hello I try to make script to automate putting shelly devices in network. But I have trouble to connect them.

 
foreach i in=([/interface wifi scan wifi1 duration=5 as-value]) do={if (($i->"ssid")~"Shelly" and ($i->"security")="None")
do={ / connect to $i->"ssid" } // searching how to do that
 do={ /tool fetch url="http://192.168.33.1/rpc/WiFi.SetConfig?config={\"sta\":{\"ssid\":"Shelly 3\",\"pass\":\"12345678",\"enable\":true}}" }

i use Lte6 MIkrotik router with os 7.14 stable on it.