Vue.js

Add Javascript SDK to your Front-end

First, install @integration-app/sdk NPM package:

npm install @integration-app/sdk

Then, initialize the SDK with an Authentication Token:

import { IntegrationAppClient } from '@integration-app/sdk'

const integrationApp = new IntegrationAppClient({
  // Test authentication token. You will need to replace it with the real one.
  token: '',
})

In this example we use the test token you can find on the Settings page of your workspace.
You will need to replace it with a real authentication token later (see Authentication).

To verify that everything works, let's open our drop-in integration UI:

await integrationApp.open()

In the end your basic Vue.js setup may look like this:

<script setup lang="ts">
import { IntegrationAppClient } from "@integration-app/sdk";

const token = await tokenResp.json();

const integrationApp = new IntegrationAppClient({
  token,
});
</script>

<template>
  <div v-if="!token">Loading...</div>
  <div v-else>
    <button class="btn btn-sm btn-outline m-2" v-on:click="integrationApp.open">
      Configure Integrations
    </button>
  </div>
</template>

Dynamic Token

If it is more convenient for you to fetch token dynamically instead of providing static value, you can use fetchToken instead:

import { IntegrationAppClient } from '@integration-app/sdk'

const integrationApp = new IntegrationAppClient({
  // Test authentication token. You will need to replace it with the real one.
  async fetchToken() {
    return '';
  },
})

This option also automatically handles token expiration. If SDK was initialized long ago and token had time to expire, it will be automatically re-fetched before making new API requests.

SDK Reference

To see the full list of SDK methods check out the JavaScript API Reference.