SlideShare a Scribd company logo
1 of 19
Building Event Driven API Services Using Webhooks
Travis McChesney - Cloud Elements
Confidential & ProprietaryConfidential & Proprietary
Applications are InherentlyDecoupled
APIs glue applications together
Most APIs can be used synchronously
Confidential & ProprietaryConfidential & Proprietary
Application should provide EventDrivenAPIs
Very useful for some integration use cases
Improves UX of application APIs
Confidential & ProprietaryConfidential & Proprietary
UseCasesforEventDrivenAPIs
Integrations that need to consume large volumes of data
Can’t keep a synchronous connection open for 15 minutes
Long running, intensive operations such as complicated searches
Services that cannot provide a definitive response synchronously
Confidential & ProprietaryConfidential & Proprietary
Asynchronous APIOptions
Polling
Uses unnecessary compute cycles
Frequency is application specific
Concurrent polling is complicated and introduces instability
Confidential & ProprietaryConfidential & Proprietary
LettheAPIProviderNotifyYourApplication
Register a callback API with Event Handler logic
Registered Event Handler is invoked when the data is ready for consumption
This is basically a Webhook
Trigger action for Callback API, and respond immediately to your users
Confidential & ProprietaryConfidential & Proprietary
Example WebhookWorkflow
Your app send an email using a Cloud Email Service
Create an email message and send it via the Cloud Email Service
Respond to your user that the message has been queued
Persist the Email Message ID
Your app wants to know when the email is processed, sent and opened
Register the Event Handler or Callback API for the Webhook
Confidential & ProprietaryConfidential & Proprietary
Example WebhookWorkflow
The Cloud Email Service Provider invokes the Callback API for each event
Your app receives the event and message ID via the Callback API request
Your app handles each event and notifies the user of each event
Confidential & ProprietaryConfidential & Proprietary
WebhookPitfalls
Watch for circular references
Updating Field 1 invokes a callback with a specific event
Your app processes the event and invokes the API to update Field 2
The update of Field 2 invokes a callback, which in turn updates Field 1 again
Security concerns
Public API endpoint is now exposed
Temp tokens or consumable message IDs
Confidential & ProprietaryConfidential & Proprietary
Using WebhooksinDevelopment
A Webhook needs a public callback URL to invoke
Most developers use localhost
So, how can I test a webhook while developing?
Confidential & ProprietaryConfidential & Proprietary
Testing WebhooksinDevelopment
API Capture
TCP Tunneling
OpenSSH Tunneling
Dynamic DNS
Remote Server
Confidential & ProprietaryConfidential & Proprietary
API Capture forWebhooksinDevelopment
API Capture is one mechanism to test webhooks in development
Leverage services such a Runscope’s requestb.in
Register this URL as the application callback URL for the Webhook
Great for inspecting the posted callback data
When the callback is invoked, use this URL in a browser
Create a webhook callback URL at requestb.in
Inspect the posted data
Not as easy for debugging when something’s not quite right
Confidential & ProprietaryConfidential & Proprietary
TCP Tunneling forWebhooksinDevelopment
Services such as localtunnel.me, localtunnel.com, ProxyLocal or ForwardHQ
> npm install -g localtunnel
Need to reset tunnel when internet connection changes
> lt —port <port>
localtunnel.me example
Need to install client on localhost
Confidential & ProprietaryConfidential & Proprietary
OpenSSH Tunneling forWebhooksinDevelopment
Open and keep open socket from localhost to remote server
Configure remote server to pass requests down the connection
Setup OpenSSH reverse proxy to a public server
Need to reset tunnel when internet connection changes
Needs GatewayPorts and AllowTcpForwarding enabled on remote server
ssh -N -g -R :8080:localhost:8080 user@remote_server &
Needs remote server with root access or system administrator access
Confidential & ProprietaryConfidential & Proprietary
Dynamic DNS forWebhooksinDevelopment
Use DynDNS or No-IP based DNS to route to localhost
Needs router or firewall configuration
Get a free DNS from one of the providers
Configure DNS to forward to external IP of home office
Configure home office router to route requests to private IP
Works only from a single location
Confidential & ProprietaryConfidential & Proprietary
Remote Server forWebhooksinDevelopment
Use a public remote server for development
Deploy application to publicly available host
Need a public host, although easier now with public cloud providers
Connect your IDE’s debugger to public host
Debugging over the internet is typically slow
Confidential & ProprietaryConfidential & Proprietary
TCP Tunneling DemowithSendGridElement
Get localtunnel.me based application callback URL
Register localtunnel.me application callback URL with SendGrid
Send email using Cloud Elements’ Messaging Hub
Upon email reception, handle event callback
Cloud Elements 2014 - Confidential & Proprietary
CLOUD ELEMENTS
One-to-Many
One API connects to Many of the leading services in a category
(e.g. CRM, Documents, Marketing)
Multi-Tenant Connectors
Each Element automatically authenticates to an unlimited number
of customer accounts
Embed Seamlessly in Your App
Keeps your app all about your brand as our Elements work behind
the scenes through RESTful APIs
Monthly, Pay As You Go
Charged only when your customers use your application
18
Less work, less cost, and more connections for your application.
Confidential & ProprietaryConfidential & Proprietary
References
travis@cloud-elements.com
@travisj37
References
http://www.cloud-elements.com/4-options-developing-webhooks/
http://progrium.com/blog/2012/11/19/from-webhooks-to-the-evented-web/

