Submit Poll
Once the polls are created, users can submit their responses to the polls effortlessly. The "Submit Poll" method ensures that their answers are recorded accurately and promptly, fostering a smooth and interactive user experience. You can integrate the above by following the given steps.
Steps to Submit a Poll
- To submit a poll response, use the
submitPoll()
method provided by the client. - Pass in the required parameters.
- Process the response as per your requirement.
const payload = {
conversationId: 12122, // Conversation Id
polls: [
{
id: 4022,
},
], // An array of IDs for the selected options
};
const response = await lmChatClient.submitPoll(payload);
if (response.success) {
// your function to process the response data
processResponse(response);
} else {
// your function to process error message
processError(response);
}
Submit Poll Payload
Variable | Type | Description | Optional |
---|---|---|---|
conversationId | number | Conversation Id | |
polls | array of object | An array of selected options for the poll |
Submit Poll Response
Variable | Type | Description | Optional |
---|---|---|---|
success | boolean | API success status | |
error_message | string | Error message in case of failure | ✔️ |