Notifications Reference
Less than to read
In order to receive notifications from Sage Banking Service via the Notification Service, a consuming application must subscribe to the Notification Service via their API. Consuming apps will receive the notification as a webhook at an endpoint defined in the subscribe request. For testing purposes you can use webhook.site as the endpoint. A single webhook can contain multiple events (when events are triggered concurrently).
Prerequisites
In order to receive webhooks from Notification Service, a consuming application needs to have there applicationId ‘registered’ with Notification Service - this can be done by contacting the Smart Transactions team, and they will run a script to enable your application.
Notification Service Subscribe
You can find an example flow in Banking Service’s shared Postman collection (https://bankingserviceteam.postman.co/workspace/Banking-Service-Postman-Collect~34e333a7-0a08-409a-9632-6029032019ff/request/351794-cdd2f10c-c7aa-420f-9d00-0d6d71d06c68) in the Banking Cloud Consumer API folder.
Subscription Flow
- Create Organisation (Auth service)
- Create a Company (Auth service)
- Create a JWT token for this Company (Auth service)
- Create a subscription for this Company (Notification Service)
bankAccountCreated Notification
Once you have created a subscription to the Banking Service, now you can listen to the ‘bankAccountCreated’ event. This occurs when a user follows the usual bank feeds onboarding flow through consumer API. Once a bank account has been posted successfully, the event will be sent to Notification Service for consumption.
An optional query parameter can be included while calling the /indirectlinkaccount endpoint, for example: /indirectlinkaccount?bankid=somebankid&e2e=someidentiferhere. The e2e parameter allows clients to provide an identifier which then offers identification for that particular onboarding, and is included in the details posted to Datamesh.
Webhook Fields
Source
: This should match the source value in your subscribe post. Environment values [prod01/dev01/pre01/snd01] i.e bnkc-. Type
: The type of webhook, currently only ‘bankAccountCreated’ is available.Subject
: This will be the ‘e2e’ paramter you have provided (in any other events other then bankAccountCreated this will be bankAccountId).ResourceType
: Currently only bankAccountCreated available.NetworkId
: applicationId + subject.
Example
[{
"Id": "00e93fca-c57b-61f5-489e-bd1e8fd62543",
"Source": "bnkc-dev03",
"SpecVersion": "1.0",
"Type": "bankAccountCreated",
"Subject": "a2ec48d7-7271-49aa-9115-d3335f5c3bfd",
"DataContentType": "application/json",
"Data": {
"TraceParent": "00-914841aac850ddf67e255c596b06a779-461dd5628b459dda-00",
"SubscriptionId": "9ce0c1da-ae8c-4484-ade7-eee790a882d7",
"NetworkId": "sage.sbc.accounts+a2ec48d7-7271-49aa-9115-d3335f5c3bfd",
"ResourceType": "bankAccountCreated",
"ExpirationDateTime": null,
"ServiceAttributes": {
"CompanyId": "5ea56bc8-073b-4893-8066-485042c6a6da"
}
}
}]
bankTransactionsReceived Notification
Once you have created a subscription to the Banking Service, you can now listen to the bankTransactionsReceived
event. This event will be sent to the Notification Service to be consumed when all transactions for a given bankAccount
are received in banking. It includes the transactions that are synced during onboarding, regular sync, and transaction import.
Webhook Fields
Source
: This should match the source value in your subscription post. Environment values [prod01/dev01/pre01/snd01], e.g.,bnkc-snd01
.Type
: The type of webhook, currently onlybankTransactionsReceived
is available.Subject
: This will be thebankAccountId
.ResourceType
:bankTransactionsReceived
.NetworkId
:applicationId
+subject
.
Example
[{
"Id": "28c780b2-8a85-a0b5-fa97-409a8e6789fd",
"Source": "bnkc-dev03",
"SpecVersion": "1.0",
"Type": "bankTransactionsReceived",
"Subject": "a2ec48d7-7271-49aa-9115-d3335f5c3bfd",
"DataContentType": "application/json",
"Data": {
"TraceParent": "00-17547472aeeae421ff78b24b8513d21b-88963cd258bef9ad-00",
"SubscriptionId": "9ce0c1da-ae8c-4484-ade7-eee790a882d7",
"NetworkId": "sage.sbc.accounts+a2ec48d7-7271-49aa-9115-d3335f5c3bfd",
"ResourceType": "bankTransactionsReceived",
"ExpirationDateTime": null,
"ServiceAttributes": {
"BankAccountId": "a2ec48d7-7271-49aa-9115-d3335f5c3bfd",
"CompanyId": "5ea56bc8-073b-4893-8066-485042c6a6da"
}
}
}]