More Related Content

What's hot

What's hot (20)

Building a social network in under 4 weeks with Serverless and GraphQL
Building a social network in under 4 weeks with Serverless and GraphQLBuilding a social network in under 4 weeks with Serverless and GraphQL
Building a social network in under 4 weeks with Serverless and GraphQL
 
Using Cookies to Store Your Postman Secrets
Using Cookies to Store Your Postman SecretsUsing Cookies to Store Your Postman Secrets
Using Cookies to Store Your Postman Secrets
 
Succeeding with FOSS!
Succeeding with FOSS!Succeeding with FOSS!
Succeeding with FOSS!
 
Building Serverless applications with Python
Building Serverless applications with PythonBuilding Serverless applications with Python
Building Serverless applications with Python
 
Firebase Adventures - Real time platform for your apps
Firebase Adventures - Real time platform for your appsFirebase Adventures - Real time platform for your apps
Firebase Adventures - Real time platform for your apps
 
Serverless observability - a hero's perspective
Serverless observability - a hero's perspectiveServerless observability - a hero's perspective
Serverless observability - a hero's perspective
 
Migrating existing monolith to serverless in 8 steps
Migrating existing monolith to serverless in 8 stepsMigrating existing monolith to serverless in 8 steps
Migrating existing monolith to serverless in 8 steps
 
Firebase for the Web
Firebase for the WebFirebase for the Web
Firebase for the Web
 
code-camp-meteor
code-camp-meteorcode-camp-meteor
code-camp-meteor
 
Firebase with Android
Firebase with AndroidFirebase with Android
Firebase with Android
 
Essential open source tools for serverless developers
Essential open source tools for serverless developersEssential open source tools for serverless developers
Essential open source tools for serverless developers
 
Meteor presentation
Meteor presentationMeteor presentation
Meteor presentation
 
Firebase - A real-time server
Firebase - A real-time serverFirebase - A real-time server
Firebase - A real-time server
 
Spring Boot & Spring Cloud on PAS- Nate Schutta (1/2)
Spring Boot & Spring Cloud on PAS- Nate Schutta (1/2)Spring Boot & Spring Cloud on PAS- Nate Schutta (1/2)
Spring Boot & Spring Cloud on PAS- Nate Schutta (1/2)
 
Panoramic view of web APIs
Panoramic view of web APIsPanoramic view of web APIs
Panoramic view of web APIs
 
Installing php 7.4 Nginx Laravel 7.x on Centos 8
Installing php 7.4 Nginx Laravel 7.x on Centos 8Installing php 7.4 Nginx Laravel 7.x on Centos 8
Installing php 7.4 Nginx Laravel 7.x on Centos 8
 
JS Fest 2018. Тимофей Лавренюк. Делаем веб приложение лучше с помощью совреме...
JS Fest 2018. Тимофей Лавренюк. Делаем веб приложение лучше с помощью совреме...JS Fest 2018. Тимофей Лавренюк. Делаем веб приложение лучше с помощью совреме...
JS Fest 2018. Тимофей Лавренюк. Делаем веб приложение лучше с помощью совреме...
 
Best Laravel Eloquent Tips and Tricks
Best Laravel Eloquent Tips and TricksBest Laravel Eloquent Tips and Tricks
Best Laravel Eloquent Tips and Tricks
 
Velocity London - Chaos Engineering Bootcamp
Velocity London - Chaos Engineering Bootcamp Velocity London - Chaos Engineering Bootcamp
Velocity London - Chaos Engineering Bootcamp
 
Firebase Adventures - Going above and beyond in Realtime
Firebase Adventures - Going above and beyond in RealtimeFirebase Adventures - Going above and beyond in Realtime
Firebase Adventures - Going above and beyond in Realtime
 

Viewers also liked

Microsoft Azure 虛擬機器與虛擬網路 (2014-4-2 雲端達人班)
Microsoft Azure 虛擬機器與虛擬網路 (2014-4-2 雲端達人班)Microsoft Azure 虛擬機器與虛擬網路 (2014-4-2 雲端達人班)
Microsoft Azure 虛擬機器與虛擬網路 (2014-4-2 雲端達人班)
Jeff Chu
 

Viewers also liked (19)

Web Hooks On Pbwiki
Web Hooks On PbwikiWeb Hooks On Pbwiki
Web Hooks On Pbwiki
 
Using Web Hooks
Using Web HooksUsing Web Hooks
Using Web Hooks
 
Webhooks - glue for the web
Webhooks - glue for the webWebhooks - glue for the web
Webhooks - glue for the web
 
Git::Hooks
Git::HooksGit::Hooks
Git::Hooks
 
Tuning for Performance: indexes & Queries
Tuning for Performance: indexes & QueriesTuning for Performance: indexes & Queries
Tuning for Performance: indexes & Queries
 
Digital tech and consumer behaviour
Digital tech and consumer behaviourDigital tech and consumer behaviour
Digital tech and consumer behaviour
 
How to Get Started with Google Voice
How to Get Started with Google VoiceHow to Get Started with Google Voice
How to Get Started with Google Voice
 
Real Time Connected Vehicle Networking with HDInsight and Apache Storm
Real Time Connected Vehicle Networking with HDInsight and Apache StormReal Time Connected Vehicle Networking with HDInsight and Apache Storm
Real Time Connected Vehicle Networking with HDInsight and Apache Storm
 
How Mobile Voice Search Changes SEO
How Mobile Voice Search Changes SEOHow Mobile Voice Search Changes SEO
How Mobile Voice Search Changes SEO
 
Microsoft Cognitive Services 概要
Microsoft Cognitive Services 概要Microsoft Cognitive Services 概要
Microsoft Cognitive Services 概要
 
Cognitive APIs and Conversational Interfaces
Cognitive APIs and Conversational InterfacesCognitive APIs and Conversational Interfaces
Cognitive APIs and Conversational Interfaces
 
第5回 cogbot勉強会!
第5回 cogbot勉強会!第5回 cogbot勉強会!
第5回 cogbot勉強会!
 
DDoS対策の自動化
DDoS対策の自動化DDoS対策の自動化
DDoS対策の自動化
 
Consulを頑張って理解する
Consulを頑張って理解するConsulを頑張って理解する
Consulを頑張って理解する
 
Azure Machine Learning getting started
Azure Machine Learning getting startedAzure Machine Learning getting started
Azure Machine Learning getting started
 
V1 of The Computer Scientist and The Cleaner
V1 of The Computer Scientist and The CleanerV1 of The Computer Scientist and The Cleaner
V1 of The Computer Scientist and The Cleaner
 
