[Web Hooks] A quick test == Awesome!

313 views
Skip to first unread message

tarwin

unread,
May 5, 2010, 4:32:54 AM5/5/10
to WebHooks
Hi,

I saw what you guys were doing after reading about it on FreshBooks. I
was really confused as to what you were doing and what all the fuss
was about but after watching 15 mins of the presentation I managed to
(while still watching) sham together a really quick test using the
MailHooks application and a simple PHP file.

For those who are really impatient I see it as this. You set up a
callback that hits a URL with POST information. What that post
information is depends on the service that's doing the callback.

I set up a quick MailHooks example which pointed to this PHP script
(make sure you have a log.txt file in the same directory):

<?
$fh = fopen("log.txt", 'w') or die("can't open file");

$s = "";
foreach($_REQUEST as $k=>$v)
{
$s .= "$k\n-----\n$v\n-----\n\n";
}

fwrite($fh, $s);
fclose($fh);
?>

Just a super simple way to make sure it all works. I'm really excited
to start using this in FreshBooks (or whoever starts to implement it).

--
You received this message because you are subscribed to the Google Groups "WebHooks" group.
To post to this group, send email to webh...@googlegroups.com.
To unsubscribe from this group, send email to webhooks+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/webhooks?hl=en.

Jeff Lindsay

unread,
May 5, 2010, 1:42:17 PM5/5/10
to webh...@googlegroups.com
Also take a look at PostBin... it's a service that does mostly what your PHP script does:

--
Jeff Lindsay
http://progrium.com

Derek Scruggs

unread,
May 5, 2010, 1:53:46 PM5/5/10
to webh...@googlegroups.com
Shameless self-promotion: we at SurveyGizmo have something similar called HTTP POST.

http://www.surveygizmo.com/survey-blog/communicate-external-database-http-post/

We don't call it Webhooks, but I'll add that to the tutorial. The one downside with ours is there's not queuing mechanism for when your web service is down, but you can re-run them manually after the fact. Note that in our case the post is inline with a survey, not a notification survey, so the user is interacting with it in real time.

We use this mechanism to power our API developer key form at http://www.surveygizmo.com/contact/ - when someone fills out the form, it posts the data to another system that processes the request, then returns the results as HTML for display in the survey.

And BTW +1 for Postbin - I used it when creating the dev key process.

-Derek

Jeff Lindsay

unread,
May 5, 2010, 1:57:27 PM5/5/10
to webh...@googlegroups.com
Yeah, I've been including SurveyGizmo in my presentations. :)

You might want to look into Hookah or Andy Kent's Deliverable. That would help making your POSTs async and includes retries, etc.
--
Jeff Lindsay
http://progrium.com

Charl van Niekerk

unread,
May 5, 2010, 3:11:13 PM5/5/10
to webh...@googlegroups.com
Hi Tarwin,

A really simple PHP script I sometimes use goes along the lines of this:

<?php file_put_contents('test.txt', file_get_contents('php://input'));

Cool for testing anything as it saves the raw postdata, especially if
it's JSON.

Just make sure test.txt is writable by your Apache/whatever user of
course.

Postbin is usually handier for testing the provider but it's nice to run
this on your consumer to make sure it receives everything in order.

Paul Osman

unread,
May 5, 2010, 2:25:57 PM5/5/10
to webh...@googlegroups.com
Another +1 on using postbin.org. I always referred it to devs using
the FreshBooks WebHooks implementation to debug their
applications. You can even supply a passthrough callback which will
have postbin "intercept" the request and forward it on to your
application, essentially it's logging:

http://blog.webhooks.org/2009/04/27/postbin-now-supports-passthrough-callback/

--
Paul Osman
http://eval.ca
> > webhooks+u...@googlegroups.com<webhooks%2Bunsu...@googlegroups.com>
> > .

Jeff Lindsay

unread,
May 5, 2010, 4:44:22 PM5/5/10
to webh...@googlegroups.com
Yes. Also, PostBin is about to get a lot of love because I'm paid to work on it. 

FYI its open source (Python), so anybody feel free to make contributions.
--
Jeff Lindsay
http://progrium.com

Paul Osman

unread,
May 5, 2010, 4:46:21 PM5/5/10
to webh...@googlegroups.com
Nice :-)

Any plans to move it away from Google App engine and towards something
more generic / hosting provider agnostic?
> > <webhooks%2Bunsu...@googlegroups.com<webhooks%252Buns...@googlegroups.com>
> > >
> > > > .
> > > > For more options, visit this group at
> > > > http://groups.google.com/group/webhooks?hl=en.
> > > >
> > > >
> > >
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > "WebHooks" group.
> > > To post to this group, send email to webh...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > webhooks+u...@googlegroups.com<webhooks%2Bunsu...@googlegroups.com>
> > .
> > > For more options, visit this group at
> > http://groups.google.com/group/webhooks?hl=en.
> > >
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "WebHooks" group.
> > To post to this group, send email to webh...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > webhooks+u...@googlegroups.com<webhooks%2Bunsu...@googlegroups.com>
> > .
> > For more options, visit this group at
> > http://groups.google.com/group/webhooks?hl=en.
> >
> >
>
>
> --
> Jeff Lindsay
> http://progrium.com
>
> --
> You received this message because you are subscribed to the Google Groups "WebHooks" group.
> To post to this group, send email to webh...@googlegroups.com.
> To unsubscribe from this group, send email to webhooks+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/webhooks?hl=en.
>

--
Paul Osman
http://eval.ca

Jeff Lindsay

unread,
May 5, 2010, 4:57:28 PM5/5/10
to webh...@googlegroups.com
Any plans to move it away from Google App engine and towards something more generic / hosting provider agnostic?

