LogoLogo
HomeUser GuidesAPI Reference
  • ๐Ÿ‘Welcome to Whaly ๐Ÿณ
  • Team
    • ๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆWhat is a team?
    • ๐Ÿ›ก๏ธSingle Sign On
    • ๐ŸฅทImpersonate
  • Organisation
    • ๐ŸซWhat is an organisation?
    • ๐Ÿ“คUpload your Organisation logo
    • ๐Ÿ”‘Manage Access to your organisation
    • โ“Understanding Licences
    • ๐Ÿ‘ฎUnderstanding User Roles
  • User Management
    • ๐Ÿท๏ธUser Attributes
    • ๐Ÿ‘ญUser Groups
    • ๐Ÿค–Service Accounts
  • Workspace
    • โœ๏ธWorkspace
    • ๐Ÿ“‚Report Folders
    • โœจSharing & Collaboration
      • Share a report to the Web
    • ๐Ÿ“—Catalog
    • โš™๏ธSettings
  • Warehouse
    • ๐ŸฆConnect your Warehouse
    • โš”๏ธAmazon Athena
      • Connect your Athena
    • ๐ŸฎAmazon Redshift
      • Connect your Redshift
    • ๐ŸงฑDatabricks
      • Connect your Databricks
    • ๐Ÿ”ทGoogle BigQuery
      • Connect your BigQuery
      • Grant access to BigQuery datasets
      • Enable multi project support
    • ๐Ÿ˜Postgres
      • Connect your Postgres
      • Whitelisting Whaly IPs
    • โ„๏ธSnowflake
      • Connect your Snowflake
      • Giving access to Snowflake data
  • Models
    • ๐Ÿ’žModels sync
      • Where should my models be managed?
      • dbt Cloud
        • Configuration
        • Exposing models into Whaly
    • ๐Ÿ“ฅPersistence Engine
      • Configuration
        • Snowflake
      • Check Materialisation runs status
  • Workbench
    • ๐Ÿš€Navigating the workbench
    • ๐Ÿ› ๏ธModeling
      • Understanding Datasets
        • General Information
        • Drills
        • Relationships
        • Primary Keys
        • Cache
      • Model Data
        • SQL Models
        • Flow Models
          • Create a Flow
          • Update a Flow
          • Flow steps
            • From Model
            • From Raw
            • Hide Column
            • Filter
            • Lookup
            • Rollup
            • Formulas
            • Group
            • Union
      • Import raw data
        • From your warehouse
        • From third party data
    • ๐ŸงญExplorations
      • Configure an exploration
      • Exploration Templates
      • Tables
        • Configure a table
        • Add related data
      • Metrics
        • Create a Metric
        • Create a Calculated Metric
        • Create Drill Downs
        • Using custom formatting
      • Dimensions
        • Create a dimension
      • Check measure usage
      • Row Level Access
  • Data consumption
    • ๐Ÿ’กExploring data
      • How to explore data
      • Drill Down
      • Forecasting
    • ๐Ÿ’นWhat is a Report?
    • ๐Ÿ“ŠDashboards
      • Create a dashboard
      • Manage tiles
        • Add chart tiles
        • Add text tiles
        • Add navigation tiles
        • Arranging tiles
      • Add a description
      • Share a dashboard
      • Filter a dashboard
      • Push dashboard
      • Delete a dashboard
    • ๐Ÿ“ˆQuestions
      • Create a question
      • Add a description
      • Share a question
      • Push question data
      • Delete a question
    • ๐Ÿ”Refreshing a report
  • Data visualisation
    • ๐ŸŽจTheming
    • ๐Ÿ–Œ๏ธChart your data
      • Bar chart
      • Calendar chart
      • Funnel chart
      • Gauge chart
      • Geo map chart
      • Heatmap chart
      • Interactive map chart
      • Line chart
      • Metric chart
      • Pie chart
      • Retention chart
      • Table chart
      • Treemap chart
      • Waterfall chart
      • Custom time format in time series
  • Content management
    • โญExplorations Section
    • โœ‚๏ธBulk Content Management
  • Embedding
    • ๐Ÿ“ŒEmbed in Business apps
      • Notion
      • Clickup
      • Hubspot
      • Google Chrome
        • ๐ŸŒฑInstall
        • โš™๏ธConfigure the Chrome extension
    • ๐Ÿ‘ฉโ€๐Ÿ’ปEmbedding API
    • ๐ŸชŸPartner Portal
  • Workflows
    • ๐Ÿš€Push
      • Configure a Push
      • Manage Push
    • ๐Ÿ’ผManage Installed Actions
    • โšกActions catalog
      • Airtable
      • Google Sheets
      • Slack
      • Sendgrid
      • Webhook
  • Platform concepts
    • โœณ๏ธQuery Mode
    • ๐Ÿ’ซCaching
  • Guides
    • โ›‘๏ธSupport
  • User
    • ๐ŸคฉUpload your profile picture
  • Connectors
    • ๐Ÿ”ŒConnect your Sources
    • โš™๏ธWarehouse setup
      • BigQuery
        • Configure a Cloud Storage cleaning rule
      • Snowflake
    • โ˜๏ธWhitelisting Whaly connectors IPs
    • ๐Ÿ”SSH Tunneling
    • ๐Ÿ„Schema drift
    • ๐Ÿ”Replication method
    • ๐Ÿง™Source monitoring
    • ๐ŸŽSource catalog
      • Community
        • Github Stars
        • Slack
        • Orbit
      • Database
        • PostgreSQL / Postgres
          • ๐Ÿ’กTip: Extracting the relationships
        • MariaDB / MySQL
      • eCommerce
        • WooCommerce
      • Engineering
        • Github
      • Finance
        • Brex
        • Pennylane
          • Pennylane (Redshift) - General Ledger & Trial Balance
          • Pennylane API - Customer Invoices
        • Qonto
        • Stripe
        • QuickBooks
      • Marketing / Growth
        • Facebook Ads
        • Google Ads
        • Google Analytics
          • Google Analytics (V4)
          • Google Analytics (Universal Analytics)
        • LaGrowthMachine
        • lemlist
        • LinkedIn Ads
        • Salesloft
      • No-Code
        • Airtable
        • Bubble
        • Google Sheets
      • Support
        • Intercom
      • Product
        • Amplitude
        • MixPanel
        • Segment
      • Sales / CRMs
        • Aircall
        • Pipedrive
        • Hubspot
        • Recruit CRM
        • Salesforce
