You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/developer/app-store/apps/segment.mdx
+27-35Lines changed: 27 additions & 35 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ This application integrates with [Twilio Segment](https://segment.com/). It trac
20
20
21
21
## Assumptions & limitations
22
22
23
-
- Currently, only order-related events are supported.
23
+
- Currently, only order-related events are supported. Events sent to Segment are in format defined by [V2 E-commerce Events](https://segment.com/docs/connections/spec/ecommerce/v2/) Segment specification.
24
24
- Order webhooks are asynchronous, meaning events may not be sent to Segment immediately.
25
25
- The app uses the [`track` API](https://segment.com/docs/connections/sources/catalog/libraries/server/node/#track).
26
26
- The app attempts to retrieve user information using the user ID or email. If that fails, it will send an anonymous ID.
@@ -32,46 +32,38 @@ This application integrates with [Twilio Segment](https://segment.com/). It trac
32
32
33
33
## Application flow
34
34
35
-
The application subscribes to the following webhooks:
36
-
37
-
-`ORDER_CREATED`
38
-
-`ORDER_CANCELLED`
39
-
-`ORDER_FULLY_PAID`
40
-
-`ORDER_REFUNDED`
41
-
-`ORDER_UPDATED`
42
-
43
-
For each webhook, the application will send the following information to Segment:
44
-
45
-
- Order `id`
46
-
- User information:
47
-
- User `id`
48
-
- User email
49
-
- Channel information for the order:
50
-
- Channel `id`
51
-
- Channel slug
52
-
- Channel name
53
-
- Name of the shipping method used for the order
54
-
- Total amount of the order, including:
55
-
- Total gross (amount & currency)
56
-
- Total net (amount & currency)
57
-
- Order number
58
-
- All lines of the order with:
59
-
- Line `id`
60
-
- Name of [product variant](/developer/products/overview#product-and-variants)
61
-
- Id of [product variant](/developer/products/overview#product-and-variants)
62
-
- SKU of product
63
-
64
-
65
-
Example of successful handling of `ORDER_CREATED` webhook:
35
+
The application subscribes to the following webhooks and sends coresponding event to Segment:
36
+
37
+
| Saleor webhook event | Segment event |
38
+
| ------------------------- | ----------------- |
39
+
|`ORDER_CONFIRMED`|`Order Completed`|
40
+
|`ORDER_CANCELLED`|`Order Cancelled`|
41
+
|`ORDER_REFUNDED`|`Order Refunded`|
42
+
|`ORDER_UPDATED`|`Order Updated`|
43
+
44
+
45
+
Each event sent to Segment will have properties defined in Segment E-commerce Event spec:
App will also add `channel_id` field with Saleor channel id for given order.
53
+
54
+
Events sent to Segment will have `Saleor` suffix set in `event`[field](https://segment.com/docs/connections/spec/track/#event) e.g `Order Completed` will be tracked as `Saleor Order Completed`.
55
+
56
+
57
+
Example of successful handling of `ORDER_UPDATED` webhook:
66
58
67
59
```mermaid
68
60
sequenceDiagram
69
-
OrderCreatedWebhook->>+App: Send webhook payload
61
+
OrderUpdatedWebhook->>+App: Send webhook payload
70
62
App-->>-Database: Fetch app configuration
71
63
Database-->>+App: Return configuration
72
64
App-->>+Segment: Use configuration & webhook payload to track event
73
65
Segment-->>-App: Returns success
74
-
App->>OrderCreatedWebhook: Returns 200 status code
66
+
App->>OrderUpdatedWebhook: Returns 200 status code
75
67
```
76
68
77
69
## Pre-requisites
@@ -85,7 +77,7 @@ sequenceDiagram
85
77
86
78
### Testing
87
79
88
-
To test if your app is working, create an order in the Saleor Dashboard. Then, go to the Segment Dashboard; you should see the `Saleor Order Created` event in Segment.
80
+
To test if your app is working, create an order and update its address or shipping in the Saleor Dashboard. Then, go to the Segment Dashboard; you should see the `Saleor Order Updated` event in Segment.
0 commit comments