Identify signed-in app users and clear Sagepilot state on logout.
Call identify() when you know the signed-in app user.Use the same canonical customer ID for chat, Push proofs and your business-event integration. For chat with Push enabled, identify() clears the previous Push grant: call authorizePush(freshProof) afterward for the same customer. See Push identity and login.
Use behavior.waitForIdentifyBeforeComposer: true for authenticated support flows where the composer should wait for an in-flight identity request before opening.
await SagepilotChat.configure({ key: "workspace_id:channel_id", behavior: { waitForIdentifyBeforeComposer: true }});const identifyPromise = SagepilotChat.identify({ userId: user.id, email: user.email});const opened = await SagepilotChat.presentMessageComposer("I need help with my order");await identifyPromise;
presentMessageComposer() waits only while identify() is already pending. If identity is not pending, it opens immediately.You can inspect local identity state with SagepilotChat.getIdentityState() or useSagepilotChat().identity. The state includes identified, pending, and customer.
Identity verification
If identity verification is enabled for your workspace, generate userHash on your server and pass only the generated hash to the app: