Upload
intuit-developer
View
144
Download
0
Embed Size (px)
Citation preview
Vishal Aggarwal, Joe Bumbaca
Using webhooks to handle data changes in your app
WiFi: QBConnect Password: not required#QBConnect
2
Today’s speakers
Vishal AggarwalSenior Product Manager@vishala
Joe BumbacaSenior Software Engineer
#QBConnect | @IntuitDev | @vishala
Overview of Webhooks
Key Enablers
Demo
Payload
Supported Entities/Operations
Best Practices
Looking into the future
Q&A
Agenda
web•hooks |ˈwebˌhooks| pattern of enabling user-defined callbacks in web applications
– Jeff LindsayHacker, Philosopher
5
Advantages• Push Model compared to Poll Model• Simplifies integration for developers• Improves user experience with near real-time
data.• Enables newer use cases / pushes limits of
current integration.• Load reduction on QBO
Limitations• Complicate and Increases integration cost for developers• Sub-optimal experience for SMBs due to delay in data
sync• Continuous polling adds load on developers and QBO
servers
Overview of Webhooks
#QBConnect | @IntuitDev | @vishala
6
Source : Jeff Lindsay
Webhooks: key enablers
#QBConnect | @IntuitDev | @vishala
Notifications“I wish I could get notifications exactly how I want”
“e.g. Notify me when an invoice is paid”
Data Syncing“I wish my web apps would keep overlapping data in sync”
“e.g. My customer information should be in sync between QB & my App”
Chaining“I wish I could make another app do something, When I use this app”
“e.g. If a new invoice is created in QBO, I can automatically clear it with my App”
8
eventNotificationsArray of the notification changes. Although the notification is designed to accommodate multiple realmIDs, it only uses one at this time. If your app is connected to multiple companies, you will receive multiple eventNotifications (one per realmID).
Payload details
#QBConnect | @IntuitDev | @vishala
realmIdId of the QuickBooks company that has changed data
nameThe name of the entity type that has changed
idId of the entity that changed
operationType of change experienced
lastUpdatedThe updated timestamp in UTC
deletedIdOnly for Merge events – The Id of entity that was deleted and merged.
10
ReliabilityRespond PromptlyManage ConcurrencyNotification OrderingRetry Policy
Integration best practices
#QBConnect | @IntuitDev | @vishala
11
Reliability• In order to compensate for the possibility of missed or dropped packets, make a ChangeDataCapture (CDC) call for each entity received up to the last notification time (as shown in sample app) upon receipt of new notification.
• You can additionally make a daily CDC call for all entities to ensure that your database is consistently up to date.
Integration best practices
#QBConnect | @IntuitDev | @vishala
12
Respond Promptly• Your endpoint should respond within three seconds; otherwise, the transaction will time out and be retried.
• To make sure you can always respond quickly, do not process the notification payload or perform complex operations within the Webhooks endpoint implementation.
• It is a good idea to do the processing on a separate thread asynchronously using a queue.
Integration best practices
#QBConnect | @IntuitDev | @vishala
13
Manage Concurrency• Event notifications are sent for each realmID at a time.
• When there are multiple changes happening rapidly, your app may receive notifications frequently.
• Care should be taken to process the queue linearly to avoid processing the same changes more than once.
Integration best practices
#QBConnect | @IntuitDev | @vishala
14#QBConnect | @IntuitDev | @SpeakerTwitterHandle
Notification Ordering• While we make all effort to send the events in order, it is possible to receive an older event in a subsequent notification.
• The event timestamp field in the notification payload is always the source of truth for when an event has occurred.
Integration best practices
15
Retry Policy• If the endpoint is down, we will retry progressively (first time after 20 minutes, then again after 30 minutes, and a third time after 50 minutes) and finally drop the message.
• The endpoint will become inactive after one day.
Integration best practices
#QBConnect | @IntuitDev | @vishala
16
• API based subscription per company
• Configure aggregation period
• Event Log Viewer
• Capability to replay events
Looking into the future
#QBConnect | @IntuitDev | @vishala
Thanks for coming!We’d love your feedback.Before you head out, take a minute to rate this session in the QuickBooks Connect mobile app.
Keep the conversation goingdeveloper.intuit.com/hub/quickbooks-connect
Access Session SlidesEngage with Speakers and Fellow DevelopersGet Questions Answered