Skip to content
Rigel docs
Open Rigel

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#

Move messages into another topic: parameters
FieldDescription
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.

Move messages into another topic: request body fields
FieldDescription
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.

1 to 200 items
conversation_idstringoptional

Move them into this existing topic.

new_titlestringoptional

Or into a new topic with this title.

at most 80 characters

Response#

200 The command was applied.

Move messages into another topic: response fields
FieldDescription
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.

Move messages into another topic: errors
StatusCodeWhen
400validation_failedA field is missing, misspelled or out of range. details.fields lists each problem.
401unauthenticatedThe request has no valid session.
404message_not_found
  • The message doesn't exist in this household.
  • A message that isn't there.
404conversation_not_found
  • The conversation doesn't exist in this household.
  • A destination that isn't there.
404not_foundThe household doesn't exist, or you aren't a member of it.
409message_in_threadA message inside a thread.
409messages_in_different_conversationsMessages from two conversations.
409same_conversationAlready in that conversation.
409no_personA signed-in account that isn't a person in the family.
409idempotency_key_reusedThe 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

Request, curl
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"
}'
Request, TypeScript
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();
Request, HTTP
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"
}
Response, 200
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

Request, curl
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"
}'
Request, TypeScript
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();
Request, HTTP
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"
}
Response, 200
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

Request, curl
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"
}'
Request, TypeScript
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();
Request, HTTP
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"
}
Response, 404
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

Request, curl
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"
}'
Request, TypeScript
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();
Request, HTTP
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"
}
Response, 409
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

Request, curl
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"
}'
Request, TypeScript
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();
Request, HTTP
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"
}
Response, 409
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

Request, curl
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"
}'
Request, TypeScript
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();
Request, HTTP
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"
}
Response, 404
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

Request, curl
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"
}'
Request, TypeScript
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();
Request, HTTP
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"
}
Response, 409
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

Request, curl
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"
}'
Request, TypeScript
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();
Request, HTTP
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"
}
Response, 409
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.

Request, curl
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"
}'
Request, TypeScript
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();
Request, HTTP
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"
}
Response, 200
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.

Rigel is in early access, and sign-up is by invitation. Open Rigel