15.10.2019, 01:24
(This post was last modified: 15.10.2019, 01:25 by cuong.nguyen@vis.solutions.)
(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
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
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))