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.
  2. In the rich content, find nodes of type POLL. The poll ID is in the node's pollData.poll.id field.
  3. Call Get Poll with the poll ID and fields: ["RESULTS", "CURRENT_VOTER_VOTES"]. Display the question and options.
  4. 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.
  5. When the visitor chooses an option, call Cast Vote 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 with the question, options, and settings. Save the returned poll.id and the ID of each option.

  2. 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:

    Copy

    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 fieldNode fieldValue mapping
    settings.resultsVisibilitysettings.permissions.viewPUBLIC is EVERYONE. VOTERS and CREATOR stay the same.
    settings.votingAccesssettings.permissions.votePUBLIC is ALL. MEMBERS is SITE_MEMBERS.
    settings.multipleVotessettings.permissions.allowMultipleVotesSame value.
    settings.showVoteCountssettings.showVotesCountSame value.
    settings.showVoterssettings.showVotersSame value.
  3. 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 with fields: ["RESULTS"]. In the response, find the option in results.optionResults.
  2. To display the latest voters, use latestVoters of the option. To display all voters, call List Voters with the poll ID and option ID. Use the returned pagingMetadata.cursors.next to retrieve the next page.
  3. Call Query Members with the returned voter.memberId values to get the members' names and profile photos.

Last updated: 27 November 2026

Did this help?