If you are using a trial account then you can only send test messages to your own phone number. To send messages to other phone numbers you need a paid account.
(02.08.2022, 09:57)admin Wrote: If you are using a trial account then you can only send test messages to your own phone number. To send messages to other phone numbers you need a paid account.
Yes I know and I didn't update yet, so numbers 1,2,3 are the same number and the script sends only one SMS instead of 3
As I told you the 3 numbers are the same (till now I will change it the I update the account), I can send the message 3 times if copy and past the code in below 3 times with the same number but it didn't work with the loop for
from_nr = '+13253264263' -- put sender SIM nr here
to_nr = '' -- put recepient SIM nr here
id_nr = '' -- put your ID here
token_nr = '' -- put your token here
sms(id_nr, token_nr, from_nr, to_nr, 'Alarm HCWC 009 changed to Alarm OFF')
(02.08.2022, 11:38)admin Wrote: Post your whole script with the for loop. There's should not be any difference between the loop and copy/pasted multiple sms function calls.
Code:
123456789101112131415161718192021
value = event.getvalue()
ifvaluethenfrom_nr = '+****'to_nrs = { '+***', '+***', '+***' }
id_nr = '***'-- put your ID heretoken_nr = '***'-- put your token herefor_, to_nrinipairs(to_nrs) dosms(id_nr, token_nr, from_nr, to_nr, 'Alarm HCWC 009 changed to Alarm ON')
endelsefrom_nr = '+****'to_nrs = { '+***', '+***', '+***' }
id_nr = '***'-- put your ID heretoken_nr = '***'-- put your token herefor_, to_nrinipairs(to_nrs) dosms(id_nr, token_nr, from_nr, to_nr, 'Alarm HCWC 009 changed to Alarm OFF')
endend
This might happen because you are sending a message with the same text. Twilio accepts the message but then fails with "Unknown error"/undelivered. If you log the Twilio response you can check the message status in your browser by accessing https://api.twilio.com/2010-04-01/Accoun...GE_ID.json ("uri" part of the returned JSON by Twilio). Use your id/token as username/password.
Your script can be optimized like this:
Code:
1234567891011121314
value = event.getvalue()
ifvaluethentext = 'Alarm HCWC 009 changed to Alarm ON'elsetext = 'Alarm HCWC 009 changed to Alarm OFF'endfrom_nr = '+***'to_nrs = { '+***', '+***', '+***' }
id_nr = '***'-- put your ID heretoken_nr = '***'-- put your token herefor_, to_nrinipairs(to_nrs) dosms(id_nr, token_nr, from_nr, to_nr, text)
end
(02.08.2022, 12:05)admin Wrote: This might happen because you are sending a message with the same text. Twilio accepts the message but then fails with "Unknown error"/undelivered. If you log the Twilio response you can check the message status in your browser by accessing https://api.twilio.com/2010-04-01/Accoun...GE_ID.json ("uri" part of the returned JSON by Twilio). Use your id/token as username/password.
Your script can be optimized like this:
Code:
1234567891011121314
value = event.getvalue()
ifvaluethentext = 'Alarm HCWC 009 changed to Alarm ON'elsetext = 'Alarm HCWC 009 changed to Alarm OFF'endfrom_nr = '+***'to_nrs = { '+***', '+***', '+***' }
id_nr = '***'-- put your ID heretoken_nr = '***'-- put your token herefor_, to_nrinipairs(to_nrs) dosms(id_nr, token_nr, from_nr, to_nr, text)
end