Poll Post
To create a poll post, you need to create a poll first and then attach the newly created poll to a post. SDK keeps all poll-related APIs in AmityPollRepository
obtained from AmitySocialClient.newPollRepository
and provides a builder design pattern named AmityPollBuilder
which can be obtained from pollRepository.createPoll(question: String)
.
You can create a poll with the following inputs:
question - a question which can be up to 500 characters
answers - a set of two to ten answers. Each answer can be up to 200 characters
answerType - indicates whether the survey allows multiple choices. The default type is
AnswerType.SINGLE
The available options are
AnswerType.SINGLE
andAnswerType.MULTIPLE
. You can select either one or more than one option.closedIn - a time window indicating how long this poll will take. By default, the
closedIn
value is set to 30 days if the user does not set a value for it.
Create a Poll
Create a Poll Post with Mention
When creating a poll post with mention, you can provide the JsonObject
for the metadata
parameter and provide the list of userId
for the mentionUsers
parameter.
To render mention, refer to Rendering Mention section.
Last updated