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 endpointYou can either get data pushed to your endpoint or pull data from Minna's endpoint

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 pushOverview of getting total cost and number of subscriptions using data push

Overview of getting total cost and number of subscriptions using data push

Implementing webhooks

  1. Create an endpoint dedicated for receiving webhook messages
  2. Create internal logic to handle specific webhook message topics and data
  3. Store relevant data in a database/cache
  4. Expose a backend endpoint for your frontend to fetch stored data
  5. 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 batchesPros and cons for retrieving data on-demand or in batches

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 neededGet subscription data on-demand when it is needed

Get subscription data on-demand when it is needed

Implementing on-demand

  1. Create an application in your backend system that calls Minna's API (with Authentication)
  2. Preferably store responses in a database/cache
  3. Expose an endpoint that your frontend can get the data from
  4. 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 pullOverview of getting total cost and number of subscriptions using data pull

Overview of getting total cost and number of subscriptions using data pull

Implementing batch job

  1. Create a scheduled job to fetch data from Minna's API’s
  2. Schedule the batch job to a time with low user traffic
  3. Store responses in a database/cache
  4. Expose an endpoint that your frontend can get the data from
  5. 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.

RequirementsOn-demandBatch jobWebhook
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.

ProsOn-demandBatch jobWebhook
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 ← BankMinna → Bank
on-demanddata polling
Minna ← Bankon-demand
Minna ← Bankbatch job(✅)
Minna → Bankwebhook

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.


Did this page help you?