Skip to main content

Twilio Segment

Saleor version required: 3.20Repository: GitHub

This application integrates with Twilio Segment. It tracks events occurring in Saleor and sends them to Twilio Segment.

Features

  • Send information about order-related events to Segment.
  • Events send to Segment have identity set to user ID or email.

Assumptions & limitations

  • Currently, only order-related events are supported. Events sent to Segment are in format defined by V2 E-commerce Events Segment specification.
  • Order webhooks are asynchronous, meaning events may not be sent to Segment immediately.
  • The app uses the track API.
  • The app attempts to retrieve user information using the user ID or email. If that fails, it will send an anonymous ID.
  • The app has its webhooks initially disabled; configuring the app will activate the webhooks.

Permissions

  • MANAGE_ORDERS

Application flow

The application subscribes to the following webhooks and sends coresponding event to Segment:

Saleor webhook eventSegment event
ORDER_CONFIRMEDOrder Completed
ORDER_CANCELLEDOrder Cancelled
ORDER_REFUNDEDOrder Refunded
ORDER_UPDATEDOrder Updated

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.

Events sent to Segment will have Saleor suffix set in event field e.g Order Completed will be tracked as Saleor Order Completed.

Example of successful handling of ORDER_UPDATED webhook:

Pre-requisites

  • Create an account on Twillo Segment.
  • Create a HTTP API source in the Segment Dashboard UI and note down the Write Key for this source.

Installation

  • Go to the Apps section in your Saleor Dashboard. Pick Twilio Segment and Install.

Configuration

  • Paste Write Key into the main configuration form in the app and click Save.

Testing

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.

Troubleshooting

  • Events are not showing in Segment Dashboard
    • Ensure you have set your Write Key in the app configuration screen.
    • Trigger one of the supported events (see application flow section for more details).

Development

To run the application locally, follow the Running Saleor Apps locally article.

Segment app specific instructions can be found inside app GitHub repository.