Connectors

Contact support

Embedding

SaaS companies can embed Peliqan widgets into their own product, in order to offer a wide range of connectors inside their own SaaS platform. The embedding is seamless and offers your end-customers a user-friendly UI to add connections to other platforms that they use, right from within your SaaS platform.

Once your customer added a connection, data is automatically synced to Peliqan and you can access the data through Peliqan's unified API, without the need to communicate directly to hundreds of different APIs. Instead, with a single integration, you can enable integrations between your SaaS platform and hundreds of other SaaS platforms such as ERP, CRM, Accounting, HRM & ATS, PIM, eCommerce etc.

image

Embedding

Embedding is performed in 2 steps:

  1. Fetch an integration_token for a specific end-customer. You identify the end-customer using the external_id which is your unique id for the customer.
  2. Add JS code into your product that renders e.g. a button "Add connection". When the button is clicked, a JS function is invoked that opens a modal, in which the user can choose and add a connection.

Embedding step 1: fetch an integration_token

Make a server-side API call to fetch a short-lived integration_token for a specific end-customer using your unique customer ID (external_id in Peliqan):

POST https://app.eu.peliqan.io/api/subaccount/integrate/?

Authorization: JWT <partner_token>

Request Payload

{
    "external_id": user.id,  # unique entity ID
    "first_name": user.first_name,
    "last_name": user.last_name,
    "email": user.email,
    "company_name": user.organization.name, # your user's organization name
}

Embedding step 2: add the Peliqan widget in your own UI

Add inside the <head> tag of your UI:

<script type="module" src="https://peliqan.io/embed/v1/peliqan-integration.js"></script>

Add a button for users to add connections (integrations):

<div id="peliqan-integration-button">Add connection</div>

Add the following script in your page:

<script type="text/javascript">
  // Event listener for button click
  const button = document.getElementById('peliqan-integration-button')
  button.addEventListener('click', async function () {
    const token = "xxx" // Peliqan integration_token for current end-customer (fetch server-side)
    const base_url = "https://yourwhitelabel.peliqan.io" //replace with your Peliqan whitelabel URL
    const baseUrl = new URL(base_url)
    
    // Instantiate the Peliqan integration
    Peliqan.setUp({
      integrationToken: token, 
      baseUrl:`${baseUrl.protocol}//${baseUrl.hostname}`,
      onConnected: handleOnConnected, // Optional call-back function, after a successful connection is made
      loaderHtml: '' // Optional custom loader HTML element that will override the default loading element
    })
    
    // Open the Peliqan integration modal where user can select & add a connection
    Peliqan.openIntegration()
  })
</script>

Note that your end-customer will automatically be provisioned on Peliqan with a new sub-account, linked to your Peliqan partner account, the first time you invoke the Peliqan integration with a token for that specific end-customer.

Callback function

You can optionally implement a call-back function in JS that Peliqan will invoke once a user successfully added a connection. This allows you to e.g. handle the new connection in your front-end. Example:

<script type="text/javascript">
	const handleOnConnected = (responseData) => {
     console.log(responseData)
}
</script>

Get data

From your backend, you can make API calls to Peliqan to e.g. retrieve data from end-customer connections, or to activate data integrations (data syncs).

One scenario is to request a list of active customers on Peliqan, for each request the active connections, and for each connection fetch new data:

1. LIST CUSTOMERS AND FOR EACH CUSTOMER:
		2. LIST CONNECTIONS FROM CUSTOMER AND FOR EACH CONNECTION:
				3. GET DATA FROM CONNECTION

It's also possible retrieve data using SQL queries to the Peliqan data warehouse, using a database connection per end-customer.

API authentication

You can use your partner token to request e.g. a list of your end-customers, that are active on Peliqan. Example:

GET https://app.eu.peliqan.io/api/subaccount
Authorization: JWT <partner_token>

You need to fetch a separate subaccount token, in order to fetch data for a specific customer or to interact with a subaccount on Peliqan. Fetch a long-lived (non-expiring) JWT token for one end-customer:

GET https//api.eu.peliqan.io/api/subaccount/identity/?external_id=123
Authorization: JWT <partner_token>

Fetch active customers on Peliqan

Each end-customer has a Sub account under your Partner account in Peliqan:

GET https://app.eu.peliqan.io/api/subaccount
Authorization: JWT <partner_token>

Fetch a list of databases from a customer

By default your end-customer will have one data warehouse in Peliqan. Data warehouses and databases are called “applications” in the Peliqan API:

GET https://app.eu.peliqan.io/api/applications/?exclude_tables=1
Authorization: JWT <sub_account_token>

Read data

List tables:

GET https://app.eu.peliqan.io/api/database/tables/database/{database_id}/
Authorization: JWT <sub_account_token>

Read rows (data) from table:

GET https://app.eu.peliqan.io/api/database/rows/table/{table_id}/?user_field_names=True
Authorization: JWT <sub_account_token>

Real-time versus Scheduled data reading

  • In a real-time scenario, you invoke logic on your backend, from the JS call-back function described above. This allows you to e.g. fetch data from your customer, immediately after a connection was added.
  • In a scheduled scenario, you make API calls to Peliqan on e.g. an hourly or daily basis, to fetch data from your customers.