Enhancing my checkpoint SMS task / URL shortening

121 views
Skip to first unread message

Dave

unread,
Jul 25, 2010, 2:47:06 PM7/25/10
to Tasker
My task worked flawlessly, thank you. There was a luser error, where
I cloned a context, then updated the task, thereby updating the source
task and sending the wrong message. BUT, that was my fault. Tasker
itself worked great.

But now I want to enhance it for next time. I noticed that my Twitter
client, Peep, used the is.gd URL shortening service to link to a map.
It took my location, and created a Google Maps link:

http://maps.google.com/maps?q=39.299200773239136,-95.71948885917664

Then it submitted that link to is.gd to get:

http://is.gd/dEut5

I note from this page ( http://is.gd/api_info.php ) the technique...

****
Submitting a URL to be shortened

Simply have your application access a URL similar to the following,
via an HTTP GET request: http://is.gd/api.php?longurl=http://www.example.com

The "http://www.example.com" parameter in the example above may be
replaced by whatever URL you wish to shorten. The http:// protocol
specifier is optional (if you don't specify any protocol, HTTP will be
assumed and added automatically).

Receiving the shortened URL

After submitting the URL you would like shortened as specified above,
an HTTP response (web page) will be returned. The response header will
be "HTTP/1.1 200 OK" if the URL was shortened as expected, or "HTTP/
1.1 500 Internal Server Error" if there was any problem that prevented
this.

Assuming the request was successful, the body of the response will
contain only the new shortened URL, in plain text. If the request was
unsuccessful, the body of the response will contain a specific error
message giving the reason. These always begin with "Error: " followed
by a message describing why the error occured. These should be fairly
self explanatory and include things like the URL being on our
blacklist or being too long (over 2000 characters).
***

I assume that Tasker can achieve this SEND/GET to allow URL
shortening. Or does it do URL shortening?

So, my intent would be to create a message like "I am now in Kansas!"
and to have the task automatically append the shortened URL to get "I
am now in Kansas! http://is.gd/dEut5"


Where would I look to learn to construct the URL to be shortened
"http://maps.google.com/maps?q=%LOC" , send that to is.gd, then
extract the short link to insert into the message?

I am open to any URL shortening. If I use bit.ly, I can keep track of
how many clicks the shortened URL receives.

Any help is appreciated!

Dave

Dave

unread,
Jul 26, 2010, 4:50:27 PM7/26/10
to Tasker


On Jul 25, 1:47 pm, Dave <hathaway.d...@gmail.com> wrote:

*snipped*

> Any help is appreciated!
>
> Dave

This was surprisingly simple to do with Tasker, at least in a simple
case. Here is the Task (the context is a location, in my case):

1. HTTP Get
Server:Port = 'is.gd/api.php?longurl=http://maps.google.com/maps?q=
%LOC'
Timeout = 10
Mime Type = text/plain

2. Send SMS
Number = 9188144042 (this is ping.fm)
Message = 'Hey, I am here %HTTPD'


In Step 2, %HTTPD contains the response from the is.gd server with the
shortened map URL.

Step 1 is what I want to reuse, like a subroutine. However, the task
seems to include Step 1. I need to figure out how to make Step 1 a
call to a subroutine (I call it GOOGMAP) so that it won't change
whenever I change the text in Step 2.

So that the 'Send IL' profile would be active at the IL border and
send 'I am crossing into IL, near %HTTPD' while the 'Send WI' would do
the same but with a Wisconsin - tailored message.

My very next step is to switch from is.gd to bit.ly so that I can
track clicks. I need to get an api key, etc, but the actual Step 1 is
nearly the same.

Dave
Reply all
Reply to author
Forward
0 new messages