Enabling Server Events
when installed on your storefront, chord typically sends tracking events to the cdp from two sources your website front end, either using chord's shopify theme snippet or @chordcommerce/analytics , and; chord's server events service, which sends tracking events from a shopify custom source function in your segment workspace in response to webhook triggers from shopify when chord provisions your segment workspace, it will include chord's shopify webhook source this code listens for webhook events from shopify and transforms them into segment events requirements locate chord's webhook source in your segment workspace, named "shopify webhooks " chord typically creates this webhook source as part of your segment workspace provisioning you'll need to update the settings of this source during the create an admin api key step, and you'll need the webhook url of this source during the create webhook subscriptions step if you can't find the segment source or aren't sure which one it is, please contact chord installation there are two steps to configuring server events creating an admin api key and adding it to the chord segment source; and subscribing the segment source to shopify webhook events create an admin api key chord's segment source requires an admin api key with the read orders scope to retrieve order details from shopify to generate this admin api key, we recommend creating a custom shopify app in your shopify account for chord, and using the admin api access token from this custom app this makes it easy to manage access create a new custom app in your shopify admin by navigating to settings > apps and sales channels > develop apps > create an app once the app is created, click configure admin api scopes choose read orders only and hit save on the overview tab, you should see a prompt to install to get your access token click install app now you should see this copy the admin api access token in your segment workspace, navigate to your chord webhook source and view the settings under settings > connection enter the admin api access token you just created in the access token or accesstoken settings field, and save changes create webhook subscriptions in your segment workspace, navigate to your chord webhook source and find the webhook url for the source under the configure your webhook heading now you'll create webhook subscriptions in shopify you can create webhook subscriptions either via the shopify admin https //help shopify com/en/manual/orders/notifications/webhooks or the admin api https //shopify dev/docs/api/admin rest/2024 01/resources/webhook#post webhooks you can use the admin api access token you created for chord to create the subscription via the admin api create a subscription for each server event you'd like chord to send to segment each subscription will have the same address, which is the url you copied from your chord segment source the following webhook topics are supported checkouts/create sends chord's "checkout created" event orders/create sends chord's "order completed" event refunds/create sends chord's "order refunded" event shopify's webhook testing doesn't actually include a payload that matches a real webhook payload, so we recommend completing a test transaction in your shopify store to verify that server events are flowing as expected you can view the segment events in the debugger tab of the shopify webhook source in your segment workspace