Skip to main content
Create engaging poll posts that drive community interaction and gather valuable feedback. Poll posts combine questions with multiple voting options, time limits, and real-time results. Choose between text-only polls or visual image polls for different engagement styles.

Multiple Options

Create polls with 2-10 answer options

Time Limits

Set custom voting deadlines or keep open indefinitely

Image Options

Add visual elements with text+image poll options

Overview

Poll posts enable interactive community engagement by allowing users to vote on questions. Create polls with multiple options, set time limits, and track real-time voting results. You can choose between:
  • Text Polls: Traditional polls with text-only answer options
  • Image Polls: Visual polls where users vote on image options with optional captions
Both poll types follow the same creation process: create the poll first, then create a post that references the poll ID.
A Poll must be created first before creating the post. See Poll Creation Guidelines for instructions.
1

Create Poll

Use the Poll Repository to create a poll with questions and options
2

Create Post

Create a post using the poll ID with optional description text
3

Share & Engage

Users can vote and see real-time results in their feeds

Parameters

ParameterTypeRequiredDescription
textStringPost content (max 10,000 characters)
pollIdStringID of the created poll
targetTypeEnumTarget destination (community or user feed)
targetIdStringTarget ID (userId or communityId)
metadataObjectCustom fields for extended functionality

Answer Object Structure (Image Polls Only)

For image polls, each answer option requires the following structure:
ParameterTypeRequiredDescription
dataTypeStringYesMust be set to 'image' for image polls
fileIdStringYesID of the uploaded image file
textStringNoOptional caption for the image option
Image Requirements: Images must be uploaded first using the File Repository before creating the poll. Supported formats include JPEG, PNG, and WebP with a maximum file size of 100MB per image.

Text Poll Creation

func createPollPost(pollId: String) async {
    // Build your post structure
    let postBuilder = AmityPollPostBuilder()
    postBuilder.setText("Check out this poll!")
    postBuilder.setPollId(pollId)
    // Create a post from the builder
    do {
        let post = try await postRepository.createPollPost(postBuilder, targetId: nil, targetType: .user, metadata: nil, mentionees: nil)
    } catch {
        // Handle error here
    }
}

Image Poll Creation

  • iOS
  • Android
  • TypeScript
  • Flutter
// Implementation example coming soon

Troubleshooting

Problem: Poll creation fails before post creationSolutions:
  • Verify poll question is not empty
  • Ensure at least 2 options are provided
  • Check option text length limits
  • Validate time limit values are positive
Problem: Post creation fails with invalid poll IDSolutions:
  • Verify poll was created successfully
  • Check poll ID is correctly passed to post creation
  • Ensure poll hasn’t been deleted
Problem: Users cannot vote on pollsSolutions:
  • Check if poll is still open (not expired)
  • Verify user has permission to vote in the target community
  • Ensure user hasn’t already voted (for single-vote polls)
  • Confirm poll wasn’t closed by moderators
Problem: Poll results not updating or displaying incorrectlySolutions:
  • Implement real-time updates for poll results
  • Refresh results when poll post is viewed
  • Handle cases where vote counts are not available
  • Provide fallback UI for loading states
Problem: Images fail to upload or poll creation fails (Image Polls)Solutions:
  • Check file size (must be under 100MB per image)
  • Verify supported format (JPEG, PNG, WebP)
  • Ensure stable internet connection
  • Implement retry logic with exponential backoff
try {
  const fileId = await FileRepository.uploadImage(imageFile);
  // Proceed with poll creation
} catch (error) {
  if (error.code === "FILE_TOO_LARGE") {
    // Compress image and retry
  } else if (error.code === "NETWORK_ERROR") {
    // Implement retry logic
  }
}
Problem: Image references in polls become unavailable (Image Polls)Solutions:
  • Images used in active polls cannot be deleted from file storage
  • Consider the poll lifecycle when managing image assets
  • Implement proper cleanup after poll expiration
  • Implement fallback UI for missing poll option images
  • Show placeholder or error state for broken image references
  • Consider caching strategies for poll option images

Common Use Cases

Community Feedback

Gather opinions on community decisions and improvements using text polls

Event Planning

Coordinate dates, times, and preferences for events with either text or image options

Design Feedback

Gather visual preferences on UI mockups and design concepts using image polls

Photo Contests

Let communities vote on best photos and creative submissions with image polls

Product Research

Collect user preferences and feature requests using text-based polls

Product Selection

Help users choose between visual product options and variants with image polls