[SOLVED]iPhone iMessages / SMS

Posted on
Sun Dec 01, 2013 10:59 am
evansgo offline
Posts: 223
Joined: Nov 29, 2013

[SOLVED]iPhone iMessages / SMS

Sorry, I'm sure that this is obvious, but I am learning!

I'm trying to set up a notification to my iPhone using either SMS messaging or iMessage, and seen loads of posts about it, but I just cannot get it to work.
I tried an applescript, but it gave an error saying that it could not send to my own phone!

Can someone point me in the right direction?

Thanks
Gareth

Posted on
Sun Dec 01, 2013 12:14 pm
Seeker offline
Posts: 440
Joined: Aug 05, 2013

Re: iPhone iMessages / SMS

I do it by executing applescript as follows:

Code: Select all
tell application "Messages"

set theBuddy to buddy "+12345678900" of service id "xxxx-xxxx-xxxx"

send "hi there" to theBuddy

end tell


I can't remember how to get your phone's service ID, but this script works.

Posted on
Sun Dec 01, 2013 5:28 pm
matt (support) offline
Site Admin
User avatar
Posts: 21420
Joined: Jan 27, 2003
Location: Texas

Re: iPhone iMessages / SMS

Or you can just send an email to your provider's SMS email gateway.

Image

Posted on
Mon Dec 02, 2013 9:48 am
evansgo offline
Posts: 223
Joined: Nov 29, 2013

Re: iPhone iMessages / SMS

Matt,
Not so easy when you live in Cyprus, our SP has only just got SMS, let alone email to SMS! ;)

Seeker,
Thanks, that is 99% what I needed (it also sends my Mac the messages, but I suppose that is to be expected as its the same account)

BTW the missing bit of ID can be found by running :-

tell application "Messages"
get every service
end tell

Thanks all.

Posted on
Mon Dec 02, 2013 10:12 am
evansgo offline
Posts: 223
Joined: Nov 29, 2013

Re: iPhone iMessages / SMS

Sorry to reply to my own message, but I have found that my SP does have a Web SMS Api, they have a few examples, none of which means much to me, does anyone know if I can use them?

<websmsapi>
<version>1.0</version>
<username>Indigo</username>
<secretkey>xxxxxxxxxxxxxxxx</secretkey>
<recipients>
<count>1</count>
<mobiles>
<m>99xxxxxx</m>
</mobiles>
</recipients>
<message>Hello from cytamobile-vodafone web sms API</message>
<language>en</language>
</websmsapi>


Or

C#
string SmsMessage = "ΓΕΙΑ ΣΑΣ ΑΠΟ ΤΟ cyta web sms API";
string XmlValidSmsMessage = System.Security.SecurityElement.Escape(SmsMessage);
string PostData = null;
PostData = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?> " +
"<websmsapi>" +
" <version>1.0</version>" +
" <username>SomeUser</username>" +
" <secretkey>xxxxxxxxxxxxxxxxxxxxxxx</secretkey>" +
" <recipients>" +
"</websmsapi>";
byte[] PostDataBuffer = null;
<count>3</count>" +
<mobiles>" +
"
"
"
"
"
"
" </recipients>" +
" <message>" + XmlValidSmsMessage + "</message>" +
" <language>el</language>" +
<m>9xxxxxx1</m>" +
<m>9xxxxxx2</m>" +
<m>9xxxxxx3</m>" +
</mobiles>" +
PostDataBuffer = System.Text.Encoding.UTF8.GetBytes(PostData);
System.Net.WebRequest SendSmsRequest = null;
SendSmsRequest = System.Net.WebRequest.Create("https://www.cyta.com.cy/cytamobilevodafone/dev/websmsapi/sendsms.aspx");
SendSmsRequest.Method = "POST";
SendSmsRequest.ContentType = "application/xml; charset=utf-8";
//by writting to the Stream the Content-Length is automatically set
using (System.IO.Stream Writer = SendSmsRequest.GetRequestStream())
{
}
Writer.Write(PostDataBuffer, 0, PostDataBuffer.Length);
Writer.Flush();
string SendSmsResponseData = string.Empty;
System.Net.WebResponse SendSmsResponse = SendSmsRequest.GetResponse();
using (System.IO.StreamReader Reader = new System.IO.StreamReader(SendSmsResponse.GetResponseStream(), System.Text.Encoding.UTF8))
{
}
SendSmsResponseData = Reader.ReadToEnd();

Posted on
Mon Dec 02, 2013 11:55 am
RogueProeliator offline
User avatar
Posts: 2501
Joined: Nov 13, 2012
Location: Baton Rouge, LA

Re: iPhone iMessages / SMS

This seems to be a straight-forward POST operation -- so you could duplicate this with (preferably) Python and most likely AppleScript. If you do not have any Python experience, or don't want to take on the task of getting it to work, search the forum for "curl" and you will find some examples of how to call curl from AppleScript.

That should get you started, but there should be plenty of help here if you get stuck...

Adam

Posted on
Sat Dec 21, 2013 12:21 pm
jenwill1 offline
Posts: 185
Joined: Mar 22, 2009
Location: Boerne, Texas

Re: iPhone iMessages / SMS

Guys,

Trying to repair my SMS messaging scripts since changing computers and moving to 10.9 Mavericks....

This is the script I'm trying to use.....

tell application "Messages"
send "Front Door is Unlocked" to buddy "William Hill"
end tell

I'm getting an error that says "Can't send a message to yourself."

Any suggestions ?

Thanks

Posted on
Tue Mar 04, 2014 9:10 pm
RufusFirefly offline
Posts: 8
Joined: Dec 04, 2013

Re: iPhone iMessages / SMS

Sounds like the computer you are running Indigo on is signed in to the same iCloud account as your iPhone. I had the same problem. I just created a new Apple ID for the computer and singed it into that account.

Hope it works for you .....

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest