Retrieve data
Widgets are powered by Minna's API products, to enable the different features you will need to exchange data. There are two different ways of exchanging data, Push and Pull.
- Push: Minna actively sends updates to an endpoint that you expose. Minna offers a Webhook solution that accomplishes this.
- Pull: You fetch data from the Identify API that Minna exposes, either directly (on-demand) or as scheduled jobs.


You can either get data pushed to your endpoint or pull data from Minna's endpoint
Push
With a push approach there is only the webhook solution to consider.
Webhook
Using a webhook integration, Minna push total cost and number of subscriptions to you whenever we detect changes to the users subscriptions. We recommend that you store this data in a cache or database to use later when the user should view the information.


Overview of getting total cost and number of subscriptions using data push
Implementing webhooks
- Create an endpoint dedicated for receiving webhook messages
- Create internal logic to handle specific webhook message topics and data
- Store relevant data in a database/cache
- Expose a backend endpoint for your frontend to fetch stored data
- Your frontend calls your backend endpoint to get data
Pull
In the case that you decide to pull data from Minna, that comes with additional considerations. Either you can pull on-demand or schedule a batch job. While the on-demand approach is simple, in the way that you only need to send requests from you backend application, it come with the downside of higher latency. Batch jobs on the other hand mitigates the latency issues. However, batch jobs requires your infrastructure to support scheduled jobs and caching.


Pros and cons for retrieving data on-demand or in batches
On-demand
With an on-demand approach you call Minna's API's directly as an effect to an action happening on your side, such as user login or clicking a button. All calls should go via your backend application and not directly between your client and Minna's API.


Get subscription data on-demand when it is needed
Implementing on-demand
- Create an application in your backend system that calls Minna's API (with Authentication)
- Preferably store responses in a database/cache
- Expose an endpoint that your frontend can get the data from
- Your frontend calls your backend endpoint to get data
Batch job
Using a batch job integration you pull the monthly cost and number of subscriptions on a scheduled basis. Minna detects subscriptions by analyzing the users accounts and transactions. By using data polling on a scheduled basis Minna can have the subscriptions updated and ready whenever you want to refresh your data. Without data polling, Minna will have to detect the subscriptions at the same time as you want to refresh your data. This case is illustrated in Sharing data.


Overview of getting total cost and number of subscriptions using data pull
Implementing batch job
- Create a scheduled job to fetch data from Minna's API’s
- Schedule the batch job to a time with low user traffic
- Store responses in a database/cache
- Expose an endpoint that your frontend can get the data from
- Your frontend calls your backend endpoint to get data
Requirements
As you can see in the following matrix, on-demand requires very little on your infrastructure, while batch jobs and webhooks have more requirements.
Requirements | On-demand | Batch job | Webhook |
---|---|---|---|
Requires batch support | ❌ | ✅ | ❌ |
Requires dedicated PUSH endpoint | ❌ | ❌ | ✅ |
Requires caching | ❌ | ✅ | ✅ |
Pros and cons
On-demand, while being simpler from an infrastructure perspective, has none of the benefits that batch jobs and webhooks have.
Pros | On-demand | Batch job | Webhook |
---|---|---|---|
Scheduled | ❌ | ✅ | ❌ |
Reactive (instant updates) | ❌ | ❌ | ✅ |
Reduced network latency | ❌ | ✅ | ✅ |
Reduced overall latency | ❌ | ✅ | ✅ |
Shorter loading times | ❌ | ✅ | ✅ |
Retrieve and share
Once you have settled on how you want to retrieve data, you should also think about how to Share data. The following matrix summarizes all the different combinations of retrieving and sharing data:
Minna ← Bank | Minna → Bank | ||
---|---|---|---|
on-demand | data polling | ||
Minna ← Bank | on-demand | ✅ | ✅ |
Minna ← Bank | batch job | (✅) | ✅ |
Minna → Bank | webhook | ❌ | ✅ |
Two notable combinations are retrieving with batch job + sharing on-demand and retrieving with webhook + sharing on-demand. The first case requires you to both share transaction data in your batch job and retrieve subscription data. The second case does not make much sense since the webhook solution is reactive. When using webhooks, Minna should pull data from you using data polling.
Updated over 1 year ago