Some favorite site feeds aggregated locally: iPhone Development RSS   Adobe Labs RSS   Macrumors RSS

Wednesday, July 22, 2009

Dynamic notification after posting

Wednesday, July 22, 2009    1 Comments

I just wasted a whole lot of time, and I'll tell you exactly what I did. As you may have read, I have set up dynamic Wave notifications - I can easily produce them without going to the Publisher Portal. And that's a really great and flexible thing. However it doesn't help me with Blogger so much, so here is what I did, and then what I undid.

I use Blogger to FTP to my site, and I have no way of explicitly calling a script of any kind once a successful publishing action takes place. This includes even pinging. If Blogger hosted, at least I would get pinging by default. Anyway, what to do?

This is the first, convoluted road I took, successfully. But I had to just say no.
  1. One can supply up to ten email addresses to have posts emailed to once published when using Blogger. This is the only trigger I could think of using. I can't see any other way to get a usable event. Okay, so I created an arcane email address on my site and used that to send new posts to.
  2. In Mail.app on OS X, one can create rules, and you can designate an AppleScript to run when an item matches the rule. This is pretty unique and quite useful.
  3. Have that script pull the Subject from the email as well as the contents of the email body for use later in the same script.
  4. Have Safari open to my form page already, and have the AppleScript use the subject and body of email and send it to the form in Safari and submit it.
Stupid. Really fragile and stupid. Did I say it's stupid? Yes I did, but it bears repeating. It works. But it's so taped together that I wanted to throw up in my mouth because I even spent so much time on it. The AppleScript was pretty interesting though I must admit, at least I learned a little something there.

Then I thought of another tactic that I could take using a simple Flash or AIR application (headless? maybe).
  1. Launch the application and have it read the contents of my RSS feed. Take an initial read of my RSS file.
  2. Have the application cycle ping that RSS file every 5 minutes or so and compare the previous read to the current, if it's different discern how many items are different, and then post notification(s) for each one (using data from the XML for each item to build the notification) to my server to then end up at Adobe's server for delivery.
That's a pretty decent solution, although it's still a hack to be honest. Perhaps I'll use this... but I wish that I could just be able to call a script from Blogger to begin with to make all of this really easy.

Labels: ,

 

Adobe Wave: Creating dynamic notifications (Broadcast, not using the Publisher Portal)

   0 Comments


The water is refreshing and with a little effort you can create a splash using Adobe Wave without the need of going to the Publisher Portal to get the job done (once it's set up properly).

This post assumes the use of PHP. Other technologies, you're on your own.

The first thing you'll need to do is to obtain an API token used for authentication. Adobe has provided a URL for you to use: https://id-wave.adobe.com/identity/1.0/auth/apitoken.xml.

Cool, now all you need to do is make a little form to POST to that URL and it will return XML back to you containing your token.

<form action=
"https://id-wave.adobe.com/identity/1.0/auth/apitoken.xml"
method="post">
<input type="text" name="username"/>
<input type="text" name="password"/>
<input type="submit" name="submit" id="submit" id="Submit"/>
</form>

I broke the form action line into 3 so it all fit correctly in a modern browser (the column gutter was clipping it). That was easy, you should get a really long string of characters that represents your token (if you entered your credentials correctly into the form). Now that you have your token, you can set up dynamic notifications.

Adobe supplied a samples folder of PHP scripts (zip file).

Upload those somewhere on your server or locally, whatever, and you'll want to edit that apiToken.php file. Where it has $api_token=''; you will want to replace that empty string with your actual token string. You shouldn't need to touch anything else in that file.

Now, to use that notification.php file you uploaded to create your notification, I made another form that contains my "topic" URI. It looks like this:

<form action="http://theURL/notification.php" method="post">
<input type="hidden" name="topic" value="company_XX/feed_XX/XX"/>
Message: <input type="text" name="message" id="message"/><br/>
Link: <input type="text" name="link" id="link"/><br/>
<input type="submit" name="submit" id="submit" id="Submit"/>
</form>

The magic sauce here is the hidden topic parameter sent to the notification.php file. This is the "topic" or the feed you wish to broadcast your notification to. You can get this from your Publisher Portal account for said feed.

Of note: You can also send along a thumbnail (in my case I have chosen not to because I have yet to see one of my notifications accompanied by a declared file I specified). It uses the name of "image" (base64 encoded image data of 40x40 preferred), as well as "imagetype" (of either "image/jpeg" or "image/png").

If you had many feeds, you could always slap the URIs into a drop down menu, or provide that UI in your Flash/Flex/etc.

Now, when you call that notification.php file correctly with your form (or perhaps with triggers you set up for your blog, your application, etc.), it communicates with Adobe and your notification is blasted. It works well.

I don't see a return notification other than I don't get an HTTP status error when it works. I could be overlooking something though.

So in short, this is how you can wire up dynamic notifications for your applications, your blog (posting, etc.), and more without having to visit the Wave Publisher Portal. If I missed something in this post, I apologize and will remedy it. I have gotten this to work all the time and it wasn't too hard to set up (some trial and error did take place however).

And yes, that wave image has free usage rights (thanks Google for adding that kind of detail in advanced image search).

Labels:

 

Adobe Wave integration here

   4 Comments

I have decided to try my hand at this Adobe Wave technology and I have integrated it here at my blog.

If this doesn't work, below the header above, near the search box you'll find the link to display/hide the installation badge.

When you click on the badge, if you have Wave installed, you'll add my channel and receive notifications from me. If you have the AIR runtime but not Wave, you'll get Wave and my channel. No AIR, you'll get all three.

This is a pretty interesting technology, kind of like a more focused Twitter.

You should give the technology a go (link to Wave on Labs), it's a lot of fun.

Labels: