Notifications Service
For a consuming application to receive Banking Service notifications, it needs to subscribe to the Notification Service through their API. Consuming applications will receive the notification as a webhook at an endpoint defined in the subscription 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
To receive webhooks from Notification Service, a consuming application needs to have the applicationId ‘registered’ with the service. This can be done by contacting the Smart Transactions team, and they will run a script to enable your application.
Notification Service subscription
You can find an example flow in Banking Service’s shared Postman collection in the Banking Service Consumer API folder.
Subscription flow
- Create organisation (Authentication Service)
- Create a company (Authentication Service)
- Create a JWT token for this company (Authentication Service)
- Create a subscription for this company (Notification Service)
BankAccountCreated notification
When you’ve created a subscription to the Banking Service, the ‘bankAccountCreated’ event can be triggered. Thisocc urs when a user follows the usual bank feeds onboarding flow through the consumer API. When a bank account has been posted, 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 end-to-end parameter allows clients to provide an identifier which offers identification for that particular onboarding. This is then 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] for example, bnkc-. Type
: The type of webhook, currently only ‘bankAccountCreated’ is available.Subject
: This will be the end-to-end parameter you have provided. In any other events other then bankAccountCreated this will be bankAccountId.ResourceType
: Currently only bankAccountCreated available.NetworkId
: applicationId and 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"
}
}
}]