Sending SMS

Posted on
Mon Mar 28, 2016 6:44 am
Asconasny offline
Posts: 161
Joined: Jan 16, 2015

Sending SMS

Hi
I want to receive a sms when a trigger runs.
Is there a easy way make a action sending this url?

https://telenormobil.no/smapi/3/sms?sen ... ESTMESSAGE

When i edit this url with my phone number and paste it in the web browser i receive a sms.

Regards
Asconasny

Posted on
Mon Mar 28, 2016 7:38 am
MarcoGT offline
Posts: 1091
Joined: Sep 11, 2014
Location: Germany

Re: Sending SMS

Well, maybe I misunderstood, but it would be enough with AppleScript to open this URL, something like:

Code: Select all
tell application "Safari"
    open location "https://telenormobil.no/smapi/3/sms?sender=PHONENUMBER&password=s4653r&recipients=PhonenumbersId=1000000000&content=TESTMESSAGE"
    activate
end tell

Posted on
Mon Mar 28, 2016 8:02 am
Asconasny offline
Posts: 161
Joined: Jan 16, 2015

Re: Sending SMS

thanks!!

Spot on.
Something like this i was looking for.
and it works :)

regards
Asconasny

Posted on
Mon Mar 28, 2016 3:58 pm
DaveL17 offline
User avatar
Posts: 6741
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Sending SMS

If you wanted to stay within Indigo (not use a call to an outside process like Safari), you could do it easily with a Python script. Something like this should work:

Code: Select all
#! /usr/bin/env python2.6
# -*- coding: utf-8 -*-

import urllib2

URL = 'https://telenormobil.no/smapi/3/sms?sender=PHONENUMBER&password=s4653r&recipients=PhonenumbersId=1000000000&content=TESTMESSAGE'
response = urllib2.urlopen(URL)
response_text = response.read()
indigo.server.log(response_text)

The last line will print the response from the server to the Indigo log. If it's verbose, you can delete the last line, but you might want to know what happens in case of a failed send.

Dave

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Tue Mar 29, 2016 3:44 am
Asconasny offline
Posts: 161
Joined: Jan 16, 2015

Re: Sending SMS

Dave

I think it will be best to stay within Indigo but i get error using the script..

Script Error embedded script: <urlopen error [Errno 54] Connection reset by peer>
Script Error Exception Traceback (most recent call shown last):

embedded script, line 8, at top level
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py", line 126, in urlopen
return _opener.open(url, data, timeout)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py", line 391, in open
response = self._open(req, data)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py", line 409, in _open
'_open', req)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py", line 369, in _call_chain
result = func(*args)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py", line 1189, in https_open
return self.do_open(httplib.HTTPSConnection, req)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py", line 1156, in do_open
raise URLError(err)
URLError: <urlopen error [Errno 54] Connection reset by peer>

Posted on
Tue Mar 29, 2016 5:53 am
DaveL17 offline
User avatar
Posts: 6741
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Sending SMS

Do me a solid and try to run this one in its place:

Code: Select all
#! /usr/bin/env python2.6
# -*- coding: utf-8 -*-

import urllib2

URL = 'http://www.indigodomo.com'
response = urllib2.urlopen(URL)
response_text = response.read()
print(response_text)

If it works, the problem you're seeing might be related to cookies or authentication required by the telenormobil website (which makes a fair bit of sense for your own protection.)

Let me know how you get on with the script above.

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Tue Mar 29, 2016 7:35 am
Asconasny offline
Posts: 161
Joined: Jan 16, 2015

Re: Sending SMS

Jupp,

Seems like its the telenormobil site. When i try the indigodomo it runs without errors.

anyway

thanks for the help.

regards
Asconasny

Posted on
Thu Mar 31, 2016 6:39 am
ryanbuckner offline
Posts: 1074
Joined: Oct 08, 2011
Location: Northern Virginia

Re: Sending SMS

Also, if you are using iMessage on your server:

Code: Select all
-- send iMessage
tell application "Messages"
   set myid to get id of first service
   set theBuddy to buddy "+1555MYPHONE" of service id myid
   send "https://telenormobil.no/smapi/3/sms?sender=PHONENUMBER&password=s4653r&recipients=PhonenumbersId=1000000000&content=TESTMESSAGE'
" to theBuddy
end tell

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 4 guests