02.08.2022, 12:05
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:
Your script can be optimized like this:
Code:
value = event.getvalue()
if value then
text = 'Alarm HCWC 009 changed to Alarm ON'
else
text = 'Alarm HCWC 009 changed to Alarm OFF'
end
from_nr = '+***'
to_nrs = { '+***', '+***', '+***' }
id_nr = '***' -- put your ID here
token_nr = '***' -- put your token here
for _, to_nr in ipairs(to_nrs) do
sms(id_nr, token_nr, from_nr, to_nr, text)
end