Skip to content

Answer a question

POST
/v1/messages/{id}/answer
curl --request POST \
--url https://api.pocketbell.dev/v1/messages/msg_01jz9k6q8r3tfv0x2m4n5p7s8a/answer \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "answer": "Approve" }'

The first answer, from any device, is kept: it acknowledges the message, clears it from the other devices, and tells the sender. A later one is refused with already_answered; one after the question expired or the sender canceled it, with question_closed.

id
required
string
Example
msg_01jz9k6q8r3tfv0x2m4n5p7s8a
Media typeapplication/json
object
answer
required

One of the question’s options, exactly.

string
>= 1 characters <= 40 characters
Example
Approve

Answered.

Not one of the question’s options.

Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
details

Which fields were wrong, for invalid_request.

Array<object>
object
field
required
string
message
required
string
Example
{
"error": {
"code": "invalid_request"
}
}

Missing or ended session.

Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
details

Which fields were wrong, for invalid_request.

Array<object>
object
field
required
string
message
required
string
Example
{
"error": {
"code": "invalid_request"
}
}

No such question on this account.

Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
details

Which fields were wrong, for invalid_request.

Array<object>
object
field
required
string
message
required
string
Example
{
"error": {
"code": "invalid_request"
}
}

Already_answered, on this or another device; or question_closed: it expired, or the sender canceled it.

Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
details

Which fields were wrong, for invalid_request.

Array<object>
object
field
required
string
message
required
string
Example
{
"error": {
"code": "invalid_request"
}
}