Get notifications and events
The notification service provides methods for retrieving information about asynchronous events related to your documents.
This service is currently available only in Italy.
The notification service lets you query and retrieve events that occur asynchronously during document processing. These events are organized into categories and subcategories.
Event categories
The only supported category is SdiEvent.
For the SdiEvent category, the supported subcategories are the following:
-
FailedDeliveryNotice
-
RejectionNotice
-
OutcomeNotice
-
DeliveryReceipt
-
FailedDeliveryAttestation
-
InvoiceReceipt
-
DeadlinePassedNotice
-
InvoiceUnwrapped
How it works
The workflow for working with events has two steps:
-
Query the notification service to search for events that match your criteria. The query returns a list of matching results, each with metadata and a link.
-
Use the link returned in each result to retrieve the full event details in JSON format.
Inbound and outbound workflows
Event queries behave differently depending on the workflow:
-
For inbound workflows, use
RecipientIdto filter results by the recipient associated with the transaction. -
For outbound workflows, don't provide a
RecipientId. Providing one returns an empty result set.
Service operation and authentication
- Operation
-
The notification service exposes a single port:
NotificationServicePort. This port uses text encoding, so the Message Transmission Optimization Mechanism (MTOM) is not used. The operation address is provided during onboarding. - Authentication
-
All requests to the notification service require Transport Layer Security (TLS) client certificate authentication. Use the same certificate that has access to the storage area used for the Query call. This requirement applies to both the Query operation and to the HTTPS GET request used to retrieve event details from the URL returned in each
QueryResult. - Encoding
-
The notification service uses text encoding for all messages. Don't enable MTOM for requests to this port.
Query events through the API
You must have a valid client certificate and access to the NotificationServicePort operation. The operation's address is provided during onboarding.
The Query operation searches for events that match the criteria you specify. Each result includes metadata and a link you can use to retrieve the full event details.
The service returns a QueryResults collection. If no events match the criteria, the collection is empty.
Retrieve event details
Query output structure
Each QueryResult returned by the Query operation contains the following elements:
Result type: tns:QueryResults
| Element | Type | Cardinality | Description |
|---|---|---|---|
| QueryResults | tns:QueryResults | 1 | A collection of QueryResult elements. |
| QueryResult | tns:QueryResult | 0..n | Each individual result that matches the query criteria, or an empty collection if there are no matches. |
| SubCategory | xs:string | 1 | The subcategory for this result. Always one of the subcategories specified in the Query request. |
| Metadata | xs:string | 1 | Event metadata in JSON format. The exact format depends on the category and subcategory. |
| Url | xs:string | 1 | A link for retrieving the complete event data in JSON format. Requires Transport Layer Security (TLS) client certificate authentication using a certificate that has access to the same area as the one used for the Query call. |
Metadata format for SdiEvent
For the SdiEvent category, the Metadata JSON object contains the following keys:
-
SdiId
-
FileName
-
MetadataFileName
-
NotificationTime
Retrieve event data
To retrieve the complete event data, send an HTTPS GET request to the Url returned in the QueryResult. Authenticate using TLS client certificate authentication with a certificate that has access to the same storage area used for the Query call.
The response is a JSON document. The format of the JSON depends on the event category and subcategory.
Example query response
<?xml version="1.0" encoding="utf-8"?>
<QueryResults
xmlns:tac="http://www.trustweaver.com/trustarchive/common/v1"
xmlns:i="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.trustweaver.com/trustarchive/notification/v1">
<QueryResult>
<SubCategory>InvoiceReceipt</SubCategory>
<Metadata>
{"SdiId":"202","FileName":"filename_00002.xml",
"MetadataFileName":"filename_00002_MT_001.xml",
"NotificationTime":"2019-05-21T11:13:41.85941"}
</Metadata>
<Url>https://localhost/ta_hubservices/SdiEvent.ashx?Id=1</Url>
</QueryResult>
</QueryResults>
