Vote on a poll
const url = 'https://chat.work.optidata.cloud/api/chats/36/messages/176/poll/votes';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"option_id":11}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://chat.work.optidata.cloud/api/chats/36/messages/176/poll/votes \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "option_id": 11 }'Toggles the caller’s vote on one option: voting for an option they already picked withdraws that vote.
On a single-answer poll the new vote replaces the previous one. On a
multiple-answer poll (is_multiple_answers: true) votes accumulate, one
call per option.
Authorizations
Section titled “Authorizations”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters”Numeric id of the conversation.
Numeric id of the message.
Request Bodyrequired
Section titled “Request Bodyrequired”object
Id of the poll option to vote for.
Responses
Section titled “ Responses ”The message with its refreshed poll.
object
One message. type separates what a person wrote (USER) from what the
service recorded about the conversation (SYSTEM) — a rename, a join, a
departure. Render SYSTEM messages as notices, not as chat bubbles; their
data holds the details of what happened.
object
Author of the message.
The message this one replies to, or null.
Stable identifier of the message. This is what
POST /chats/messages/forward takes.
The client-supplied value that made the send idempotent.
The message text.
Structured payload. On a SYSTEM message it describes the event; on a
USER message it carries the mentioned user ids, when there are any.
Where the message came in from — chat for Talk itself, or the name of
the external messaging integration that relayed it.
true when the message was copied here from another conversation.
1 when the caller has favourited this message, 0 otherwise.
How many participants have seen the message.
Position of the message within the conversation.
The trimmed user record embedded in message payloads and search results.
object
Details of the linked external-messaging contact, present when the
embedded user is one (type 2); null otherwise. Open object.
A file attached to a message.
object
Alternative identifier accepted by the attachment content endpoints.
Size in bytes.
true for a voice message.
Playback length in seconds, for audio and video.
Thumbnail, when one was generated.
Storage metadata. Its keys depend on where the file is stored, so treat it as an open object.
Preview of the first link found in the text, when there is one.
Reactions on the message: the ids of the users who left each emoji, keyed by the emoji. Empty when nobody has reacted.
object
A poll carried by a message. total_votes and the per-option
votes_count / voter_ids are computed for every message payload, so a
client can render the result without a second call.
object
Whether a voter may pick more than one option.
object
Display order, starting at 0.
Example
{ "message": { "type": "USER", "origin": "chat" }}Missing, malformed or expired authentication key.
Authentication failures — and a few permission denials — use an error
key rather than message.
object
Examples
No bearer token sent
{ "error": "JWT passport exception: Missing bearer token in request"}The caller is not a participant of the conversation, or lacks the role the operation requires.
Generic error envelope used by policy, binding and framework failures.
object
Human-readable description of the failure.
Examples
{ "message": "This action is unauthorized."}The message, the conversation, or the option does not exist — an
option_id from another poll is rejected here.
Generic error envelope used by policy, binding and framework failures.
object
Human-readable description of the failure.
Examplegenerated
{ "message": "example"}The request body or query string failed validation.
object
The first validation message.
Validation messages keyed by field name.
object
Examples
{ "message": "The content field is required.", "errors": { "content": [ "The content field is required." ] }}Rate limit exceeded. Retry after the window resets.
Generic error envelope used by policy, binding and framework failures.
object
Human-readable description of the failure.
Examples
{ "message": "Too Many Attempts."}