Install

API key & SDK configuration

To get started, you need to login to your account on FutureAI and create a new Api key. You will get an API key, and the necesery config to authenticate your requests.

Setting up

After u have installed our SDK, import the Future component from the SDK.

import { Future } from '@future-sdk/future-js'

Initiate the session

Future.startFutureSession({
    apiKey: import.meta.env.PUBLIC_ENV__API_KEY,
    iframeUrl: import.meta.env.PUBLIC_ENV__IFRAME_SERVER_ROOT,
    websocketUrl: import.meta.env.PUBLIC_ENV__WEBSOCKET_ROOT,
    serverUrl: import.meta.env.PUBLIC_ENV__SERVER_ROOT,
    onSessionUpdate: (session) => {}
    onError: () => {}
})

Usage

Rendering the interactive button to initiate the user journey PUBLIC_ENV__FLOW_ID is the flow id you get from the FutureAI dashboard

.future-button is the HTML element where the button will be rendered

Future.createFutureButton({
  container: '.future-button',
  merchantFlowId: `${import.meta.env.PUBLIC_ENV__FLOW_ID}`,
})