> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

## Resource: Sample Flows

## Article: Sample Flows

## Article Link: https://dev.wix.com/docs/api-reference/mobile/containers-app/containers-chat/sample-flows.md

## Article Content:

# Containers Chat API: Sample Flows

This article presents a possible use case and corresponding sample flow that you can support. It provides a useful starting point as you plan your implementation.

## Send a message and track the assistant's response

After a user submits a request, your app needs to send the message to the coding agent and then monitor the assistant's response until it's complete.

To send a message and track the assistant's response:

1. Call [Create Conversation](https://dev.wix.com/docs/api-reference/mobile/containers-app/containers-chat/conversation-v1/create-conversation.md) with the project's ID to open a new chat thread. Save the returned `conversation.id`.

1. Call [Send Message](https://dev.wix.com/docs/api-reference/mobile/containers-app/containers-chat/conversation-v1/send-message.md) with the `conversationId` and the user's message content in `parts`. Pass a unique `idempotencyKey` for this message (reuse the same key if you retry on failure). Save the returned `message.id` — this is the user message ID.

1. Call [Query Messages](https://dev.wix.com/docs/api-reference/mobile/containers-app/containers-chat/conversation-v1/query-messages.md) with the `conversationId` to retrieve the message list. Look for an assistant message whose `inReplyToId` matches the user message ID from the previous step. Its initial `status` is `WORKING`.

1. Continue polling [Query Messages](https://dev.wix.com/docs/api-reference/mobile/containers-app/containers-chat/conversation-v1/query-messages.md) until the assistant message's `status` changes to `DONE`. Read the final response from its `parts` field and any follow-up prompts from `followUpQuestionOptions`.

   If the assistant message's `status` is `ERROR`, read the reason from its `parts` field.