๐ฉโ๐ปEmbedding API
This section describes how to embed a report in your website or your webapp. In order to do so you need to be able to modify your app's code as well as having admin access to Whaly.
Last updated
This section describes how to embed a report in your website or your webapp. In order to do so you need to be able to modify your app's code as well as having admin access to Whaly.
Last updated
The above steps will show you how to generate "Signed URLs" that are a secure way to embed your dashboards into your applications to share data with your customers!
First of all go to Setting > Org admin > General Settings for your org and copy your Client Secret as well as Org Slug you'll need it later.
Then you need to get your Embed Token on the report you want to embed.
In order to do so you need to open the report you wish to embed and click on the share button. Once you see the drawer, you can copy your Embed Token, you'll need it later.
Now you are all set, we can start writing code ๐ค
In order to secure your dashboards and to make sure that nobody can use your embed on their own website, we require you to generate and sign a JSON Web Token.
This JWT token will be used to generate your Signed URL. This way we ensure that only the owner of the Client Secret can create Signed URLs.
In order to avoid leaking your Client Secret, the JWT generation need to be done on your server side applications.
If you include your Client Secret in your Web App, you expose it to anyone reading the code of your webpage, which is very dangerous!
In order to create a signed JWT token, you can check the following code example:
You can then render your iFrame using the templating system you want (React / Vue.js / ...)
In order to set and retrieve your filters API Name you can edit your filter and click on the developer tab and set your apiName. Please note that filters API Name must be unique for a given report and are not set by default.
You can encode several parameters in your JWT such as
The filter payload is an object that takes for keys the filter api name and as value depending on the filter type.
For numeric filters you can pass one numeric (float or int) or an array of numerics
For string filters you can pass on string or an array of string
For dates, you can either pass an array of 2 dates or a more complex object to describe your operation.
Carefull dates must be passed as per the ISO8601 standard.
Passing dates as an array
Name | Is Required | Value | Description |
---|---|---|---|
filters
true
FilterPayload
You can control any filter values through this payload
expiration_date
true
Timestamp
This value indicates when your token will stop be accepted
disable_drills
true
Boolean
This value helps you disable all drills by default on the dashboard