Create a client
turnContext(messages, options?)
Returns the context block for a conversation.
Arguments
EraMessage[]
required
Conversation history through the latest user message.
string
Visitor ID from the Web or Flutter SDK. It can also be set on the client.
string
Your stable ID for a signed-in user.
string
A backend-verified email address. Requires
partnerEndUserId.string
A backend-verified phone number. Requires
partnerEndUserId.string
Your stable ID for this conversation.
visitorId must be available on the call or client. partnerEndUserId is
optional and does not replace it.
Result
The promise resolves to a plain string. Add it to your system prompt:"" without making a request when:
- No
visitorIdis available. - The normalized conversation is empty.
- The last normalized message is not from the user.
"". See
Fail-open design.
HTTP request
messages into user and assistant turns, adds identity and
session values, and sends the request for you.