Skip to main content
Copy-pasteable setups for the most common frameworks. Each one installs the SDK and launches the flow; the /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.
Before testing Meta Embedded Signup, configure the required CSP and COOP response headers. In particular, do not use Cross-Origin-Opener-Policy: same-origin; use same-origin-allow-popups.See Browser Security Headers.

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.
Only NEXT_PUBLIC_ and VITE_ variables are exposed to the browser. Never give the secret key one of these prefixes.GATEWAY_SECRET_KEY has no public prefix, so it stays server-side in the Route Handler. Never pass it to launch() in a production integration.
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.