Skip to content

Vote on a poll

POST
/chats/{chat}/messages/{message}/poll/votes
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.

chat
required
integer format: int64

Numeric id of the conversation.

message
required
integer format: int64

Numeric id of the message.

Media typeapplication/json
object
option_id
required

Id of the poll option to vote for.

integer format: int64

The message with its refreshed poll.

Media typeapplication/json
object
message
required

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
id
required
integer format: int64
chat_id
required
integer format: int64
user_id
required

Author of the message.

integer format: int64
parent_id

The message this one replies to, or null.

integer | null format: int64
type
required
string
Allowed values: USER SYSTEM
hash
required

Stable identifier of the message. This is what POST /chats/messages/forward takes.

string
idempotency_hash

The client-supplied value that made the send idempotent.

string | null
content

The message text.

string | null
data

Structured payload. On a SYSTEM message it describes the event; on a USER message it carries the mentioned user ids, when there are any.

object | null
meta
object | null
origin

Where the message came in from — chat for Talk itself, or the name of the external messaging integration that relayed it.

string
is_seen
boolean
is_forwarded

true when the message was copied here from another conversation.

boolean
is_important
boolean
is_favorite

1 when the caller has favourited this message, 0 otherwise.

integer
has_user_mentions
boolean
views

How many participants have seen the message.

integer
order_in_chat

Position of the message within the conversation.

integer
message_link_id
integer | null format: int64
user

The trimmed user record embedded in message payloads and search results.

object
id
required
integer format: int64
uuid
required
string format: uuid
name
required
string
email
string format: email
cuid
string
avatar_url
string | null format: uri
deleted_at
string | null format: date-time
whatsapp_info

Details of the linked external-messaging contact, present when the embedded user is one (type 2); null otherwise. Open object.

object | null
files
Array<object>

A file attached to a message.

object
id
integer format: int64
message_id
integer format: int64
chat_id
integer | null format: int64
cuid
string
hash

Alternative identifier accepted by the attachment content endpoints.

string | null
name
string
url
string | null format: uri
mime_type
string | null
size

Size in bytes.

integer | null
audio

true for a voice message.

boolean | null
duration

Playback length in seconds, for audio and video.

string | null
preview

Thumbnail, when one was generated.

string | null
type
string | null
meta

Storage metadata. Its keys depend on where the file is stored, so treat it as an open object.

object | null
created_at
string format: date-time
updated_at
string format: date-time
deleted_at
string | null format: date-time
link

Preview of the first link found in the text, when there is one.

object | null
reply_message
One of:
null
reactions

Reactions on the message: the ids of the users who left each emoji, keyed by the emoji. Empty when nobody has reacted.

object
key
additional properties
Array<integer>
poll
One of:
null
created_at
string format: date-time
updated_at
string format: date-time
deleted_at
string | null format: date-time
Example
{
"message": {
"type": "USER",
"origin": "chat"
}
}

Missing, malformed or expired authentication key.

Media typeapplication/json

Authentication failures — and a few permission denials — use an error key rather than message.

object
error
required
string
Examples
Examplemissing

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.

Media typeapplication/json

Generic error envelope used by policy, binding and framework failures.

object
message
required

Human-readable description of the failure.

string
Examples
Exampledenied
{
"message": "This action is unauthorized."
}

The message, the conversation, or the option does not exist — an option_id from another poll is rejected here.

Media typeapplication/json

Generic error envelope used by policy, binding and framework failures.

object
message
required

Human-readable description of the failure.

string
Examplegenerated
{
"message": "example"
}

The request body or query string failed validation.

Media typeapplication/json
object
message
required

The first validation message.

string
errors
required

Validation messages keyed by field name.

object
key
additional properties
Array<string>
Examples
Exampleinvalid
{
"message": "The content field is required.",
"errors": {
"content": [
"The content field is required."
]
}
}

Rate limit exceeded. Retry after the window resets.

Media typeapplication/json

Generic error envelope used by policy, binding and framework failures.

object
message
required

Human-readable description of the failure.

string
Examples
Examplethrottled
{
"message": "Too Many Attempts."
}