ποΈ Introduction
Bhutan NDI APIs are inherently asynchronous, meaning that actions get initiated by calling the APIs, and then find out about their completion at a later point in time. Actions canβt complete reliably during a single HTTP request because the other side of the request often involves actions by users, examples include accepting invitations or offers and approving actions. Therefore webhook service can be used by client applications to get the asynchronous responses and it includes registration, subscription, updation and deletion of the client webhook endpoint.
ποΈ Webhook Authentication
There needs to be some form of authentication on the client webhook endpoint registered with the NDI Webhook Service to increase application security. Currently the only form of authentication would be OAuth2 and steps to authenticate client webhooks can be found in this document.
ποΈ Webhook Service Flow for Client Application
- Client application registers a webhook endpoint and authentication with a unique webhook ID
ποΈ Subscribing to Webhook
The Client Application can subscribe to Webhook in order to get the response from the Bhutan NDI Wallet for the status of Relationship, Proof Request and Credential Offer.
ποΈ Unsubscribing to Webhook
The Client Application needs to unsubscribe to webhook once the process is complete.
ποΈ Webhook Responses
Relationship Status
ποΈ Webhook Retries
Webhook service will attempt retries up to 10 times for a webhook message that has already failed. Initially, retries occur with a 2-second interval, doubling with each subsequent attempt, capped at a maximum interval of 30 seconds. Success is indicated by the client's acknowledgement with a status code of 202, signifying acceptance.
ποΈ Webhook Service for Development using Ngrok
For development purposes, the client application listening port can be assigned a public URL via means of the Ngrok tool. Ngrok has to be installed to enable the webhook client application to be exposed outside the local development machine. The technical documentation for ngrok can be accessed from here.