Free cookie consent management tool by TermsFeed 4 ways to integrate MFT Gateway AS2 with business workflows | Aayu Technologies Cookies preferences
Home Blog 4 ways to integrate MFT Gateway AS2 with business workflows

4 ways to integrate MFT Gateway AS2 with business workflows

Udith Gunaratna
Udith Gunaratna

MFT Gateway is a software as a service (SaaS) solution that provides managed file transfer capabilities as its name suggests. AS2 (which stands for Applicability Statement 2) is a well established secure file transfer protocol that is widely used by industries such as logistics, healthcare and retail to exchange EDI X12 and EDIFact documents.

If you have a MFT Gateway account (which comes with a 30-day free evaluation period), you can exchange any type of files with your trading partners over AS2, as easily as exchanging emails, but with guaranteed security and reliability.

Although you can simply manage these file exchanges manually over the web interface of MFT Gateway, more often than not you will need them to be integrated with your other systems such as stock management systems or CRMs to automate your business workflows. Therefore, in this article, let’s discuss 4 ways you can integrate your MFT Gateway account with such other systems to send or receive files over AS2 swiftly.

  1. Webhooks
  2. REST API
  3. AWS S3
  4. SFTP

1. Webhooks

MFT Gateway Webhook integration can be used to receive certain types of events to a pre-specified HTTP or HTTPS URL. Currently, MFT Gateway supports the following 3 types of Webhook events. All these events are JSON formatted and will contain the field named eventType to indicate the type of event. In addition, they will contain basic information of the corresponding message such as message ID, timestamp, partner ID, station ID, path to files attached to the message, etc.

  • Message Received (MESSAGE.RECEIVED.SUCCESS) - This event indicates that you have received a new message from one of your trading partners.
  • Message Sent (MESSAGE.SEND.SUCCESS) - This event indicates that a message you have previously submitted has been successfully sent to the trading partner.
  • Message Sending Failed (MESSAGE.SEND.FAILED) - This event indicates that a message you have previously submitted has failed to be sent to the trading partner.

In the Webhook configuration, you have the capability to either provide a single Webhook endpoint/URL to receive events related to all your trading stations, or you can provide separate endpoints to each or some of the stations. This makes it possible to process events of different stations via different systems such as processing events of staging stations via staging systems and production stations via production systems.

Since Webhooks can only be used to get basic details related to different events, they are usually used in tandem with other integration mechanisms to implement fully automated workflows.

👉  Webhook Documentation

2. REST API

Nowadays providing a REST API has become a norm for most SaaS systems. Accordingly, MFT Gateway also has a comprehensive REST API, which contains the necessary operations to enable fully automated workflows. Following are the main operations provided by this REST API.

  • Authorization
    • Retrieving auth tokens
    • Refreshing auth tokens
  • Sending
    • Send message
  • Inbox
    • List received messages
    • Retrieve a received message
    • Mark a received message as Read/Unread
    • Retrieve attachments(files) of a received message
    • Retrieve MDN of a received message
    • Delete a received message
    • Bulk delete received messages
  • Outbox
    • List sent/queued/failed messages
    • Retrieve a sent/queued/failed message
    • Retrieve attachments(files) of a sent/queued/failed message
    • Retrieve MDN of a sent/queued/failed message
    • Delete a sent/queued/failed message
    • Bulk delete sent/queued/failed messages

Following is a simple workflow demonstrating how you can use these endpoints to retrieve and process incoming messages from your trading partners. In case you have configured Webhooks for received messages, you can omit the received message listing (Step 1) and just start the processing from Step 2 onwards when a Webhook notification is received.

REST API Integration

👉  REST API Documentation

3. AWS S3

As you may be already aware, MFT Gateway keeps your exchanged files on a dedicated S3 bucket, so that you will get the benefits of all the security and reliability guarantees provided by S3. Within this bucket, these files are organized based on the corresponding AS2 station and trading partner, so that it is very easy to distinguish them.

Files received
AS2/files/<station-AS2-id>/<partner-AS2-id>/inbox/<timestamp-random-number>

Files to be sent
AS2/send/<station-AS2-id>/<partner-AS2-id>/

Files sent
AS2/files/<station-AS2-id>/<partner-AS2-id>/outbox/<timestamp-random-number>

In addition to keeping these files in S3, MFT Gateway also provides the capability to integrate your other systems directly with this bucket via the S3 integration feature. When you enable S3 integration on the MFT Gateway console, you will receive an AWS IAM keypair that has permissions to access your S3 bucket. Then you can utilize the S3 REST API, S3 SDK or even the S3 CLI to retrieve/put files into these locations.

When retrieving received messages via S3 integration, the most trivial approach is to configure your system to poll the received file path periodically. If you are using Webhook integration along with S3 integration, you can configure the system to listen for the Webhook message received event and then pick those files when available. This could reduce your network cost as well as the processing cost.

Since this S3 bucket resides in MFT Gateway’s AWS account, it is not possible for you to set up advanced integrations such as subscribing to S3 events or replicating its content to your own S3 bucket. In case you have such a requirement, feel free to contact the MFT Gateway team. They will evaluate your requirements and assist you with the best possible approach.

👉  S3 Integration Documentation

4. SFTP

In the corporate world, sometimes we may have to work with existing legacy systems due to various reasons. Perhaps the other systems are tightly bound with this legacy system and it is not within your budget to upgrade them all. Perhaps you or the decision makers in your organization are satisfied with the current system and do not want to take an unnecessary risk by upgrading them.

For whichever reason, there may be situations where you cannot use the REST API or the S3 integration with your existing legacy systems. For such cases, MFT Gateway also provides a SFTP (Secure File Transfer Protocol) integration, which is supported and popular among most legacy systems.

When you enable SFTP integration on the MFT Gateway console, you need to provide a username for the SFTP access. Then if you already have an SSH key pair, you can upload the public key to be used with SFTP, or otherwise you can ask the MFT Gateway to generate a new SSH key pair. In the later approach, you can download the generated private key from the web UI itself.

Once this is set up, you can access your MFT SFTP directory using any SFTP client available. The structure of the SFTP directory will be the same as the S3 bucket structure.

Files received
AS2/files/<station-AS2-id>/<partner-AS2-id>/inbox/<timestamp-random-number>

Files to be sent
AS2/send/<station-AS2-id>/<partner-AS2-id>/

Files sent
AS2/files/<station-AS2-id>/<partner-AS2-id>/outbox/<timestamp-random-number>

Similar to S3, When retrieving received messages via SFTP integration, the most trivial approach is to configure your system to poll the received file path periodically. But if you can use Webhook integration along with SFTP integration, you can configure the system to listen for the Webhook message received event and then pick those files from SFTP when available. This could reduce your network cost as well as the processing cost.

👉  SFTP Integration Documentation


Sign Up for 30 day Free Trial! Stay tuned for more updates!

Udith Gunaratna

Udith Gunaratna

Udith is the Chief Technology Officer at Aayu Technologies. With over 9 years of experience in the enterprise software industry, he has been instrumental in architecting, developing, and maintaining a range of enterprise software solutions, particularly B2B communication software, with a significant focus on cloud technologies.


MFT gateway
AS2 Connection as a service for B2B EDI/ file transfer
Start Free Trial View Pricing