The most common use case for webhooks is sending processed transaction data to an external system. You can also use Stedi events to trigger alerts in systems like Slack and PagerDuty or to implement more advanced functionality.
An auth defines how to authenticate with a specific API. You can use a single auth configuration across multiple destinations. Stedi supports the following types of auth configurations.
|API Keys||The API keys as headers in the request. The most common version is ‘bearer tokens’.|
|Basic Auth||HTTP Basic Auth, where you provide a username and password.|
|OAuth 2.0||OAuth 2.0 Auth, where you can set the Authorization endpoint and parameters, the HTTP method, a client ID, and a client secret.|
There isn’t a ‘no-auth’ option with Destinations, but you can achieve this by configuring the API Keys auth to use arbitrary values for
Header name and
Header name: x-stedi-noauth and
Value: dummy). Since the receiving API isn’t authenticating the call, it will ignore these values and accept the request.
To create a new auth:
- Go to Events > Destinations.
- Click Add new auth.
- Enter a name for the auth.
- Choose the appropriate Authentication type.
- Enter the details for the auth.
- Click Done.
The destination defines which URL endpoint should be called when the destination is invoked, and which HTTP method to use (
Destinations are scoped to a single auth. However, you might have multiple destinations for a single system integration, each with a different endpoint. For example, one endpoint for creating Sales Orders and another for Item Fulfillments.
To create a new destination:
- Go to Events > Destinations.
- Under the desired auth, click Add destination.
- Enter a name.
- Choose a Method and enter an Endpoint.
- (Optional) Enter a Max executions per second. Use this to avoid overloading the target service.
Event bindings allow you to specify which events trigger the destination webhook. You can create multiple event bindings for a single destination. For example, you may want to create an event binding for each type of transaction you want to send to your API.
Create event binding
To create a new event binding:
- Go to Events > Destinations.
- Click the desired destination.
- Click the Edit tab.
- Click Add event binding.
- Choose an Event detail-type and complete the remaining fields.
- (Optional) Select a mapping to transform the payload before sending it to the destination. This is only available for
fragment.processed.v2events in accounts with Cloud and Enterprise plans.
- Click Create binding.
Send transaction data
You can create a
transaction.processed.v2 event binding to send processed transaction data to external APIs. If the transaction set uses fragments to split the payload into smaller chunks, you can also configure an event binding for
You can optionally add a Stedi mapping to both types of event bindings to transform the payload shape before sending it to the destination.
Stedi emits a
transaction.processed.v2 event each time it processes a transaction. An EDI file can contain multiple transactions, so a single EDI file can produce multiple events that each invoke the configured destination webhook. When you use a
transaction.processed.v2 event to trigger a destination, Stedi includes the Guide JSON transaction in the payload along with the event data.
The transaction itself is only included as part of the event if the whole response (payload + event) is < 1MB. Otherwise, the event will contain a section that specifies the transaction was too big to be included and you can retrieve the actual transaction by making a request to the
When fragments are enabled, the
transaction.processed.v2 payload includes an empty array in place of the fragmented segment. Stedi then emits one
fragment.processed.v2 event for each fragment within the processed transaction. The event contains a link you can use to retrieve the fragment data as well as information about the original transaction, such as the ISA and GS headers.
Refer to Events for complete details and examples.
Configure event bindings
fragment.processed.v2 as the Event detail-type and complete the following fields:
- (Optional) Choose a Transaction set ID. This is useful if you want to send different transaction sets to different endpoints. For example, you could send 850 Purchase Orders to one endpoint and 860 Purchase Order Change Requests to another.
- (Optional) Choose a Partnership ID. This is useful if you want to send transactions from different partners to different endpoints. For example, you could send transactions from Walmart to one endpoint and transactions from Target to another. This is less common.
- (Optional) Select a Guide. This is useful if you want to send transactions parsed using different guides to different endpoints. For example, you may receive
005010850 Purchase Orders from two different retailers, and those retailers have different guides. Since the transaction payloads will differ, you may want to send them to different API endpoints within your system.
- (Optional) Select a Guide + Mapping. This is useful if you want to send transactions parsed using different guides to the same endpoint. For example, you may receive
005010850 Purchase Orders from two different retailers, and those retailers have different guides. Since the transaction payloads will differ, you can choose a mapping to convert the 850s to your API shape.
Transform data with mappings
Stedi integrations use Guide JSON, a JSON format that closely reflects the structure of an EDI transaction. You may need to reshape transaction data from Guide JSON format into the shape required for the target API. For example, you may need to rename fields, add or remove fields, or change the data type of a field.
You can use the Mappings module to transform your payload into the required shape before sending it to a destination.
To add a mapping:
- Use the mappings editor to create a transformation for the event. You must choose the event when creating the source schema. Refer to the mappings documentation for instructions.
- Select the mapping in the Mapping menu when creating your event binding. You will only be able to select mappings that use the same guide you selected in the event binding.