An embeddable widget for integrating Airbyte's data synchronization capabilities into your application.
Easy, lightweight integration for Airbyte Embedded customers to enable user configurations within any web application
You can use the widget in two ways:
Install the package:
pnpm add @airbyte-embedded/airbyte-embedded-widget
# or npm install / yarn add
Use it in your application:
<button id="open-airbyte">Open Airbyte</button>
<script type="module">
import { AirbyteEmbeddedWidget } from "@airbyte-embedded/airbyte-embedded-widget";
const widget = new AirbyteEmbeddedWidget({
token: "<your-token-here>",
onEvent: (event) => {
console.log("Widget event:", event);
},
});
document.getElementById("open-airbyte").addEventListener("click", () => widget.open());
</script>
Load the widget via a CDN:
<button id="open-airbyte">Open Airbyte</button>
<script src="https://cdn.jsdelivr.net/npm/@airbyte-embedded/airbyte-embedded-widget@0.4.2"></script>
<script>
const widget = new AirbyteEmbeddedWidget({
token: "<your-token-here>",
onEvent: (event) => {
console.log("Widget event:", event);
},
});
document.getElementById("open-airbyte").addEventListener("click", () => widget.open());
</script>
To use this library, you will first need to fetch an Airbyte Embedded token. You should do this in your server, though if you are simply testing this locally, you can use:
curl --location '$AIRBYTE_BASE_URL/api/public/v1/embedded/widget' \
--header 'Content-Type: application/json' \
--header 'Accept: text/plain' \
--data '{
"workspaceId": "$CUSTOMER_WORKSPACE_ID",
"allowedOrigin": "$EMBEDDING_ORIGIN"
}'
AIRBYTE_BASE_URL
: where your Airbyte instance is deployedCUSTOMER_WORKSPACE_ID
: the workspace you have associated with this customerEMBEDDING_ORIGIN
: the origin where you're embedding the widget (used for CORS validation)
You can also, optionally, send an externalUserId
in your request and we will attach it to the JWT encoded within the Airbyte Embedded token for provenance.
Embedded tokens are short-lived (15 minutes) and only allow the user to create/edit configurations within the scoped workspace.
You can pass an onEvent
callback to receive messages when the user completes actions in the widget:
{
type: "end_user_action_result";
message: "partial_user_config_created" | "partial_user_config_updated";
data: PartialUserConfigRead;
}
Or, in case of error:
{
type: "end_user_action_result";
message: "partial_user_config_update_error" | "partial_user_config_create_error";
error: Error;
}
Use this to trigger actions like refreshing your UI or storing source IDs.
<button id="open-airbyte">Open Airbyte</button>
<script>
const widget = new AirbyteEmbeddedWidget({
token: "<your-token-here>",
onEvent: handleWidgetEvent,
});
document.getElementById("open-airbyte").addEventListener("click", () => widget.open());
</script>
The demo application in the /demo
directory shows a complete example of integrating the widget. It includes:
- Environment variable configuration
- Basic styling and layout
- API token handling
/src
- The widget library source code/demo
- A demo application showcasing the widget usage
# Using pnpm (highly recommended)
pnpm install
# Using npm
npm install
# Using yarn
yarn install
To build the widget library:
pnpm build
The built files will be in the dist
directory.
This repository is configured to publish to npmjs.org whenever:
- There is an update to the main branch.
- A new version is created in the
package.json
.
To create a new version, you can use the following command:
pnpm version <major|minor|patch>
and then push those changes to the main branch. Don't forget the tags!
git push origin main --tags && git push
This software is proprietary and confidential. Commercial terms apply. Please see LICENSE.txt for details or contact Airbyte, Inc. for licensing information.