Powered by GitBook
On this page
  • Setting up your report for embedding
  • Embed reports in your app
  • Access your filters API Name
  • JWT Params

Was this helpful?

  1. Embedding

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.

PreviousConfigure the Chrome extensionNextPartner Portal

Last updated 2 years ago

Was this helpful?

Setting up your report for embedding

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 ๐Ÿค“

Embed reports in your app

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:

// Example for a webserver running in Node.js
// The same algorithm and JWT librairies needs to be ported in your backend programming language (PHP, Python, Go, ...))

import jwt from 'jsonwebtoken';

// This routine must happen on server side as your secret should remain secret
const embedToken = "<MY_EMBED_TOKEN>";
const clientSecret = "<MY_CLIENT_SECRET>";
const orgSlug = "<MY_ORG_SLUG>";

// We require you to generate a payload with the default filters you want to pass
// if you don't want to pass filters just input an empty object {}
// the filter payload is an object which keys are the apiName of the filter
// and the value is the value that you want to pass

const payload = {
    filters: { 
        myFilter: 1 
    }, 
    expiration_date: Date.now() + 24 * 60 * 60 * 1000 // valid for 24h
};

// Generate and sign your JWT, please use the HS256 algorithm
const myToken = jwt.sign(payload, clientSecret);

// Generate the embed url
const embed_url = `https://app.whaly.io/${orgSlug}/embed/report/${embedToken}?token=${myToken}`

You can then render your iFrame using the templating system you want (React / Vue.js / ...)

<iframe src="<%= embed_url %>" 
  frameborder="0" 
  style="width: 100%;height: 600px" 
  allowfullscreen>
</iframe>

Access your filters API Name

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.

JWT Params

You can encode several parameters in your JWT such as

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

FilterPayload

The filter payload is an object that takes for keys the filter api name and as value depending on the filter type.

{
    <filterApiName>: FilterValuePayload
}

FilterValuePayload

For numeric filters you can pass one numeric (float or int) or an array of numerics

{
    myNumeric: 1.2,
    myNumericArray: [4.21, 1,337]
}

For string filters you can pass on string or an array of string

{
    myString: "rick",
    myStringArray: ["rick", "morty"]
}

For dates, you can either pass an array of 2 dates or a more complex object to describe your operation.

Passing dates as an array

 {
    myDate: ["2021-01-01T00:00:00.000Z", "2021-12-01T00:00:00.000Z"] 
 }

Carefull dates must be passed as per the standard.

๐Ÿ‘ฉโ€๐Ÿ’ป
ISO8601
Getting your client secret
Get your embed token
Setting an API Name