Skip to main content

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

  1. To submit a poll response, use the submitPoll() method provided by the client.
  2. Pass in the required parameters.
  3. 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

VariableTypeDescriptionOptional
conversationIdnumberConversation Id
pollsarray of objectAn array of selected options for the poll

Submit Poll Response

VariableTypeDescriptionOptional
successbooleanAPI success status
error_messagestringError message in case of failure✔️