SignalR & SQL Dependency
SignalR & SQL DependencySignalR & SQL Dependency
SignalR & SQL Dependency
 
Microsoft Azure 虛擬機器與虛擬網路 (2014-4-2 雲端達人班)
Microsoft Azure 虛擬機器與虛擬網路 (2014-4-2 雲端達人班)Microsoft Azure 虛擬機器與虛擬網路 (2014-4-2 雲端達人班)
Microsoft Azure 虛擬機器與虛擬網路 (2014-4-2 雲端達人班)
 
From an idea to a Startup
From an idea to a StartupFrom an idea to a Startup
From an idea to a Startup
 

Similar to Building Event Driven API Services Using Webhooks

AWS Summit Tel Aviv - Enterprise Track - Enterprise Apps & Hybrid
AWS Summit Tel Aviv - Enterprise Track - Enterprise Apps & HybridAWS Summit Tel Aviv - Enterprise Track - Enterprise Apps & Hybrid
AWS Summit Tel Aviv - Enterprise Track - Enterprise Apps & Hybrid
Amazon Web Services
 
AWS Summit Tel Aviv - Enterprise Track - Enterprise Apps and Hybrid
AWS Summit Tel Aviv - Enterprise Track - Enterprise Apps and HybridAWS Summit Tel Aviv - Enterprise Track - Enterprise Apps and Hybrid
AWS Summit Tel Aviv - Enterprise Track - Enterprise Apps and Hybrid
Amazon Web Services
 
Securing Red Hat OpenShift Containerized Applications At Enterprise Scale
Securing Red Hat OpenShift Containerized Applications At Enterprise ScaleSecuring Red Hat OpenShift Containerized Applications At Enterprise Scale
Securing Red Hat OpenShift Containerized Applications At Enterprise Scale
DevOps.com
 

Similar to Building Event Driven API Services Using Webhooks (20)

Intro to Google Cloud Platform Data Engineering.- Endpoints
Intro to Google Cloud Platform Data Engineering.- EndpointsIntro to Google Cloud Platform Data Engineering.- Endpoints
Intro to Google Cloud Platform Data Engineering.- Endpoints
 
Google Cloud Next '22 Recap: Serverless & Data edition
Google Cloud Next '22 Recap: Serverless & Data editionGoogle Cloud Next '22 Recap: Serverless & Data edition
Google Cloud Next '22 Recap: Serverless & Data edition
 
2022 APIsecure_Making webhook APIs secure for enterprise
2022 APIsecure_Making webhook APIs secure for enterprise2022 APIsecure_Making webhook APIs secure for enterprise
2022 APIsecure_Making webhook APIs secure for enterprise
 
.NET Cloud-Native Bootcamp
.NET Cloud-Native Bootcamp.NET Cloud-Native Bootcamp
.NET Cloud-Native Bootcamp
 
AWS Summit Tel Aviv - Enterprise Track - Enterprise Apps & Hybrid
AWS Summit Tel Aviv - Enterprise Track - Enterprise Apps & HybridAWS Summit Tel Aviv - Enterprise Track - Enterprise Apps & Hybrid
AWS Summit Tel Aviv - Enterprise Track - Enterprise Apps & Hybrid
 
AWS Summit Tel Aviv - Enterprise Track - Enterprise Apps and Hybrid
AWS Summit Tel Aviv - Enterprise Track - Enterprise Apps and HybridAWS Summit Tel Aviv - Enterprise Track - Enterprise Apps and Hybrid
AWS Summit Tel Aviv - Enterprise Track - Enterprise Apps and Hybrid
 
Cryptzone: The Software-Defined Perimeter
Cryptzone: The Software-Defined PerimeterCryptzone: The Software-Defined Perimeter
Cryptzone: The Software-Defined Perimeter
 
Cryptzone: What is a Software-Defined Perimeter?
Cryptzone: What is a Software-Defined Perimeter?Cryptzone: What is a Software-Defined Perimeter?
Cryptzone: What is a Software-Defined Perimeter?
 
OpenStack Architecture
OpenStack ArchitectureOpenStack Architecture
OpenStack Architecture
 
OpenStack Architecture
OpenStack ArchitectureOpenStack Architecture
OpenStack Architecture
 
Realtime Content Delivery: Powering dynamic instant experiences
Realtime Content Delivery: Powering dynamic instant experiencesRealtime Content Delivery: Powering dynamic instant experiences
Realtime Content Delivery: Powering dynamic instant experiences
 
AWS November meetup Slides
AWS November meetup SlidesAWS November meetup Slides
AWS November meetup Slides
 
AWS User Group November
AWS User Group NovemberAWS User Group November
AWS User Group November
 
Securing Red Hat OpenShift Containerized Applications At Enterprise Scale
Securing Red Hat OpenShift Containerized Applications At Enterprise ScaleSecuring Red Hat OpenShift Containerized Applications At Enterprise Scale
Securing Red Hat OpenShift Containerized Applications At Enterprise Scale
 
Resilient Microservices with Spring Cloud
Resilient Microservices with Spring CloudResilient Microservices with Spring Cloud
Resilient Microservices with Spring Cloud
 
Application DoS In Microservice Architectures
Application DoS In Microservice ArchitecturesApplication DoS In Microservice Architectures
Application DoS In Microservice Architectures
 
How to Connect to Any REST API (Without Writing Any Code)
How to Connect to Any REST API (Without Writing Any Code)How to Connect to Any REST API (Without Writing Any Code)
How to Connect to Any REST API (Without Writing Any Code)
 
11.Open Data Protocol(ODATA)
11.Open Data Protocol(ODATA) 11.Open Data Protocol(ODATA)
11.Open Data Protocol(ODATA)
 
DEVNET-1121 Customizing Cisco Video Access for Guests
DEVNET-1121	Customizing Cisco Video Access for GuestsDEVNET-1121	Customizing Cisco Video Access for Guests
DEVNET-1121 Customizing Cisco Video Access for Guests
 
Introduction to CloudStack API
Introduction to CloudStack APIIntroduction to CloudStack API
Introduction to CloudStack API
 

More from Cloud Elements

More from Cloud Elements (20)

10 Step Guide to API Integrations
10 Step Guide to API Integrations10 Step Guide to API Integrations
10 Step Guide to API Integrations
 
How to Build Platforms, Not Products
How to Build Platforms, Not ProductsHow to Build Platforms, Not Products
How to Build Platforms, Not Products
 
State of API Integration Report 2017
State of API Integration Report 2017State of API Integration Report 2017
State of API Integration Report 2017
 
Cloud Elements | State of API Integration Report 2018
Cloud Elements | State of API Integration Report 2018Cloud Elements | State of API Integration Report 2018
Cloud Elements | State of API Integration Report 2018
 
All Things API Presentation - Gordon Weakleim [HomeAway]
All Things API Presentation - Gordon Weakleim [HomeAway]All Things API Presentation - Gordon Weakleim [HomeAway]
All Things API Presentation - Gordon Weakleim [HomeAway]
 
Atlassianconnectadd onsforeveryplatform-tanguycrusson-140925195129-phpapp01
Atlassianconnectadd onsforeveryplatform-tanguycrusson-140925195129-phpapp01Atlassianconnectadd onsforeveryplatform-tanguycrusson-140925195129-phpapp01
Atlassianconnectadd onsforeveryplatform-tanguycrusson-140925195129-phpapp01
 
Email As A Datasource
Email As A DatasourceEmail As A Datasource
Email As A Datasource
 
Lean Product Development 101
Lean Product Development 101Lean Product Development 101
Lean Product Development 101
 
Lean Product Development 101
Lean Product Development 101Lean Product Development 101
Lean Product Development 101
 
'Scalable Logging and Analytics with LogStash'
'Scalable Logging and Analytics with LogStash''Scalable Logging and Analytics with LogStash'
'Scalable Logging and Analytics with LogStash'
 
The Entrepreneurial Methodology: How engineers can harness the madness in a n...
The Entrepreneurial Methodology: How engineers can harness the madness in a n...The Entrepreneurial Methodology: How engineers can harness the madness in a n...
The Entrepreneurial Methodology: How engineers can harness the madness in a n...
 
Cloud Elements Documents Hub
Cloud Elements Documents HubCloud Elements Documents Hub
Cloud Elements Documents Hub
 
Data normalization across API interactions
Data normalization across API interactionsData normalization across API interactions
Data normalization across API interactions
 
Filtering From the Firehose: Real Time Social Media Streaming
Filtering From the Firehose: Real Time Social Media StreamingFiltering From the Firehose: Real Time Social Media Streaming
Filtering From the Firehose: Real Time Social Media Streaming
 
Lean Product Development for Startups- Denver Startup Week
Lean Product Development for Startups- Denver Startup Week Lean Product Development for Startups- Denver Startup Week
Lean Product Development for Startups- Denver Startup Week
 
Appx for Developers
Appx for Developers   Appx for Developers
Appx for Developers
 
Lean product development for startups
Lean product development for startupsLean product development for startups
Lean product development for startups
 
Using a simple Ruby program to interface with quickly provisioned cloud appli...
Using a simple Ruby program to interface with quickly provisioned cloud appli...Using a simple Ruby program to interface with quickly provisioned cloud appli...
Using a simple Ruby program to interface with quickly provisioned cloud appli...
 
Money & Bitcoin & the Cloud: It's all just data streams, anyway!
Money & Bitcoin & the Cloud: It's all just data streams, anyway!Money & Bitcoin & the Cloud: It's all just data streams, anyway!
Money & Bitcoin & the Cloud: It's all just data streams, anyway!
 
API Versioning in the Cloud
API Versioning in the CloudAPI Versioning in the Cloud
API Versioning in the Cloud
 

Recently uploaded

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Recently uploaded (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 

Building Event Driven API Services Using Webhooks

  • 1. Building Event Driven API Services Using Webhooks Travis McChesney - Cloud Elements
  • 2. Confidential & ProprietaryConfidential & Proprietary Applications are InherentlyDecoupled APIs glue applications together Most APIs can be used synchronously
  • 3. Confidential & ProprietaryConfidential & Proprietary Application should provide EventDrivenAPIs Very useful for some integration use cases Improves UX of application APIs
  • 4. Confidential & ProprietaryConfidential & Proprietary UseCasesforEventDrivenAPIs Integrations that need to consume large volumes of data Can’t keep a synchronous connection open for 15 minutes Long running, intensive operations such as complicated searches Services that cannot provide a definitive response synchronously
  • 5. Confidential & ProprietaryConfidential & Proprietary Asynchronous APIOptions Polling Uses unnecessary compute cycles Frequency is application specific Concurrent polling is complicated and introduces instability
  • 6. Confidential & ProprietaryConfidential & Proprietary LettheAPIProviderNotifyYourApplication Register a callback API with Event Handler logic Registered Event Handler is invoked when the data is ready for consumption This is basically a Webhook Trigger action for Callback API, and respond immediately to your users
  • 7. Confidential & ProprietaryConfidential & Proprietary Example WebhookWorkflow Your app send an email using a Cloud Email Service Create an email message and send it via the Cloud Email Service Respond to your user that the message has been queued Persist the Email Message ID Your app wants to know when the email is processed, sent and opened Register the Event Handler or Callback API for the Webhook
  • 8. Confidential & ProprietaryConfidential & Proprietary Example WebhookWorkflow The Cloud Email Service Provider invokes the Callback API for each event Your app receives the event and message ID via the Callback API request Your app handles each event and notifies the user of each event
  • 9. Confidential & ProprietaryConfidential & Proprietary WebhookPitfalls Watch for circular references Updating Field 1 invokes a callback with a specific event Your app processes the event and invokes the API to update Field 2 The update of Field 2 invokes a callback, which in turn updates Field 1 again Security concerns Public API endpoint is now exposed Temp tokens or consumable message IDs
  • 10. Confidential & ProprietaryConfidential & Proprietary Using WebhooksinDevelopment A Webhook needs a public callback URL to invoke Most developers use localhost So, how can I test a webhook while developing?
  • 11. Confidential & ProprietaryConfidential & Proprietary Testing WebhooksinDevelopment API Capture TCP Tunneling OpenSSH Tunneling Dynamic DNS Remote Server
  • 12. Confidential & ProprietaryConfidential & Proprietary API Capture forWebhooksinDevelopment API Capture is one mechanism to test webhooks in development Leverage services such a Runscope’s requestb.in Register this URL as the application callback URL for the Webhook Great for inspecting the posted callback data When the callback is invoked, use this URL in a browser Create a webhook callback URL at requestb.in Inspect the posted data Not as easy for debugging when something’s not quite right
  • 13. Confidential & ProprietaryConfidential & Proprietary TCP Tunneling forWebhooksinDevelopment Services such as localtunnel.me, localtunnel.com, ProxyLocal or ForwardHQ > npm install -g localtunnel Need to reset tunnel when internet connection changes > lt —port <port> localtunnel.me example Need to install client on localhost
  • 14. Confidential & ProprietaryConfidential & Proprietary OpenSSH Tunneling forWebhooksinDevelopment Open and keep open socket from localhost to remote server Configure remote server to pass requests down the connection Setup OpenSSH reverse proxy to a public server Need to reset tunnel when internet connection changes Needs GatewayPorts and AllowTcpForwarding enabled on remote server ssh -N -g -R :8080:localhost:8080 user@remote_server & Needs remote server with root access or system administrator access
  • 15. Confidential & ProprietaryConfidential & Proprietary Dynamic DNS forWebhooksinDevelopment Use DynDNS or No-IP based DNS to route to localhost Needs router or firewall configuration Get a free DNS from one of the providers Configure DNS to forward to external IP of home office Configure home office router to route requests to private IP Works only from a single location
  • 16. Confidential & ProprietaryConfidential & Proprietary Remote Server forWebhooksinDevelopment Use a public remote server for development Deploy application to publicly available host Need a public host, although easier now with public cloud providers Connect your IDE’s debugger to public host Debugging over the internet is typically slow
  • 17. Confidential & ProprietaryConfidential & Proprietary TCP Tunneling DemowithSendGridElement Get localtunnel.me based application callback URL Register localtunnel.me application callback URL with SendGrid Send email using Cloud Elements’ Messaging Hub Upon email reception, handle event callback
  • 18. Cloud Elements 2014 - Confidential & Proprietary CLOUD ELEMENTS One-to-Many One API connects to Many of the leading services in a category (e.g. CRM, Documents, Marketing) Multi-Tenant Connectors Each Element automatically authenticates to an unlimited number of customer accounts Embed Seamlessly in Your App Keeps your app all about your brand as our Elements work behind the scenes through RESTful APIs Monthly, Pay As You Go Charged only when your customers use your application 18 Less work, less cost, and more connections for your application.
  • 19. Confidential & ProprietaryConfidential & Proprietary References travis@cloud-elements.com @travisj37 References http://www.cloud-elements.com/4-options-developing-webhooks/ http://progrium.com/blog/2012/11/19/from-webhooks-to-the-evented-web/

Editor's Notes

  1. Set the stage for use cases for asynchronous APIs. As APIs get more and more prevalent and start doing more and more tasks, an asynchronous approach is going to be necessary
  2. Bulk uploads and downloads from CRM systems. Don’t want to do that synchronously. Long search operations
  3. Using compute cycles if there is no data to be pulled. Cases where the frequency of polling is application specific. Some cases every 5 seconds, other times every hour. Could depend on the data. Example: Buying Rockies tickets. Rather than refreshing the page, you could get notified. Multiple threads trying to get the same data.
  4. Providing an event handler for your callback API. Ex: SFDC. Notified when an Opportunity object probability goes above 60%.
  5. There are things to consider with web hooks as well. Some service providers only allow one callback URL, and your app has to handle the event based on the payload received.