Answer a question
POST
/v1/messages/{id}/answer
const url = 'https://api.pocketbell.dev/v1/messages/msg_01jz9k6q8r3tfv0x2m4n5p7s8a/answer';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"answer":"Approve"}'};
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://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.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”id
required
string
Example
msg_01jz9k6q8r3tfv0x2m4n5p7s8aRequest Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
answer
required
One of the question’s options, exactly.
string
Example
ApproveResponses
Section titled “Responses”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" }}