Enlightment via blog-kata

WebHooks on AppJet

leave a comment »

Hi everybody,
I created a small lib-webhook library and a small companion hooks application for easy working with webhooks on AppJet. Like maybe you know, webhooks are one of the current hot topics. They are a very easy way to implement a real-time communications between remote applications.

What you can use it for:

  1. Notify your AppJet based application about changes (commits etc.) in your GitHub repository – have for example ChangeLog + user notifications to some ML:

    Just go to GitHub Admin|Hooks page and if the already defined hooks are not enough put there.

  2. Post to your AppJet based application by Jabber (XMPP) or from an iPhone:

    go to and enter http://youhooks.appjet/pingfm/SomeSecret/ . have a XMPP bot and an iPhone application which you can use.

  3. Post to your AppJet application by email: , define some email address and point the URL to In fact I’m first pointing it to one small application on GAE itself, because parsing multipart/rfc-822 coded message parameter will be difficult on AppJet. So I’m parsing it with message.get_payload() and repacking it in JSON payload. After this it can be send to AppJet.

  4. Posting to XMPP from AppJet – it still missing on AppJet, so I have a small Heroku-hosted Sinatra application to implement this feature. So will in turn call that Sinatra application. If you do not trust me with your XMPP information, just create your own application somewhere, where XMPP is possible and call it with a webhooks API (your_url, JSON(payload),JSON(data)).

How to use lib-webhook and hooks application:

  1. Clone the hooks application to (for example)
  2. Set your secret token – it will be added to the end of the URLs:
      // from the shell
      import ("storage", "lib-webhook");
      storage.token = "SomeSecret";
  3. Define users for the hooks, that needed them. I need for example user/password for the XMPP hook and user/key for the URL shortening service. In this way they will be not visible in your application sources.
    // from the shell
    HOOK.addUser("xmpp", {user:"...", password:"..."});

    In the moment my hooks application just inserting the user’s data with the same name as the hook, if such user exists:

    data = HOOK.addUserData(data, hook);

The library itself provide two main functions:

// universal caller - remote or local hooks:
string callH(url, JSON(payload), JSON(data));
// call local hooks by name
string callLocalH(name, payload, data);

The rest are just some small helpers for user’s data management.

I’ll be very happy to see clones of hooks application with some interesting webhooks ( for example also supporting webhooks. and by the way PayPal also wink ). And about lib-webhook – will add twitter, and maybe some others local hooks ASAP.

Let’s the source be with you.

Written by zhesto

23-Feb-2009 at 12:03 GMT+0900

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: