Implement Platform Event Notifications
When a Bold app is first installed, it performs some initial tasks that sync the customer, order, and product data between the platform and the Bold database. After the initial sync, it is important to continue to keep Bold up-to-date on any changes to that data. In a platform connector project, you must create webhooks to send that updated information to Bold.
The Platform Event Notification Specifications provide information about the endpoints that you can call to update Bold about changes to your customer, order, and product data. How and when you call these endpoints is entirely up to your own implementation. This document provides several examples of scenarios during which you may need to call these endpoints.
Scenario 1: Simple data change
The following image and steps demonstrate the actions that must be taken when a merchant creates a new product without Bold’s knowledge:
- The merchant creates a new product and adds it to their product database, which is synced with their platform.
- The platform notes that something has changed and provides the platform connector with the product information.
- The platform connector sends a
Save Product
event notification to Bold. - Bold updates their own database, and both databases are in sync. Bold sends a success message back to the platform connector.
Scenario 2: Data change with side effects
In addition, the platform connector may also need to send an event notification to Bold if an entity changes in response to another operation. For example, the following image and steps demonstrate the actions that must be taken when a customer changes their default address on the store.
The following image first shows the original operation, then the event notification that must happen as a result of those changes.
- While completing their checkout, a customer enters a new address and marks it as default.
- Bold makes an
Update Customer
call to the platform connector telling it to create a new address for a given customer and mark the newly created address as default. - The platform connector creates the new address and sets
is_default
totrue
. - According to the merchant's platform, there cannot be more than one default address. The platform updates the
is_default
field of the original address tofalse
. - Recognizing that the platform and Bold are out of sync because the original address changed, the platform connector sends Bold a
Save Customer
event notification with the updated customer information. - Bold updates their database and sets the
is_default
property of the original address tofalse
.