Functions: Extensibility to meet the demands of any EDI integration
This post mentions Stedi’s EDI Translate API. Converting EDI into JSON remains a key Stedi offering, however EDI Translate has been superseded by Stedi Core, an event-driven EDI system that allows you to configure integrations without being an EDI or development expert.
Introducing Stedi Functions
Functions can serve as an orchestration layer to link various steps in an EDI workflow. For example, you can build a function to pick up an EDI file from a designated location (e.g. an SFTP folder), perform validation and translate the EDI to JSON, transform the JSON to an internal schema, post this data to a custom backend API, and send an acknowledgment to the trading partner – all in one seamless flow.
Features
- Built for extensibility: Include functionality from open-source libraries, external web APIs, or custom business logic to handle virtually any business use case.
- Seamless orchestration: Stitch together various functional steps with tailored sequence and logic to build an EDI transaction flow.
- Event-driven execution: Trigger functions in response to events from Buckets (such as file uploads via SFTP). You can also invoke functions directly via API or SDK.
- Automated scaling: Functions run on high-availability infrastructure that automatically scales up with the number of requests.
- Automated deployment: Your code is ready to execute within seconds. No need to provision or manage infrastructure to deploy your code.
Functions currently supports JavaScript or any other language that compiles to JavaScript (such as TypeScript).
Using Stedi Functions
The web UI allows you to experiment, build and test your functions. Below is a high-level overview of creating and executing a function using the web UI.
handler
function with two parameters: event
parameter that lets you pass JSON data into the function, and context
parameter that contains information about the environment. You can include any logic, including external API calls, and return any value from the function. You cannot include libraries or additional packages using web UI, for that you will have to use the SDK or API.Using Stedi function for an outbound EDI flow
Now that we have seen the basics, let’s look at a real-world solution built using Stedi Functions. In this example, a Stedi function is used to connect various Stedi offerings to generate an EDI document and then send it to a trading partner.
The function is called with a JSON payload representing the source data for the EDI transaction. The function performs several steps, as illustrated in the diagram below:
- Accepts a JSON payload (source) for the transaction.
- Calls Stash to generate a control number for the EDI document.
- Passes the JSON payload to Mappings using a predefined mapping that maps the internal schema of the payload to a target JSON Schema of a guide specific to the trading partner.
- Combines the output from step 3, the envelope information (with control number from step 2), and guide reference before calling the EDI Translate API.
- The EDI Translate API validates that the input conforms to the guide schema, and generates the X12 EDI document.
- The function saves the EDI output as a file in a bucket.
- A trading partner can retrieve the EDI from Buckets using SFTP.
Stedi Functions is now Generally Available
Stedi Functions is the connecting tissue that lets you orchestrate various steps in an end-to-end EDI workflow. Stedi Functions also gives you unlimited extensibility to bring in functionality from third-party APIs, open-source libraries, or custom business logic to build an EDI implementation for your needs. There is no need for deployment or provisioning infrastructure to run a function. With the API access, you can integrate a Stedi function into your own tech stack.
Compose end-to-end flows using any combination of Stedi products and external APIs. Create event-driven solutions that scale with your business.
Get blog posts delivered to your inbox.