Conversations and tasks
The first message, sent without
context_id, starts a conversation. Its answer carries both ids. Send context_id with every later message of the same traveler; keep one per traveler and conversation.
Where a later message goes depends on the conversation’s open task:
You do not need to send
task_id. When you do, it must belong to the conversation, and it needs context_id: task_id alone answers 422, and a task of another conversation answers 404.
Answer a question
When a search cannot start, the answer isinput_required. message is the question to show, and question says what is missing:
When several things are missing, the search asks for one at a time, in the order of the table.
Send the traveler’s answer as
text, with the same context_id:
question back: the conversation knows what it asked. The traveler can also answer with a whole new request; it is read the same way.
Hotels marked
reference: true are priced for one night from the check-in, to show prices while the check-out is asked. Ask the check-out before booking the stay.Refine the search
Each follow-up answers with a new search that keeps the conversation’s conditions and applies the change.has_more: true means more hotels match the search; ask for more in the same conversation. There is no page parameter.
Notes
notes lists the assumptions and changes the answer made. message already says the same in words.
Change the search while it runs
A message sent while a task isworking replaces it. Reading the first task then shows:
superseded_by. To stop a search without sending a new message, cancel it.
When nothing matches
A search that finds no hotel endscompleted, with hotels: [] and a reply that names the filters, for example No hotel in Paris for Oct 24–25 (1 night, 2 adults, 1 room) matched all of: 4 stars or more, swimming pool. Tell me which condition to relax. Filters are never widened without the traveler.
A message that is not a hotel request, such as a greeting or a thank-you, also ends completed: Tell me where and when you'd like to stay, and I'll search hotels. A request for something other than hotels, such as a flight or a booking, answers I can only search for hotels. To book one, use its offer id with the booking tools.
Expiry
A conversation expires 24 hours after its last message.- A message sent with an expired
context_idanswers410GONE. Start a new conversation withoutcontext_id. - A task that was waiting for an answer ends
failedwitherror.codecontext_expired. - Tasks stay readable by
task_idafter the conversation expires.
