Move messages into another topic
chat.thread.move
POST/api/v1/households/{household_id}/commands/chat.thread.move
- Command
- Rigel runs it
- Applies offline
Moves messages, with any threads under them, into an existing topic or a new one ("spin this off into its own topic"), keeping their times, and leaves a line where they were saying where they went. Only messages of one conversation, not ones inside a thread. Errors: message_not_found, message_in_thread, messages_in_different_conversations, conversation_not_found, same_conversation.
Parameters#
| Field | Description |
|---|---|
household_idpathstringrequired | The household's ID. |
Idempotency-Keyheaderstringoptional | The command's ID. Reuse it when retrying the same command. |
Request body#
JSON, as application/json.
| Field | Description |
|---|---|
message_idsarray of stringsrequired | Messages of one conversation to move, not ones inside a thread. A message with a thread under it brings its thread along. |
conversation_idstringoptional | Move them into this existing topic. |
new_titlestringoptional | Or into a new topic with this title. |
Response#
200 The command was applied.
| Field | Description |
|---|---|
resultobjectrequired | What the command returned, such as the IDs it created. |
result.conversation_idstringrequired | The topic they're in now. |
result.moved_line_message_idstringrequired | The line left behind in the topic they came from. |
versionintegerrequired | The household version after the command. |
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 |
|
404 | conversation_not_found |
|
404 | not_found | The household doesn't exist, or you aren't a member of it. |
409 | message_in_thread | A message inside a thread. |
409 | messages_in_different_conversations | Messages from two conversations. |
409 | same_conversation | Already in that conversation. |
409 | no_person | A signed-in account that isn't a person in the family. |
409 | idempotency_key_reused | The Idempotency-Key was already used for a different command. |
Examples#
These are real. Each scenario is one of the command's test cases, run on a household when this site was built, and the response is what the API returned.
Moves a message and its thread into an existing topic and leaves a line
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/chat.thread.move' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"message_ids": [
"msg_01JC0000000000000000000001"
],
"conversation_id": "cnv_01JC0000000000000000000002"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/chat.thread.move", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
message_ids: [
"msg_01JC0000000000000000000001",
],
conversation_id: "cnv_01JC0000000000000000000002",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/chat.thread.move HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"message_ids": [
"msg_01JC0000000000000000000001"
],
"conversation_id": "cnv_01JC0000000000000000000002"
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0A3X54R3W3HJASASX
{
"result": {
"conversation_id": "cnv_01JC0000000000000000000002",
"moved_line_message_id": "msg_01JC4N0000MBGE5RJ6Q7V6V6T8"
},
"version": 1
}Spins messages off into a new topic: its ID comes before the line's
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/chat.thread.move' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"message_ids": [
"msg_01JC0000000000000000000001",
"msg_01JC0000000000000000000003",
"msg_01JC0000000000000000000001"
],
"new_title": "Beach day"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/chat.thread.move", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
message_ids: [
"msg_01JC0000000000000000000001",
"msg_01JC0000000000000000000003",
"msg_01JC0000000000000000000001",
],
new_title: "Beach day",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/chat.thread.move HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"message_ids": [
"msg_01JC0000000000000000000001",
"msg_01JC0000000000000000000003",
"msg_01JC0000000000000000000001"
],
"new_title": "Beach day"
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0V55EKNZ76VE7HGZ3
{
"result": {
"conversation_id": "cnv_01JC4N0000MBGE5RJ6Q7V6V6T8",
"moved_line_message_id": "msg_01JC4N0000VGW1STJ6TGXRB7FY"
},
"version": 1
}A message that isn't there
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/chat.thread.move' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"message_ids": [
"msg_01JC0000000000000000000001",
"msg_01JC0000000000000000000099"
],
"conversation_id": "cnv_01JC0000000000000000000002"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/chat.thread.move", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
message_ids: [
"msg_01JC0000000000000000000001",
"msg_01JC0000000000000000000099",
],
conversation_id: "cnv_01JC0000000000000000000002",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/chat.thread.move HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"message_ids": [
"msg_01JC0000000000000000000001",
"msg_01JC0000000000000000000099"
],
"conversation_id": "cnv_01JC0000000000000000000002"
}HTTP/1.1 404 Not Found
Content-Type: application/json
X-Request-Id: req_01K9D9S2R07WZY9705KDKVKWZ7
{
"error": {
"code": "message_not_found",
"message": "That message isn't there any more. No changes were applied.",
"details": {
"message_id": "msg_01JC0000000000000000000099"
},
"recovery": "Read the current state, then send a command that fits it.",
"request_id": "req_01K9D9S2R07WZY9705KDKVKWZ7"
}
}A message inside a thread
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/chat.thread.move' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"message_ids": [
"msg_01JC0000000000000000000002"
],
"conversation_id": "cnv_01JC0000000000000000000002"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/chat.thread.move", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
message_ids: [
"msg_01JC0000000000000000000002",
],
conversation_id: "cnv_01JC0000000000000000000002",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/chat.thread.move HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"message_ids": [
"msg_01JC0000000000000000000002"
],
"conversation_id": "cnv_01JC0000000000000000000002"
}HTTP/1.1 409 Conflict
Content-Type: application/json
X-Request-Id: req_01K9D9S2R047V7T2XQPKYWZETG
{
"error": {
"code": "message_in_thread",
"message": "Only messages outside threads can be moved; move the one the thread is under. No changes were applied.",
"details": {},
"recovery": "Read the current state, then send a command that fits it.",
"request_id": "req_01K9D9S2R047V7T2XQPKYWZETG"
}
}Messages from two conversations
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/chat.thread.move' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"message_ids": [
"msg_01JC0000000000000000000001",
"msg_01JC0000000000000000000005"
],
"new_title": "Mixed"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/chat.thread.move", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
message_ids: [
"msg_01JC0000000000000000000001",
"msg_01JC0000000000000000000005",
],
new_title: "Mixed",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/chat.thread.move HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"message_ids": [
"msg_01JC0000000000000000000001",
"msg_01JC0000000000000000000005"
],
"new_title": "Mixed"
}HTTP/1.1 409 Conflict
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0MC8J2WDFTMTX6F72
{
"error": {
"code": "messages_in_different_conversations",
"message": "Those messages are in different topics; move them one topic at a time. No changes were applied.",
"details": {},
"recovery": "Read the current state, then send a command that fits it.",
"request_id": "req_01K9D9S2R0MC8J2WDFTMTX6F72"
}
}A destination that isn't there
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/chat.thread.move' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"message_ids": [
"msg_01JC0000000000000000000001"
],
"conversation_id": "cnv_01JC0000000000000000000003"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/chat.thread.move", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
message_ids: [
"msg_01JC0000000000000000000001",
],
conversation_id: "cnv_01JC0000000000000000000003",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/chat.thread.move HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"message_ids": [
"msg_01JC0000000000000000000001"
],
"conversation_id": "cnv_01JC0000000000000000000003"
}HTTP/1.1 404 Not Found
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0AXKYWS6MBWTDBYEQ
{
"error": {
"code": "conversation_not_found",
"message": "That topic isn't there any more. No changes were applied.",
"details": {
"conversation_id": "cnv_01JC0000000000000000000003"
},
"recovery": "Read the current state, then send a command that fits it.",
"request_id": "req_01K9D9S2R0AXKYWS6MBWTDBYEQ"
}
}Already in that conversation
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/chat.thread.move' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"message_ids": [
"msg_01JC0000000000000000000001"
],
"conversation_id": "cnv_01JC0000000000000000000001"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/chat.thread.move", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
message_ids: [
"msg_01JC0000000000000000000001",
],
conversation_id: "cnv_01JC0000000000000000000001",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/chat.thread.move HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"message_ids": [
"msg_01JC0000000000000000000001"
],
"conversation_id": "cnv_01JC0000000000000000000001"
}HTTP/1.1 409 Conflict
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0YTJ77BCC9M1WZESD
{
"error": {
"code": "same_conversation",
"message": "They're already in that topic. No changes were applied.",
"details": {},
"recovery": "Read the current state, then send a command that fits it.",
"request_id": "req_01K9D9S2R0YTJ77BCC9M1WZESD"
}
}A signed-in account that isn't a person in the family
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/chat.thread.move' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"message_ids": [
"msg_01JC0000000000000000000001"
],
"conversation_id": "cnv_01JC0000000000000000000002"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/chat.thread.move", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
message_ids: [
"msg_01JC0000000000000000000001",
],
conversation_id: "cnv_01JC0000000000000000000002",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/chat.thread.move HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"message_ids": [
"msg_01JC0000000000000000000001"
],
"conversation_id": "cnv_01JC0000000000000000000002"
}HTTP/1.1 409 Conflict
Content-Type: application/json
X-Request-Id: req_01K9D9S2R072DQ5G4ZWRN34GXC
{
"error": {
"code": "no_person",
"message": "Only a member of the family can write in chat. No changes were applied.",
"details": {},
"recovery": "Read the current state, then send a command that fits it.",
"request_id": "req_01K9D9S2R072DQ5G4ZWRN34GXC"
}
}Spin messages off into their own topic
The messages keep their times, and a line is left where they were saying where they went.
curl -X POST 'https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/chat.thread.move' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01M6V9CSP5DKNY107SEV829TWK' \
-d '{
"message_ids": [
"msg_01M6V9CSMTRMX2BPZ3MJTKGREF",
"msg_01M6V9CSMWTTAMGZS9MTJ8YK65"
],
"new_title": "Soccer rides"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/chat.thread.move", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01M6V9CSP5DKNY107SEV829TWK",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
message_ids: [
"msg_01M6V9CSMTRMX2BPZ3MJTKGREF",
"msg_01M6V9CSMWTTAMGZS9MTJ8YK65",
],
new_title: "Soccer rides",
}),
});
const data = await response.json();POST /api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/chat.thread.move HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01M6V9CSP5DKNY107SEV829TWK
{
"message_ids": [
"msg_01M6V9CSMTRMX2BPZ3MJTKGREF",
"msg_01M6V9CSMWTTAMGZS9MTJ8YK65"
],
"new_title": "Soccer rides"
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01M6V9CSP5VGNFQB4CWX565WZC
{
"result": {
"conversation_id": "cnv_01M6V9CSP5K3EY3W61CBYMFK87",
"moved_line_message_id": "msg_01M6V9CSP5CY1BGS6192W2ZJKH"
},
"version": 122
}For Rigel#
Rigel's tool for this command is chat_thread_move. Rigel runs this on its own, then says what it did. The agent guide has the rest.