Nope. What's the benefit of that? Accessible to more developers? Or something else? Ideally I'd like a POSS-compatible platform.

-jeff

On Wed, May 5, 2010 at 1:46 PM, Paul Osman <pa...@eval.ca> wrote:
Nice :-)

Paul Osman

unread,
May 5, 2010, 5:05:22 PM5/5/10
to webh...@googlegroups.com
On Wed, May 05, 2010 at 01:57:28PM -0700, Jeff Lindsay wrote:
> >
> > Any plans to move it away from Google App engine and towards something more
> > generic / hosting provider agnostic?
>
>
> Nope. What's the benefit of that? Accessible to more developers? Or
> something else? Ideally I'd like a POSS-compatible platform.
>
> -jeff

Accessibility / familiarity is what I was thinking. Having it built on
a framework like Pylons, Bottle, Django, etc might encourage more
people to hack on it, and would give people the option to host it
themselves if they wanted. I had that request for instance from QA
folks I was working with. I know that you can run a Google App engine
test server, but that's not ideal... it'd be nice to be able to deploy
it along side other Python webapps.

Cheers,
-Paul
> > > > <webhooks%2Bunsu...@googlegroups.com<webhooks%252Buns...@googlegroups.com>
> > <webhooks%252Buns...@googlegroups.com<webhooks%25252Bun...@googlegroups.com>
> > > Jeff Lindsay
> > > http://progrium.com
> > >
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > "WebHooks" group.
> > > To post to this group, send email to webh...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > webhooks+u...@googlegroups.com<webhooks%2Bunsu...@googlegroups.com>
> > .
> > > For more options, visit this group at
> > http://groups.google.com/group/webhooks?hl=en.
> > >
> >
> > --

Jeff Lindsay

unread,
May 5, 2010, 5:22:56 PM5/5/10
to webh...@googlegroups.com
WELL, it *is* possible to make it use various configurable components. It's already using the equivalent of web.py and Django templates, then there's the Model which is simple enough to abstract. Then it's a matter of configuring imports etc. 

However, given that anybody can deploy and App Engine app, and you can use the SDK emulator anywhere, and there are open source App Engine implementations (at least 2), the work involved doesn't seem worth it ... yet. 

Jeff Lindsay

unread,
May 5, 2010, 5:24:00 PM5/5/10
to webh...@googlegroups.com
However, I don't want this to lead to all kinds forks and/or new projects that do the same thing on different platforms. If there is actually enough demand, we can work towards making PostBin work on different Python platforms.

Jeff Lindsay

unread,
May 5, 2010, 5:27:25 PM5/5/10
to webh...@googlegroups.com
Also, there are other alternatives. I'm working on something called localtunnel that gives you a temporary public URL that proxies to a port on your local machine, allowing you to run a web server locally that is accessible on the Internet. You could easily run netcat or PostBin on SDK through this. But the primary use case really doesn't need a separate deployment. Maybe I don't understand the use case for these situations.

As far as accessibility -- everybody should get familiar with App Engine anyway. :P

-jeff

Charl van Niekerk

unread,
May 5, 2010, 6:07:28 PM5/5/10
to webh...@googlegroups.com
On Wed, 2010-05-05 at 13:57 -0700, Jeff Lindsay wrote:
> Nope. What's the benefit of that? Accessible to more developers? Or
> something else? Ideally I'd like a POSS-compatible platform.

+1 for staying on App Engine, it's simple enough for anybody to register
an account on GAE and run their own instance (if for whatever reason
they feel the need to) and you don't even need a credit card like on
AWS, and if you want to host it yourself you can use something like
AppScale.

Charl van Niekerk

unread,
May 5, 2010, 6:16:34 PM5/5/10
to webh...@googlegroups.com
On Wed, 2010-05-05 at 17:05 -0400, Paul Osman wrote:
> Accessibility / familiarity is what I was thinking. Having it built on
> a framework like Pylons, Bottle, Django, etc might encourage more
> people to hack on it, and would give people the option to host it
> themselves if they wanted. I had that request for instance from QA
> folks I was working with. I know that you can run a Google App engine
> test server, but that's not ideal... it'd be nice to be able to deploy
> it along side other Python webapps.

This might be subjective but I've seen a huge amount of development on
GAE the last year. Personally I don't feel it's such an arcane platform,
fairly simple straight-forward WSGI-derivative, but as I said, highly
subjective...

Paul Osman

unread,
May 5, 2010, 8:37:26 PM5/5/10
to webh...@googlegroups.com
On Thu, May 06, 2010 at 12:16:34AM +0200, Charl van Niekerk wrote:
> On Wed, 2010-05-05 at 17:05 -0400, Paul Osman wrote:
> > Accessibility / familiarity is what I was thinking. Having it built on
> > a framework like Pylons, Bottle, Django, etc might encourage more
> > people to hack on it, and would give people the option to host it
> > themselves if they wanted. I had that request for instance from QA
> > folks I was working with. I know that you can run a Google App engine
> > test server, but that's not ideal... it'd be nice to be able to deploy
> > it along side other Python webapps.
>
> This might be subjective but I've seen a huge amount of development on
> GAE the last year. Personally I don't feel it's such an arcane platform,
> fairly simple straight-forward WSGI-derivative, but as I said, highly
> subjective...

Yeah, come to think of it, it's all pretty subjective. I think it
comes back to demand, like was mentioned in another response. If
there's no demand, it's probably not worth doing.

--
Paul Osman
http://eval.ca

tarwin

unread,
May 6, 2010, 12:13:54 AM5/6/10
to WebHooks
Yeah, I saw pastebin later in the presentation. Again, thanks for the
info.
Reply all
Reply to author
Forward
0 new messages