Have a conversation with a character
Exchange dialogue with an eligible character in an active story, then apply the conversation’s effects to the world.
A conversation lets you exchange dialogue without submitting every line as a story action. The server holds its transcript and generates replies. Ending the conversation applies its narrative effects; letting it expire discards those pending effects.
In this example, Mallow asks a nearby character about a missing cobbler. For your own story, choose a character currently present and eligible to talk.
INSTANCE_ID=da1cc53b-9d9e-4edb-83e4-d5a9ee713130STORY_ID=b79d72ef-92fb-4bcd-917a-9886e62d41d8Choose an eligible conversation target
Section titled “Choose an eligible conversation target”Read the story and current entities to find a present non-lead character. An action suggestion can also supply talkToEntityId as a conversation target.
Eligibility depends on current story rules, not just whether an identifier is valid. A character might be absent, incapacitated or already spoken to this turn. Another open conversation, an in-progress action or incompatible story input can also prevent opening one.
For this example, suppose Brindle, a talking badger, is present and eligible with entity ID c1a8dd94-21d2-4b9c-a417-ed5cb1325cda.
Open the conversation
Section titled “Open the conversation”Open a conversation with the selected character:
curl --request POST \ "https://api.hiddendoor.co/experience/v1/instances/$INSTANCE_ID/stories/$STORY_ID/conversations" \ -H "Authorization: Bearer $HD_API_KEY" \ -H 'Content-Type: application/json' \ --data '{ "target": { "mode": "character", "entityId": "c1a8dd94-21d2-4b9c-a417-ed5cb1325cda" } }'A successful 201 Created response includes the conversation identifier, opening dialogue and current expiry:
{ "conversationId": "d0bc5bda-9876-4086-8b2c-39119a811f7e", "instanceId": "da1cc53b-9d9e-4edb-83e4-d5a9ee713130", "storyId": "b79d72ef-92fb-4bcd-917a-9886e62d41d8", "mode": "character", "entityId": "c1a8dd94-21d2-4b9c-a417-ed5cb1325cda", "transcript": [ { "speaker": "entity", "text": "If you are here about the road, I have already complained." } ], "exchangeCount": 0, "windingDown": false, "resolved": false, "suggestions": [], "expiresAt": "2026-11-12T12:30:00Z"}Save conversationId for subsequent calls and use the returned expiresAt to track its lifetime.
To guide the opening dialogue, include openingIntent in the character target. For example, ask whether anyone has seen the cobbler. The generated opening appears in transcript.
Send a line and use the updated transcript
Section titled “Send a line and use the updated transcript”CONVERSATION_ID=d0bc5bda-9876-4086-8b2c-39119a811f7e
curl --request POST \ "https://api.hiddendoor.co/experience/v1/instances/$INSTANCE_ID/stories/$STORY_ID/conversations/$CONVERSATION_ID/messages" \ -H "Authorization: Bearer $HD_API_KEY" \ -H 'Content-Type: application/json' \ --data '{"text":"Have you seen a cobbler traveling toward the Emerald City?"}'The 200 response contains the updated transcript, reply suggestions and expiry time. Send each new line after the previous reply arrives.
In the transcript, player marks dialogue supplied by your application and entity marks the character or narrator’s reply.
windingDown signals that the exchange is drawing to a close. You can offer suggestions as possible replies. When resolved is true, end the conversation to apply its effects; further messages are rejected.
End the conversation explicitly
Section titled “End the conversation explicitly”curl --request POST \ "https://api.hiddendoor.co/experience/v1/instances/$INSTANCE_ID/stories/$STORY_ID/conversations/$CONVERSATION_ID/end" \ -H "Authorization: Bearer $HD_API_KEY" \ -H 'Content-Type: application/json' \ --data '{}'Ending returns 200 with storyId, gameState, events and inputRequests. These show the conversation’s effects on the world.
Submitting the next story action also finalizes an open conversation before applying that action. End the conversation explicitly if you want to inspect its effects before choosing the next action.
Read an open exchange, or let it expire
Section titled “Read an open exchange, or let it expire”Read an open conversation without sending another line:
curl \ "https://api.hiddendoor.co/experience/v1/instances/$INSTANCE_ID/stories/$STORY_ID/conversations/$CONVERSATION_ID" \ -H "Authorization: Bearer $HD_API_KEY"Missing, ended and expired conversations return 404. If you want the conversation’s effects to take place, end it before expiresAt. Expiry discards its pending effects.
Speak to the narrator instead
Section titled “Speak to the narrator instead”Narrator conversations use the same open, read, message and end operations, but their purpose is an out-of-character aside rather than dialogue with someone in the scene. Open one with this request body:
{ "target": { "mode": "narrator", "narratorPersonality": "storyteller" } }Narrator mode accepts narratorPersonality and uses the story’s narrator as the target. Replies can include declined requests, counteroffers and accepted statements. Story eligibility and once-per-turn limits also apply to narrator conversations.
The reference covers sending a message, reading an open conversation and ending a conversation. After applying its effects, continue the story.