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.

Help me! Notification SMS from LM using Twilio service
#7
(11.10.2019, 06:52)admin Wrote: You have swapped from/to fields. It should be:
Code:
sms(id_nr, token_nr, from_nr, to_nr, 'Test SMS by SL'..tostring(value))

Same trouble Sad

My Common Funtions:
Code:
--SMS by Twilio
function sms(id, token, from, to, body)
  local escape = require('socket.url').escape
  local request = require('ssl.https').request
  local url = string.format('https://%s:%s@api.twilio.com/2010-04-01/Accounts/%s/Messages.json', id, token, id)
  local body = string.format('From=%s&To=%s&Body=%s', escape(from), escape(to), escape(body))

  return request(url, body)
end
My Event:
Code:
value = event.getvalue()

from_nr = '+19177461563' -- put sender SIM nr here
to_nr = '+84938354162' -- 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, 'Test SMS by SL'..tostring(value))
Reply


Messages In This Thread
RE: Help me! Notification SMS from LM using Twilio service - by cuong.nguyen@vis.solutions - 15.10.2019, 01:24

Forum Jump: