Skip to content

Commit b1c4b27

Browse files
authored
Update docs about Segment (#1449)
1 parent c4b0673 commit b1c4b27

File tree

1 file changed

+27
-35
lines changed

1 file changed

+27
-35
lines changed

docs/developer/app-store/apps/segment.mdx

Lines changed: 27 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ This application integrates with [Twilio Segment](https://segment.com/). It trac
2020

2121
## Assumptions & limitations
2222

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.
2424
- Order webhooks are asynchronous, meaning events may not be sent to Segment immediately.
2525
- The app uses the [`track` API](https://segment.com/docs/connections/sources/catalog/libraries/server/node/#track).
2626
- 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
3232

3333
## Application flow
3434

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:
46+
47+
* [`Order Completed`](https://segment.com/docs/connections/spec/ecommerce/v2/#order-completed)
48+
* [`Order Cancelled`](https://segment.com/docs/connections/spec/ecommerce/v2/#order-cancelled)
49+
* [`Order Refunded`](https://segment.com/docs/connections/spec/ecommerce/v2/#order-refunded)
50+
* [`Order Updated`](https://segment.com/docs/connections/spec/ecommerce/v2/#order-updated)
51+
52+
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:
6658

6759
```mermaid
6860
sequenceDiagram
69-
OrderCreatedWebhook->>+App: Send webhook payload
61+
OrderUpdatedWebhook->>+App: Send webhook payload
7062
App-->>-Database: Fetch app configuration
7163
Database-->>+App: Return configuration
7264
App-->>+Segment: Use configuration & webhook payload to track event
7365
Segment-->>-App: Returns success
74-
App->>OrderCreatedWebhook: Returns 200 status code
66+
App->>OrderUpdatedWebhook: Returns 200 status code
7567
```
7668

7769
## Pre-requisites
@@ -85,7 +77,7 @@ sequenceDiagram
8577

8678
### Testing
8779

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.
8981

9082
## Troubleshooting
9183

0 commit comments

Comments
 (0)