This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

SMS - Twilio
#13
(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:
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
Thank you so much
Reply


Messages In This Thread
SMS - Twilio - by Fahd - 02.08.2022, 06:24
RE: SMS - Twilio - by admin - 02.08.2022, 07:47
RE: SMS - Twilio - by Fahd - 02.08.2022, 08:23
RE: SMS - Twilio - by admin - 02.08.2022, 08:41
RE: SMS - Twilio - by Fahd - 02.08.2022, 09:53
RE: SMS - Twilio - by admin - 02.08.2022, 09:57
RE: SMS - Twilio - by Fahd - 02.08.2022, 10:18
RE: SMS - Twilio - by admin - 02.08.2022, 10:37
RE: SMS - Twilio - by Fahd - 02.08.2022, 10:54
RE: SMS - Twilio - by admin - 02.08.2022, 11:38
RE: SMS - Twilio - by Fahd - 02.08.2022, 11:46
RE: SMS - Twilio - by admin - 02.08.2022, 12:05
RE: SMS - Twilio - by Fahd - 02.08.2022, 12:23

Forum Jump: