Documentation
Version 2.2.3

Webhook Configuration

A webhook configuration on MFTG Gateway includes two main components.

  • A Trading Station
  • A Webhook URL for receiving “message received” events

Trading Station

This field can be used to filter (receive only a subset of) events based on the destination (station), or to direct or route receive events from different destinations to different webhooks.

Multiple Webhooks

For example, you can set up one webhook to only receive events for messages received or failed by a MY-OWN-ORG station. At the same time you can configure more webhooks to handle incoming messages and send failures for other stations.

The Global Fallback Webhook (Multi-stations)

Your organization can have one global webhook (specifying All Stations) that will handle all messages that do not match a “more specific” webhook.

Webhook URLs

URLs can be either HTTP or HTTPS. When invoked, they should return a HTTP 2xx (success-range) response, ideally with an empty body (payload), for the call to be considered successful.

MFT Gateway’s webhook invocations currently do not follow redirects (HTTP 301, 302, 307 etc.).

If your HTTPS webhook endpoint has a TLS certificate that is not implicitly trusted by MFT Gateway, it may need to be explicitly imported into the system. In such cases, please contact MFT Gateway Team with a copy of the respective certificate.

Enable/Disable Webhooks

To enable webhooks login to MFTG and go to Integrations → Webhooks.

Webhook Integration UI before any integration

Select a Station and give your Webhook URL. Then Click on the Enable Webhook icon.

Webhook Integration Enabled UI

Once a webhook is added from the Webhook Integration page users can update added webhooks, Add more webhooks or Disable all the added webhook.

Clicking on Disable Webhook icon disables all the webhook integrations.

Webhook Integration Disabled UI

Payload Format

Both Received Messages and Send Failures will send a JSON payload with the message details and for a received message eventType will be MESSAGE.RECEIVED.SUCCESS and for a failed message eventType is MESSAGE.SEND.FAILED.

Received Message

Request contains a JSON payload representing the received entity (AS2 message) .A sample payload will look like this :

{
"to": "sample+1@email.com",
"messageAS2ID": "<1609934788.3185.1616041941493@as2gateway.com>",
"messageSubject": "Test message",
"partnerAS2ID": "mypartnerid",
"partnerName": "Partner Name",
"stationAS2ID": "mystationid",
"stationName": "Station Name",
"receivedAt": 1616041942383,
"attachments": [
"AS2/files/mystationid/mypartnerid/inbox/1616042383-195/sample.json",
"AS2/files/mystationid/mypartnerid/inbox/1616042383-195/testfile.txt"
],
"bucketName": "mftg-bucketname.test.mftgateway.com",
"tenantName": "abc.test.mftgateway.com",
"tenantId": 6650967499476,
"tenantEmail": "tenant@email.com",
"eventType": "MESSAGE.RECEIVED.SUCCESS"
}
partnerAS2ID AS2 identifier of the sender (remote trading partner)
stationAS2ID AS2 identifier of the receiver (your trading station)
messageAS2ID AS2 identifier of the received message
messageSubject subject line of the received message
attachments S3 / SFTP path of the received attachment / s
bucketName Name of the S3 bucket where all the attachments will be saved.

Send Failure

Request contains a JSON payload representing the failed entity (AS2 message) . A sample payload will look like this :

{
"to": "sample+1@email.com",
"messageAS2ID": "<16160421683347496@mftgateway.com>",
"messageSubject": "Test Fail Message",
"partnerAS2ID": "mypartnerid",
"partnerName": "Partner Name",
"stationAS2ID": "mystationid",
"stationName": "Station Name",
"failureReason": "SSL Handshake Exception",
"failures": 1,
"lastAttemptTime": 1616042169406,
"attachments": [
"AS2/files/mystationid/mypartnerid/outbox/1616042163434-851/Test.txt"
],
"subject": "Test Fail Message",
"bucketName": "mftg-bucketname.test.mftgateway.com",
"tenantName": "abc.test.mftgateway.com",
"tenantId": 6650967499476,
"tenantEmail": "tenat@email.com",
"eventType": "MESSAGE.SEND.FAILED"
}

In addition to the details in the received message payload, send failure JSON payload has,

failureReason Reason for the message send failure
failures How many times the message has retried.
lastAttemptTime When is the last send attempt