webhooks - glue for the web
DESCRIPTION
Presentation for the 34th Ruby-Kansai meeting. Credits: some of the images inside are from the Jeff Lindsay's presentations "Web Hooks and the Programmable World of Tomorrow" and "Using Web Hooks" (see the presenter notes below the slides)TRANSCRIPT
![Page 1: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/1.jpg)
Webhooksglue for the Web
120 юни 2009, събота
![Page 2: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/2.jpg)
Who am I ?
• Name: Stoyan Zhekov
• Private: married, 3 kids (boys)
• Work: Software Engineer
• Contact: xmpp: //[email protected]
220 юни 2009, събота
![Page 3: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/3.jpg)
320 юни 2009, събота
![Page 4: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/4.jpg)
Today
• What is this talk about?
• What are webhooks?
• What can they do for me?
• Pros and cons
• Real life usage
420 юни 2009, събота
Maybe you already forget the presentation title, so one more time...
![Page 5: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/5.jpg)
What is this talk about?
520 юни 2009, събота
![Page 6: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/6.jpg)
Webhooksglue for the Web
620 юни 2009, събота
![Page 7: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/7.jpg)
Hooks?720 юни 2009, събота
![Page 8: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/8.jpg)
Glue?820 юни 2009, събота
![Page 9: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/9.jpg)
Web 3.0920 юни 2009, събота
Don’t worry. We will talk about web :)
![Page 10: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/10.jpg)
Web x.0?
• Web 1.0 - static
• Web 2.0 - dynamic? social?
• Web 3.0 - real time?
1020 юни 2009, събота
Google Wave, iPhone push notifications
![Page 11: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/11.jpg)
Web 3.0
• Real Time
• Does it scale?
• PubSub
1120 юни 2009, събота
![Page 12: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/12.jpg)
Real Time1220 юни 2009, събота
![Page 13: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/13.jpg)
Real Time Web
• RSS is not enough (SUP)
• XMPP
• Webhooks
1320 юни 2009, събота
I spoke in Kobe about SUP and XMPP (see my other presentations - http://www.slideshare.net/zhesto/microblogging-via-xmpp
![Page 14: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/14.jpg)
No Polling!1420 юни 2009, събота
Image from the presentation ”Web Hooks and the Programmable World of Tomorrow”
![Page 15: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/15.jpg)
Real Time1520 юни 2009, събота
![Page 16: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/16.jpg)
Does it scale?
1620 юни 2009, събота
Recently working a lot with EC2 - pay per use, scale easy - instant start/stop of instances
![Page 17: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/17.jpg)
Clouds...
1720 юни 2009, събота
![Page 18: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/18.jpg)
Clouds?1820 юни 2009, събота
![Page 19: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/19.jpg)
Computer cloud!1920 юни 2009, събота
![Page 20: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/20.jpg)
Communications2020 юни 2009, събота
![Page 21: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/21.jpg)
Communications
• Messaging (AMQP): RabbitMQ
• XMPP, Ejabberd, Prosody
• Webhooks
2120 юни 2009, събота
Webooks can help you with the infrastructure. Some service is too heavy? - move it to another machine and connect them with webhook. Think about webhooks even when on a single machine (call by URL, not by function name)
![Page 22: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/22.jpg)
PubSub
2220 юни 2009, събота
![Page 23: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/23.jpg)
Publishers2320 юни 2009, събота
![Page 24: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/24.jpg)
Subscribers2420 юни 2009, събота
![Page 25: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/25.jpg)
Publishers and Subscribers
2520 юни 2009, събота
![Page 26: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/26.jpg)
Watercoolr
•PubSub
•Webhooks
•Ruby
http://github.com/zh/watercoolr/http://github.com/jcapote/watercoolr/
2620 юни 2009, събота
![Page 27: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/27.jpg)
PubSubHubBubhttp://code.google.com/p/pubsubhubbub/
2720 юни 2009, събота
![Page 28: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/28.jpg)
What are webhooks?2820 юни 2009, събота
Image from the presentation “Using Web Hooks”I keep repeating webhooks, webhooks,... So what are they?
![Page 29: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/29.jpg)
Captain Hook2920 юни 2009, събота
![Page 30: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/30.jpg)
SVN Hooks3020 юни 2009, събота
Image from the presentation “Using Web Hooks”
![Page 31: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/31.jpg)
Hooks
• Subversion pre-commit, post-commit
• Git, Mercurial - they have hooks too
• Rails: :before_save, :after_delete
3120 юни 2009, събота
![Page 32: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/32.jpg)
Unix Philosophy
• do ONE THING and do it well
• programs WORK TOGETHER
• UNIVERSAL INTERFACE (text)
3220 юни 2009, събота
Insert here more about the webhooks - POST, etc.example cat | grep | mail -> make this with web too (demo)
![Page 33: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/33.jpg)
UNIX pipes3320 юни 2009, събота
Image from the presentation ”Web Hooks and the Programmable World of Tomorrow”
![Page 34: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/34.jpg)
The Web3420 юни 2009, събота
Image from the presentation ”Web Hooks and the Programmable World of Tomorrow”
![Page 35: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/35.jpg)
Web 3D3520 юни 2009, събота
There are services creating the web pages (feeds). Now nodes communicate via RSS - indirect.Image from the presentation ”Web Hooks and the Programmable World of Tomorrow”
![Page 36: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/36.jpg)
WebApp pipes?3620 юни 2009, събота
Can we make a simple applications and connect them like a pipe?Image from the presentation ”Web Hooks and the Programmable World of Tomorrow”
![Page 37: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/37.jpg)
3720 юни 2009, събота
Image from the presentation ”Web Hooks and the Programmable World of Tomorrow”
![Page 38: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/38.jpg)
POST /service data={ 'message':'hey guys!' }
3820 юни 2009, събота
![Page 39: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/39.jpg)
What are WEBhooks?
webhooks are user defined callback URLs, that point to a web script to run on a
certain event
3920 юни 2009, събота
By letting the user specify a URL for various events, the application will POST data to those URLs when the events occur. Key poins: USER DEFINED, URLs (remote services), RUN ON CERTAIN EVENT (push, no cronjobs etc.)
![Page 40: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/40.jpg)
User defined4020 юни 2009, събота
![Page 41: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/41.jpg)
URLs = remote4120 юни 2009, събота
![Page 42: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/42.jpg)
register URL4220 юни 2009, събота
Image from the presentation “Using Web Hooks”
![Page 43: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/43.jpg)
get notification4320 юни 2009, събота
Image from the presentation “Using Web Hooks”
![Page 44: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/44.jpg)
Why?
4420 юни 2009, събота
![Page 45: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/45.jpg)
Service Integration4520 юни 2009, събота
![Page 46: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/46.jpg)
Flexibility4620 юни 2009, събота
![Page 47: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/47.jpg)
Customization4720 юни 2009, събота
Image from the presentation ”Web Hooks and the Programmable World of Tomorrow”
![Page 48: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/48.jpg)
Webhooks movement
• Jeff Lindsay
• http://blogrium.com/?p=70
• http://webhooks.pbworks.com/
• http://blog.webhooks.org/
4820 юни 2009, събота
![Page 49: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/49.jpg)
Webhooks
• Amazon have Merchant Callback API
• PayPal (Instant Payment Notification)
• GitHub and Google Code
4920 юни 2009, събота
![Page 50: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/50.jpg)
Good and bad5020 юни 2009, събота
![Page 51: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/51.jpg)
Good
• Well known protocol - HTTP
• code libraries (software)
• infrastructure (hardware)
• Easy for vendors (services)
• Easy for users (consumers)
5120 юни 2009, събота
![Page 52: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/52.jpg)
5220 юни 2009, събота
![Page 53: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/53.jpg)
require ‘net/http’require ‘json’
class Userdef commit(message)
Net::HTTP.post_form( User.hook_url,{ :data => message.to_json })
endend
5320 юни 2009, събота
For service providers (publishers)
![Page 54: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/54.jpg)
require ‘net/smtp’require ‘json’require ‘sinatra’
post ‘/hook’ dodata = JSON.parse(params[:data])# do something with the dataNet::SMTP.start(‘localhost’) do |smtp|
smtp.send_message data[‘message’], from, to end
end
5420 юни 2009, събота
For service consumers (subscribers)
![Page 55: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/55.jpg)
Bad
• No standard
• Google Code: XML
• GitHub: JSON
• ping.fm - POST parameters
• Security (authentication)
5520 юни 2009, събота
![Page 56: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/56.jpg)
Real Life Usage
5620 юни 2009, събота
![Page 57: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/57.jpg)
Where to create hooks?
• http://heroku.com/ - Ruby
• GAE - Python, Java, JRuby
• http://scriptlets.org/ - Python, JS
• PHP - almost everywhere
5720 юни 2009, събота
![Page 58: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/58.jpg)
Ready Tools
• GitHub - RunCodeRun
• http://ping.fm/ - IM, email, Skype
• http://postbin.org/ - debug
• SwitchHub, TarPipe
• http://superfeedr.com/ - RSS
• http://bot.im/ - IMified XMPP bot
5820 юни 2009, събота
![Page 59: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/59.jpg)
Demoping.fm + postbin
ping.fm + switchub (+postbin)
5920 юни 2009, събота
create new hook on postbin, login to post.fm/custom/ and put there the url. test: web, email, im?
![Page 60: Webhooks - glue for the web](https://reader036.vdocuments.us/reader036/viewer/2022062307/55582298d8b42a25588b4c4c/html5/thumbnails/60.jpg)
Questions?
6020 юни 2009, събота