/api/session endpoint is covered in Backend Integration.
These examples use a shared
SDK_DEBUG flag for the SDK’s internal development logs and the console statements inside the callbacks.The onSuccess, onError, and onCancel callbacks continue to run when debug logging is disabled. Only the example’s console output is skipped. Keep the debug flag set to false in production.The optional
apiBaseUrl setting lets you dynamically select the Gateway API environment. Provide only the base URL, such as https://your-gateway-api.example.com.When it is omitted, the SDK continues using the existing default Connexease production API.- React / Next.js
- Vue.js
- Vanilla JS
Next.js Backend Route
The following Route Handler can be used as the/api/session endpoint for the React / Next.js example:
.env:
Use only the frontend variables for your framework. A React / Next.js application uses the
NEXT_PUBLIC_ variables, while a Vue / Vite application uses the VITE_ variables.NEXT_PUBLIC_GATEWAY_API_BASE_URL, VITE_GATEWAY_API_BASE_URL, and GATEWAY_CORE_API_URL are optional. If they are omitted, the existing Connexease production API continues to be used.NEXT_PUBLIC_GATEWAY_DEBUG and VITE_GATEWAY_DEBUG control the SDK’s internal development logs and the guarded callback console statements shown in these examples.The callbacks themselves continue to run when these values are false. Keep debug logging disabled in production.The frontend API base URL and the server-side
GATEWAY_CORE_API_URL should point to the same Gateway environment.Provide only the base URL. Do not append /api/v1/wa/embedded-signup or an individual endpoint path.Public frontend environment values are usually included in the application during build or dev-server startup. If you add or change one, restart the dev server or rebuild the application.