Polls
Ask the room a question from your server and read the results as they come in.
A poll appears for everyone in the meeting straight away — in Deewan's meeting interface people answer with one tap. Your server can create polls, read results, close them and delete them.
Create a poll
ts
const poll = await deewan.polls.create(roomId, {
question: "Which topic should we cover next week?",
options: ["Kinematics", "Newton's laws", "Energy"],
kind: "single", // or "multiple"
anonymous: false, // true: nobody sees who picked what
results: "after_close", // "live" | "after_vote" | "after_close"
});curl
curl https://deewan.io/api/v1/rooms/$ROOM_ID/polls \
-H "Authorization: Bearer $DEEWAN_API_KEY" \
-H "Content-Type: application/json" \
-d '{"question":"Ready to move on?","options":["Yes","Not yet"]}'Read the results
ts
const { data } = await deewan.polls.list(roomId);
for (const poll of data) {
console.log(poll.question, poll.status, poll.total_voters);
for (const option of poll.options) console.log(" ", option.label, option.votes);
}
await deewan.polls.close(poll.id); // reveals "after_close" results
await deewan.polls.delete(poll.id); // removes it for everyoneVotes are one per person, changeable until the poll closes. Anonymous polls store no names at all — not even for hosts or for the API.
Events
Subscribe to poll.created and poll.closed to mirror polls into your own product, for example to store a class's answers with its lesson.