Blog November 29, 2022

Functions: Extensibility to meet the demands of any EDI integration

Headshot of Stedi
Stedi

This post mentions Stedi’s EDI Translate API. Converting EDI into JSON remains a key Stedi offering, however EDI Translate has been superseded by the Stedi EDI platform, an event-driven EDI system that allows you to configure integrations without being an EDI or development expert.

They say that “no two businesses are the same,” and these differences are shown in the wide variation between EDI implementations.
Every EDI implementation is unique in some way – you’ll rarely find a company that doesn’t need some sort of customization. The problem with typical off-the-shelf EDI software is that customers quickly hit limitations and then wait months or years for new features to address their specific needs or unlock valuable new use cases. And when platforms do offer customization capabilities, they often require deep EDI expertise in order to implement.

Introducing Stedi Functions

Stedi Functions is a powerful way for customers to extend Stedi’s functionality to meet any unique requirement. Functions enables you to run your own purpose-built code on Stedi’s platform. You can use Functions to build end-to-end workflows using Stedi’s APIs – Guides, EDI Translate, Mappings, Stash, Buckets, and SFTP – or build custom functionality using open-source libraries, external web APIs, and even custom business logic to address virtually any requirement.

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.

Functions are ready to execute as soon as they are created, without the hassle of provisioning or managing infrastructure. You can invoke a function directly using the API or SDK, or trigger it through an event (e.g. a new EDI file uploaded to a Bucket via SFTP).

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

You can create, update, and invoke functions using the web UI, or programmatically with the Functions API and Functions SDK. See Functions tutorial for a walkthrough of each approach.

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.

Creating a function: In the web UI, you can create a function by clicking Create function, adding code to the editor, and clicking Save.
Your code must include a 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.
Invoking a function: You can invoke your function by clicking Execute. You can also execute functions in the web UI that you created using the API. When the function completes execution, you can view the results, which include the return value and the logs.
Functions UI

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:

Outbound EDI diagram
  1. Accepts a JSON payload (source) for the transaction.
  2. Calls Stash to generate a control number for the EDI document.
  3. 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.
  4. Combines the output from step 3, the envelope information (with control number from step 2), and guide reference before calling the EDI Translate API.
  5. The EDI Translate API validates that the input conforms to the guide schema, and generates the X12 EDI document.
  6. The function saves the EDI output as a file in a bucket.
  7. 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.

Try it out for yourself – build a Function using our web UI. We have a generous free tier, so there is no need to worry about costs when you are experimenting (see pricing). For more details, check out Functions API reference and user guide.
Featured
Functions
Run custom code to power your integrations

Compose end-to-end flows using any combination of Stedi products and external APIs. Create event-driven solutions that scale with your business.

Try Functions Learn more 
Share
Previous
Public Guides: next-generation EDI implementation guides for real-time partner onboarding
Subscribe

Get blog posts delivered to your inbox.

Stedi
System status
+1 332-378-5040
About
PlatformPricingDocumentationCustomers
Backed by
AdditionBloomberg BetaFirst RoundStripeUSV
228 Park Ave S, PMB 58460, New York, NY 10003, USA
Stedi is a registered trademark of Stedi, Inc. All names, logos, and brands of third parties listed on our site are trademarks of their respective owners (including “X12”, which is a trademark of X12 Incorporated). Stedi, Inc. and its products and services are not endorsed by, sponsored by, or affiliated with these third parties. Our use of these names, logos, and brands is for identification purposes only, and does not imply any such endorsement, sponsorship, or affiliation.