Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Crafting a Great Webhooks Experience
Search
John Sheehan
November 20, 2015
Technology
570
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Crafting a Great Webhooks Experience
Presented at API Strategy and Practice 2015 #apistrat
John Sheehan
November 20, 2015
Transcript
53 slides
Crafting a Great Webhooks Experience John Sheehan CEO, @Runscope
None
None
None
None
None
"user defined callbacks made with HTTP POST"
"Webhooks are the easiest way to remotely execute code." --
Jeff Lindsay once when we were talking
HTTP Push Notifications
A Reverse API
Provider makes request to URL when an event happens. Consumer
sets up a server to listen for callbacks. Consumer registers callback URL with provider.
Provider makes request to URL when an event happens. Consumer
sets up a server to listen for callbacks. Consumer registers callback URL with provider.
Provider makes request to URL when an event happens. Consumer
sets up a server to listen for callbacks. Consumer registers callback URL with provider.
None
Implementing Webhooks
url = get_callback_url() data = get_webhook_payload_json() try: resp = requests.post(url,
data=data) if not resp.ok: _logger.error(resp.content) except Exception as e: _logger.error(e)
Problem #1: Error Handling
> POST /callback < 400 Bad Request
> POST /callback < 302 Found < Location: http://
> POST /callback < 200 OK < Content-Type: text/plain <
<Response></Response>
Error Handling Suggestions
Be lenient in what you accept back if you can
reasonably guess. Retry failed callbacks with exponential back off. Decide if redirects are to be followed or not.
Be lenient in what you accept back if you can
reasonably guess. Retry failed callbacks with exponential back off. Decide if redirects are to be followed or not.
Be lenient in what you accept back if you can
reasonably guess. Retry failed callbacks with exponential back off. Decide if redirects are to be followed or not.
Problem #2: Flooding
None
Active Queues ↪ ↪
Problem #3: Security
> POST http://localhost:3000
> POST http://foo.lvh.me
DoS Attack Vector
Proving the Source
Validation Techniques
Key Sharing
Request Signing
Re-fetch > POST /callback > { id: 123 } >
GET /users/123 < { id: 123 } Webhook Callback App Code
Security Suggestions
Validate your requests. Document it well! Resolve IPs before making
request. Consider proxying. Consider subscription validation for high-volume cases.
Validate your requests. Document it well! Resolve IPs before making
request. Consider proxying. Consider subscription validation for high-volume cases.
Validate your requests. Document it well! Resolve IPs before making
request. Consider proxying. Consider subscription validation for high-volume cases.
Developer Experience
Payload Design
Fat vs.Thin
Mirror API Resources
Complete Documentation!
Tooling
Accept Multiple Callback URLs
Hooks API
Debugger & Logs
Manual Retries
Generate Test Callbacks
Tunneling Recommended: ngrok.com
Thank you! Questions?
[email protected]
Try Runscope free: runscope.com
More Decks by John Sheehan
See All by John Sheehan
My Favorite API Tools (Other than Runscope)
johnsheehan
0
210
Glue 2015: Microservices - More than just a buzzword.
johnsheehan
2
790
Scale-Oriented Architecture with Microservices
johnsheehan
2
390
Crafting a Great Webhooks Experience
johnsheehan
0
230
The rise of distributed applications.
johnsheehan
2
510
Zen and the Art of API Maintenance
johnsheehan
2
2.5k
Building API integrations you can live with.
johnsheehan
0
180
Free API debugging and testing tools you should know about.
johnsheehan
5
890
Modern Tools for Modern Applications
johnsheehan
1
220
Other Decks in Technology
See All in Technology
gem install とrequire のむこうがわ
ydah
0
250
「個社」ではなく「業界」の課題を解く AI 対話開発 ー 価値を広げる設計と、価値を守るエンジニアリング ー
ivry_presentationmaterials
4
810
専門家に使ってもらうAIプロダクトをつくる - 病院の医事課向けDPCコーディング支援システムの設計と評価
hagino3000
4
970
From vibe coding to reliable (agentic) development
jcabot
0
140
Well, that’s weird…
csswizardry
1
150
OpenTelemetryで変わった 新時代のCloudWatchメトリクス監視
tsukuboshi
0
480
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
17
120k
AIで実装が加速したのに、 なぜ私は仕事の大半で人と話し続けていたのか?
say_no_w
0
210
コーディングできない僕にBobが舞い降りた
shumpei3
0
140
閉域網でのAPI公開の選択肢全部比較!
takano0131
4
670
エンタープライズ事業未経験のデータ屋、 AI時代にN回撃沈する.pdf
ryoskdara_
0
180
PHPで家庭用ゲーム機の専用コントローラーをMIDIデバイスとして扱ってみる
wind111
0
180
Featured
See All Featured
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
780
Odyssey Design
rkendrick25
PRO
3
960
The Art of Programming - Codeland 2020
erikaheidi
57
15k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.4k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
2
3k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
2.2k
The Limits of Empathy - UXLibs8
cassininazir
2
800
Reality Check: Gamification 10 Years Later
codingconduct
0
2.4k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
1
310
It's Worth the Effort
3n
188
29k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
310
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
1
670