Open helpers
presentMessageComposer(message) uses { mode: "auto" } by default. It pre-fills the composer and lets Sagepilot reuse an existing conversation when one is available. If there is no existing conversation, Sagepilot starts a new one when the customer sends the message.
Use { mode: "new" } only when the button or workflow should always start a fresh conversation.
Use { chatId } when an app-owned surface should reopen a specific conversation, such as an order help button.
presentMessageComposer() returns boolean by default. If behavior.waitForIdentifyBeforeComposer is true and identify() is already in flight, it returns Promise<boolean> and waits up to 60 seconds for identity to finish before opening. You can await it in both cases.
For authenticated support flows, enable behavior.waitForIdentifyBeforeComposer and call identify() before opening chat: