{"format_version": 1,"id": "outbox","name": "Outgoing message","plural": "Outgoing messages","visibility": "owner","title": "body","columns": [ {"key": "channel","name": "Channel","type": "choice","choices": ["whatsapp","instagram","mail" ],"required": true }, {"key": "thread_id","name": "Chat","type": "text" }, {"key": "to","name": "To","type": "text","required": true }, {"key": "account","name": "Account","type": "text" }, {"key": "body","name": "Message","type": "longtext" }, {"key": "media_key","name": "Attachment","type": "text" }, {"key": "kind","name": "Kind","type": "choice","choices": ["photo","video","audio","document","poll_vote","edit","delete","poll","block","unblock","delete_chat","sender_count","sender_trash","mark_read","mark_unread","archive","trash","unsubscribe","sender_archive","mail_page" ] }, {"key": "voice","name": "Voice note","type": "bool" }, {"key": "mime","name": "File type","type": "text" }, {"key": "size_bytes","name": "Size","type": "number" }, {"key": "width","name": "Width","type": "number" }, {"key": "height","name": "Height","type": "number" }, {"key": "duration_ms","name": "Length","type": "number" }, {"key": "waveform","name": "Waveform","type": "text" }, {"key": "preview","name": "Preview","type": "longtext" }, {"key": "part","name": "Place in the send","type": "number" }, {"key": "quoted_id","name": "Replying to","type": "text" }, {"key": "reaction_to","name": "Reacting to","type": "text" }, {"key": "emoji","name": "Reaction","type": "text" }, {"key": "file_name","name": "File name","type": "text" }, {"key": "target","name": "Acting on","type": "text" }, {"key": "link","name": "Link card","type": "longtext" }, {"key": "options","name": "Options","type": "longtext" }, {"key": "selectable","name": "Choices allowed","type": "number" }, {"key": "count","name": "Count","type": "number" }, {"key": "moved","name": "Moved","type": "number" }, {"key": "uid_validity","name": "Mailbox numbering","type": "number" }, {"key": "uid_below","name": "Counted below","type": "number" }, {"key": "status","name": "Status","type": "choice","choices": ["queued","sending","sent","failed" ],"default": "queued","required": true }, {"key": "sent_at","name": "Sent at","type": "text" }, {"key": "sent_external_id","name": "Sent as","type": "text" }, {"key": "error","name": "Error","type": "text" } ],"seal": {"clear": ["thread_id","channel","media_key","status","sent_at","sent_external_id" ] },"instructions": "One row per text, picture, video or voice note the owner sends from Comms in a WhatsApp chat, made by the owner's own tap: its id and sent_external_id (the WhatsApp id it goes out under) are fixed then, so it is sent once whatever retries. The phone makes it queued with thread_id, to (the chat's WhatsApp address) and, when known, account (the linked number that brought the chat in); the Mac reads GET /v1/outbox?status=queued, sends it through its WhatsApp link and marks it sending, then sent (with sent_at) or failed (with the error, in words). Retry puts a failed row back to queued, its id unchanged. A file row names the file in media_key (his own media, sealed under his own key; the Mac opens it with his data key and leaves the row queued until it is up), kind (photo, video, audio), voice (send audio as a WhatsApp voice note), the caption in body, mime, size_bytes, width, height, duration_ms, waveform (base64 of 64 bytes 0..100) and preview (a base64 JPEG thumbnail). The sent message comes back as the owner's message with that WhatsApp id, a file naming the same media_key. A reply names the WhatsApp id it answers in quoted_id (the Mac reads that message from its own copy for the quote). A reaction is a row of its own with no words: reaction_to names the WhatsApp id reacted to and emoji the reaction (\"\" takes it off); while queued a change rewrites it, and once sent its emoji is emptied. A document is a file row with kind document and its file_name (up to 100 MB). A vote is a row of its own with no words: kind poll_vote, target the poll's WhatsApp id, options a JSON array of the words of the options he picked (an empty array takes his vote back); while queued a change rewrites it. An edit of his own sent message is a row of its own: kind edit, target the message's WhatsApp id, body the new words (while queued another edit rewrites it). A delete for everyone of his own message: kind delete, target its WhatsApp id, no words. A poll he makes: kind poll, body the question, options a JSON array of the options' words (at least two), selectable 1 when one may be chosen, 0 for any number. A text he writes with a link may carry its card in link (JSON: url, title, description, siteName, thumb a base64 JPEG), fetched by his phone; the Mac sends it as WhatsApp's own link preview."}