Messages around one message
chat.message.context
GET/api/v1/households/{household_id}/queries/chat.message.context
- Query
- Rigel runs it
The messages just before and after one, in the same place (the conversation itself, or the same thread), in order, with the message itself. Read this before answering about a message. Errors: message_not_found.
Parameters#
| Field | Description |
|---|---|
household_idpathstringrequired | The household's ID. |
message_idquerystringrequired | A message ID, such as msg_01JC0000000000000000000000. |
beforequeryintegeroptional | How many earlier messages, 0–50. |
afterqueryintegeroptional | How many later messages, 0–50. |
Response#
200 The answer.
| Field | Description |
|---|---|
conversationobjectrequired | |
conversation.idstringrequired | A conversation ID, such as cnv_01JC0000000000000000000000. |
conversation.titlestringrequired | No description. |
thread_root_message_idstring or nullrequired | The thread the messages are in, or null. |
itemsarray of objectsrequired | |
items[].idstringrequired | A message ID, such as msg_01JC0000000000000000000000. |
items[].conversation_idstringrequired | A conversation ID, such as cnv_01JC0000000000000000000000. |
items[].thread_root_message_idstring or nullrequired | The message whose thread this is in, or null. |
items[].authorobjectrequired | |
items[].author.kindone of: person, rigelrequired | person (a member of the family) or rigel. |
items[].author.person_idstring or nullrequired | The person who wrote it, or null for Rigel or someone since removed. |
items[].author.namestringrequired | Who wrote it, as shown: the person's name, "Rigel", or "Someone" for a removed person. |
items[].formatone of: markdown, plainrequired | How to read body: markdown (a CommonMark subset: emphasis, links, lists, quotes and code; raw HTML is shown as text) or plain (shown exactly as written). |
items[].bodystringrequired | The text as written; empty for a deleted message. |
items[].stateone of: sent, deletedrequired | sent, or deleted (it keeps its place, with nothing in it). |
items[].sent_atstring (date-time)required | No description. |
items[].edited_atstring (date-time) or nullrequired | When it was last edited, or null. |
items[].reply_toobject or nullrequired | The message this one quotes, or null. |
items[].reply_to.message_idstringrequired | A message ID, such as msg_01JC0000000000000000000000. |
items[].reply_to.author_namestringrequired | No description. |
items[].reply_to.excerptstringrequired | The quoted message as plain text, shortened, or "Message deleted". |
items[].attachmentsarray of objectsrequired | |
items[].attachments[].file_idstringrequired | A file ID, such as fil_01JC0000000000000000000000. |
items[].attachments[].namestringrequired | The file's name. |
items[].attachments[].kindone of: image, video, audio, pdf, otherrequired | What kind of file it is. |
items[].stickerobject or nullrequired | The sticker this message is, or null. |
items[].sticker.alt_textstringrequired | What the sticker shows. |
items[].sticker.file_idstringrequired | A file ID, such as fil_01JC0000000000000000000000. |
items[].reactionsarray of objectsrequired | Reactions, grouped by emoji, in the order first used. |
items[].reactions[].emojistringrequired | The emoji: a Unicode emoji, or ":name:" for a custom one. |
items[].reactions[].countintegerrequired | No description. |
items[].reactions[].byarray of stringsrequired | Who reacted, by name ("Rigel" for Rigel). |
items[].mentionsarray of objectsrequired | Who it mentions. |
items[].mentions[].person_idstring or nullrequired | Null for Rigel. |
items[].mentions[].namestringrequired | No description. |
items[].threadobject or nullrequired | The thread under this message, or null when it has none (and for messages inside a thread). |
items[].thread.reply_countintegerrequired | No description. |
items[].thread.last_reply_atstring (date-time)required | No description. |
items[].moved_toobject or nullrequired | Set only on the line left where messages were moved out, shown as "Moved 3 messages to Summer trip". |
items[].moved_to.conversation_idstring or nullrequired | The topic they went to, or null if it's gone. |
items[].moved_to.titlestring or nullrequired | Its title now, or null if it's gone. |
items[].moved_to.message_countintegerrequired | How many messages moved, not counting their threads. |
items[].linksarray of objectsrequired | Records of any app the message links to, from its text, with each one's web route. |
items[].links[].record_idstringrequired | No description. |
items[].links[].addressstring or nullrequired | No description. |
items[].addressstringrequired | The web route that opens this message. |
Errors#
Every error has the same envelope: error.code, error.message, error.details, error.recovery and error.request_id.
| Status | Code | When |
|---|---|---|
400 | validation_failed | A field is missing, misspelled or out of range. details.fields lists each problem. |
401 | unauthenticated | The request has no valid session. |
404 | message_not_found | The message doesn't exist in this household. |
404 | not_found | The household doesn't exist, or you aren't a member of it. |
Examples#
These are real. Each was recorded from a sample household, the Okafors, running through the whole API when this site was built.
Read around a message
The message with some of what came before and after it.
curl 'https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/queries/chat.message.context?message_id=msg_01M6V9CSMWTTAMGZS9MTJ8YK65' \
-H "Cookie: rigel_session=$RIGEL_SESSION"const response = await fetch("https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/queries/chat.message.context?message_id=msg_01M6V9CSMWTTAMGZS9MTJ8YK65", {
headers: {
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
});
const data = await response.json();GET /api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/queries/chat.message.context?message_id=msg_01M6V9CSMWTTAMGZS9MTJ8YK65 HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01M6V9CSNTYPXY67C8TMN0KMZH
{
"conversation": {
"id": "cnv_00000000000000000000000000",
"title": "Family"
},
"thread_root_message_id": null,
"items": [
{
"id": "msg_01M6V9CSMQRZ6GEQ67CPHFX844",
"conversation_id": "cnv_00000000000000000000000000",
"thread_root_message_id": null,
"author": {
"kind": "person",
"person_id": "per_01M6V9CS6RX26JK5KVYGRN22D2",
"name": "Ada Okafor"
},
"format": "markdown",
"body": "Dinner on Monday is the orzo. Make extra for lunches.",
"state": "sent",
"sent_at": "2026-11-07T15:17:52.407Z",
"edited_at": null,
"reply_to": null,
"attachments": [],
"sticker": null,
"reactions": [],
"mentions": [],
"thread": null,
"moved_to": null,
"links": [],
"address": "/chat/message/msg_01M6V9CSMQRZ6GEQ67CPHFX844"
},
{
"id": "msg_01M6V9CSMTRMX2BPZ3MJTKGREF",
"conversation_id": "cnv_00000000000000000000000000",
"thread_root_message_id": null,
"author": {
"kind": "person",
"person_id": "per_01M6V9CS6RX26JK5KVYGRN22D2",
"name": "Ada Okafor"
},
"format": "markdown",
"body": "@Ben can you pick Theo up from soccer on Tuesday at 5? I have a late meeting.",
"state": "sent",
"sent_at": "2026-11-07T15:17:52.410Z",
"edited_at": "2026-11-07T15:17:52.430Z",
"reply_to": null,
"attachments": [],
"sticker": null,
"reactions": [],
"mentions": [],
"thread": null,
"moved_to": null,
"links": [],
"address": "/chat/message/msg_01M6V9CSMTRMX2BPZ3MJTKGREF"
},
{
"id": "msg_01M6V9CSMWTTAMGZS9MTJ8YK65",
"conversation_id": "cnv_00000000000000000000000000",
"thread_root_message_id": null,
"author": {
"kind": "person",
"person_id": "per_01M6V9CS6RX26JK5KVYGRN22D2",
"name": "Ada Okafor"
},
"format": "markdown",
"body": "Practice is at 5:00 pm, so leave by 4:40.",
"state": "sent",
"sent_at": "2026-11-07T15:17:52.413Z",
"edited_at": null,
"reply_to": {
"message_id": "msg_01M6V9CSMTRMX2BPZ3MJTKGREF",
"author_name": "Ada Okafor",
"excerpt": "@Ben can you pick Theo up from soccer on Tuesday at 5? I have a late meeting."
},
"attachments": [],
"sticker": null,
"reactions": [
{
"emoji": "🙌",
"count": 1,
"by": [
"Ada Okafor"
]
}
],
"mentions": [],
"thread": null,
"moved_to": null,
"links": [],
"address": "/chat/message/msg_01M6V9CSMWTTAMGZS9MTJ8YK65"
},
{
"id": "msg_01M6V9CSMZCPCNEC9EM5YQPJZP",
"conversation_id": "cnv_00000000000000000000000000",
"thread_root_message_id": null,
"author": {
"kind": "person",
"person_id": "per_01M6V9CS6RX26JK5KVYGRN22D2",
"name": "Ada Okafor"
},
"format": "markdown",
"body": "Middle shelf, restocked.",
"state": "sent",
"sent_at": "2026-11-07T15:17:52.418Z",
"edited_at": null,
"reply_to": null,
"attachments": [
{
"file_id": "fil_01M6V9CS96RRJQEBVXVCKMMR0T",
"name": "pantry-middle-shelf.png",
"kind": "image"
}
],
"sticker": null,
"reactions": [],
"mentions": [],
"thread": {
"reply_count": 1,
"last_reply_at": "2026-11-07T15:17:52.422Z"
},
"moved_to": null,
"links": [],
"address": "/chat/message/msg_01M6V9CSMZCPCNEC9EM5YQPJZP"
}
]
}For Rigel#
Rigel's tool for this query is chat_message_context. Rigel runs this on its own, then says what it did. The agent guide has the rest.