fetchSessionToken calls your endpoint; your endpoint forwards the request to the Connexease Session API with the secret key and returns the session payload to the SDK.
The proxy path (
/api/session here) is yours to choose — the SDK calls whatever you put in fetchSessionToken. Put your own authentication and authorization in front of it.Don’t hardcode the API base URL. Read it from an environment variable with a production default so the same code works across local, staging, and production environments.
Dynamic API Base URL
The Gateway API base URL can be configured dynamically when the SDK is initialized:fetchSessionToken calls your backend proxy. Therefore, the requests are routed as follows:
NEXT_PUBLIC_GATEWAY_API_BASE_URL and CONNEXEASE_API_BASE should point to the same Gateway environment.If both values are omitted, the SDK and backend continue using the existing Connexease production API. Existing integrations do not need to provide these values.- Node.js / Express
- FastAPI (Python)
On success, your proxy must return the inner session object from
data. You do not need to rename the compact gh, wv, pt, li, and bn fields because the SDK decodes them automatically.On failure, preserve the upstream HTTP status and error body. Your frontend’s fetchSessionToken can then throw the returned error so the SDK can display its error modal and deliver the failure through onError..env:
NEXT_PUBLIC_GATEWAY_API_BASE_URL and CONNEXEASE_API_BASE are optional. When omitted, they default to the existing Connexease production API.Provide only the base URL. Do not append /api/v1/wa/embedded-signup or an individual endpoint path.