> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> 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`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - 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/assets/rich-content/polls-v1/sample-flows.md

## Article Content:

# Ricos Polls: Sample Flows

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

## Show a poll from rich content and let visitors vote

If you display rich content in your own app or site, you can show each poll in the content and let visitors vote in it. A poll is stored separately from the content, so you load it by the ID in its `POLL` node.

To show a poll from rich content and let visitors vote:

1. Retrieve the Ricos document that contains the poll, from the app or service that stores it.
1. In the rich content, find nodes of type `POLL`. The poll ID is in the node's `pollData.poll.id` field.
1. Call [Get Poll](https://dev.wix.com/docs/api-reference/assets/rich-content/polls/get-poll.md) with the poll ID and `fields: ["RESULTS", "CURRENT_VOTER_VOTES"]`. Display the question and options.
1. Display the options that the visitor already voted for, based on `currentVoterOptionIds`, and the voting results from `results`. The poll's settings control whether the caller can see the results. When `results` is omitted from the response, don't display results.
1. When the visitor chooses an option, call [Cast Vote](https://dev.wix.com/docs/api-reference/assets/rich-content/polls/cast-vote.md) with the poll ID and option ID. Update the display with `currentVoterOptionIds` from the response, and with `results` when it's returned.

## Create a poll and add it to a Ricos document

A poll is displayed on a site only when rich content references it and the `poll` plugin is enabled in the Ricos editor and viewer that render the content. For this reason, you create the poll first and then add a `POLL` node with the poll's ID to the Ricos document.

To create a poll and add it to a Ricos document:

1. Call [Create Poll](https://dev.wix.com/docs/api-reference/assets/rich-content/polls/create-poll.md) with the question, options, and settings. Save the returned `poll.id` and the ID of each option.
1. Add a node of type `POLL` to the `nodes` array of the Ricos document. Set the node's `pollData.poll.id` to the saved poll ID, and include the poll's question, options, and settings in `pollData.poll`, because the poll widget draws the node from this data. Also include `pollData.layout` and `pollData.design`. In `pollData.design.poll.background`, specify a dark color or an image, because the widget displays the poll text in white. The node looks like this:

    ```json
    {
      "type": "POLL",
      "id": "poll-node-1",
      "pollData": {
        "poll": {
          "id": "<POLL_ID>",
          "title": "Do you like polls?",
          "options": [
            { "id": "<OPTION_1_ID>", "title": "Yes" },
            { "id": "<OPTION_2_ID>", "title": "No" }
          ],
          "settings": {
            "permissions": { "view": "EVERYONE", "vote": "ALL", "allowMultipleVotes": false },
            "showVoters": false,
            "showVotesCount": true
          }
        },
        "layout": {
          "poll": { "type": "LIST", "direction": "LTR", "enableImage": false },
          "options": { "enableImage": false }
        },
        "design": {
          "poll": { "background": { "type": "COLOR", "color": "#11428D" }, "borderRadius": 0 },
          "options": { "borderRadius": 0 }
        }
      }
    }
    ```

    Set the node's `poll` data to match the poll that you created. The widget loads the poll by ID and uses the poll's own settings, so a mismatch changes how the poll is displayed after it loads. The following table shows how the poll's settings map to the node:

    | Poll field | Node field | Value mapping |
    | ---------- | ---------- | ------------- |
    | `settings.resultsVisibility` | `settings.permissions.view` | `PUBLIC` is `EVERYONE`. `VOTERS` and `CREATOR` stay the same. |
    | `settings.votingAccess` | `settings.permissions.vote` | `PUBLIC` is `ALL`. `MEMBERS` is `SITE_MEMBERS`. |
    | `settings.multipleVotes` | `settings.permissions.allowMultipleVotes` | Same value. |
    | `settings.showVoteCounts` | `settings.showVotesCount` | Same value. |
    | `settings.showVoters` | `settings.showVoters` | Same value. |

1. Save or publish the Ricos document in the app or service that stores it. The poll is displayed wherever the document is rendered, and its question, options, and results are loaded by the poll ID.

## Show who voted for an option

To show which site members voted for an option in a poll, you list the voters of that option. Voters are available only when the poll's `settings.showVoteCounts` and `settings.showVoters` are both `true`, and the caller is allowed to see the results.

To show who voted for an option:

1. Call [Get Poll](https://dev.wix.com/docs/api-reference/assets/rich-content/polls/get-poll.md) with `fields: ["RESULTS"]`. In the response, find the option in `results.optionResults`.
1. To display the latest voters, use `latestVoters` of the option. To display all voters, call [List Voters](https://dev.wix.com/docs/api-reference/assets/rich-content/polls/list-voters.md) with the poll ID and option ID. Use the returned `pagingMetadata.cursors.next` to retrieve the next page.
1. Call [Query Members](https://dev.wix.com/docs/api-reference/crm/members-contacts/members/member-management/members/query-members.md) with the returned `voter.memberId` values to get the members' names and profile photos.