Set what's in a pack
chat.pack.set_items
POST/api/v1/households/{household_id}/commands/chat.pack.set_items
- Command
- Rigel runs it
- Applies offline
Replaces a pack's contents with these custom emoji and stickers, in this order. An item listed twice is kept once, at its first place. Errors: pack_not_found, custom_emoji_not_found, sticker_not_found.
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 |
|---|---|
pack_idstringrequired | A expression pack ID, such as epk_01JC0000000000000000000000. |
itemsarray of objectsrequired | Everything in the pack, in order. Replaces what was there. |
items[].custom_emoji_idstringoptional | A custom emoji ID, such as cem_01JC0000000000000000000000. |
items[].sticker_idstringoptional | A sticker ID, such as stk_01JC0000000000000000000000. |
Response#
200 The command was applied.
| Field | Description |
|---|---|
resultobjectrequired | What the command returned, such as the IDs it created. |
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 | pack_not_found |
|
404 | custom_emoji_not_found |
|
404 | sticker_not_found |
|
404 | not_found | The household doesn't exist, or you aren't a member of it. |
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.
Replaces the contents, in order, listing an item twice once
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/chat.pack.set_items' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"pack_id": "epk_01JC0000000000000000000001",
"items": [
{
"sticker_id": "stk_01JC0000000000000000000001"
},
{
"custom_emoji_id": "cem_01JC0000000000000000000002"
},
{
"sticker_id": "stk_01JC0000000000000000000001"
}
]
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/chat.pack.set_items", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
pack_id: "epk_01JC0000000000000000000001",
items: [
{
sticker_id: "stk_01JC0000000000000000000001",
},
{
custom_emoji_id: "cem_01JC0000000000000000000002",
},
{
sticker_id: "stk_01JC0000000000000000000001",
},
],
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/chat.pack.set_items HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"pack_id": "epk_01JC0000000000000000000001",
"items": [
{
"sticker_id": "stk_01JC0000000000000000000001"
},
{
"custom_emoji_id": "cem_01JC0000000000000000000002"
},
{
"sticker_id": "stk_01JC0000000000000000000001"
}
]
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0E55GWZDMJBZE4DJG
{
"result": {},
"version": 1
}An empty list empties the pack
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/chat.pack.set_items' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"pack_id": "epk_01JC0000000000000000000001",
"items": []
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/chat.pack.set_items", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
pack_id: "epk_01JC0000000000000000000001",
items: [],
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/chat.pack.set_items HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"pack_id": "epk_01JC0000000000000000000001",
"items": []
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0ZM1A89TKZK6YE59P
{
"result": {},
"version": 1
}A pack that isn't there
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/chat.pack.set_items' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"pack_id": "epk_01JC0000000000000000000001",
"items": []
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/chat.pack.set_items", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
pack_id: "epk_01JC0000000000000000000001",
items: [],
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/chat.pack.set_items HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"pack_id": "epk_01JC0000000000000000000001",
"items": []
}HTTP/1.1 404 Not Found
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0VB0JC69187AW9VJF
{
"error": {
"code": "pack_not_found",
"message": "That pack isn't there any more. No changes were applied.",
"details": {
"pack_id": "epk_01JC0000000000000000000001"
},
"recovery": "Read the current state, then send a command that fits it.",
"request_id": "req_01K9D9S2R0VB0JC69187AW9VJF"
}
}An emoji that isn't there
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/chat.pack.set_items' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"pack_id": "epk_01JC0000000000000000000001",
"items": [
{
"custom_emoji_id": "cem_01JC0000000000000000000009"
}
]
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/chat.pack.set_items", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
pack_id: "epk_01JC0000000000000000000001",
items: [
{
custom_emoji_id: "cem_01JC0000000000000000000009",
},
],
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/chat.pack.set_items HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"pack_id": "epk_01JC0000000000000000000001",
"items": [
{
"custom_emoji_id": "cem_01JC0000000000000000000009"
}
]
}HTTP/1.1 404 Not Found
Content-Type: application/json
X-Request-Id: req_01K9D9S2R09R89R6E59WZMDZN9
{
"error": {
"code": "custom_emoji_not_found",
"message": "One of those emoji isn't there any more. No changes were applied.",
"details": {},
"recovery": "Read the current state, then send a command that fits it.",
"request_id": "req_01K9D9S2R09R89R6E59WZMDZN9"
}
}A sticker that isn't there
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/chat.pack.set_items' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"pack_id": "epk_01JC0000000000000000000001",
"items": [
{
"sticker_id": "stk_01JC0000000000000000000009"
}
]
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/chat.pack.set_items", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
pack_id: "epk_01JC0000000000000000000001",
items: [
{
sticker_id: "stk_01JC0000000000000000000009",
},
],
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/chat.pack.set_items HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"pack_id": "epk_01JC0000000000000000000001",
"items": [
{
"sticker_id": "stk_01JC0000000000000000000009"
}
]
}HTTP/1.1 404 Not Found
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0Z1M92JDV5MS065R1
{
"error": {
"code": "sticker_not_found",
"message": "One of those stickers isn't there any more. No changes were applied.",
"details": {},
"recovery": "Read the current state, then send a command that fits it.",
"request_id": "req_01K9D9S2R0Z1M92JDV5MS065R1"
}
}Fill a pack
curl -X POST 'https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/chat.pack.set_items' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01M6V9CSPKF8S16NEDVXQG2QRX' \
-d '{
"pack_id": "epk_01M6V9CSPHPZGPH3BGCB1YP198",
"items": [
{
"custom_emoji_id": "cem_01M6V9CSPG68TY89RDKJR3K9XC"
}
]
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/chat.pack.set_items", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01M6V9CSPKF8S16NEDVXQG2QRX",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
pack_id: "epk_01M6V9CSPHPZGPH3BGCB1YP198",
items: [
{
custom_emoji_id: "cem_01M6V9CSPG68TY89RDKJR3K9XC",
},
],
}),
});
const data = await response.json();POST /api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/chat.pack.set_items HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01M6V9CSPKF8S16NEDVXQG2QRX
{
"pack_id": "epk_01M6V9CSPHPZGPH3BGCB1YP198",
"items": [
{
"custom_emoji_id": "cem_01M6V9CSPG68TY89RDKJR3K9XC"
}
]
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01M6V9CSPKPNWGER6TJF3KBN23
{
"result": {},
"version": 128
}For Rigel#
Rigel's tool for this command is chat_pack_set_items. Rigel runs this on its own, then says what it did. The agent guide has the rest.