Message Preview
AI · MessagePreview, ApprovalCard
A message to a customer, or a post, exactly as it goes out: the channel (name and icon; register a brand icon for the logo), the recipient masked (maskRecipient()), the sending account, the reply window (open, closing, closed) for channels that only allow free text for a while after the customer's last message, the last messages of the conversation for context, and the text or a pre-approved template with its category and parameters. Posts show their image or video (media). Ends with "Goes out once after A".
Approval neededAtlas · SupportCommunication6 min
Reply to a customer on WhatsApp
Atlas answers in the open reply window; replies need your OK.
- Channel
- Recipient
- Erika L. (…5678)
- From
- +49 30 1234 5000
- Reply window
- Closes at Apr 16, 6:20 PM
Last messages
- Customer · Apr 15, 6:20 PMHi, my order 2041 still says processing.
- You · Apr 15, 6:24 PMThanks, I will check with the warehouse.
- Customer · Apr 16, 9:02 AMAny news? I need it by Friday.
Text that goes out
Good news: order 2041 left the warehouse this morning and arrives Thursday.
Tracking: NW-55102.
Goes out once after A, exactly as shown.
Approval neededSocial · MarketingMarketing12 min
Publish a post on Instagram
- Channel
- Recipient
- Noah B. (…7731)
- Reply window
- Closed since Apr 14, 11:00 AM
- Template
- order_update (en)Category: Utility
Text that goes out
- {{1}} Noah
- {{2}} 2058
- {{3}} Thursday
Goes out once after A, exactly as shown.
Props
MessagePreview
| Prop | Type | Notes |
|---|---|---|
title? | ReactNode | One line: "Reply to Erika M. on WhatsApp". |
channel | string | The channel's name ("WhatsApp", "Instagram", "SMS"). |
channelIcon? | IconName | The channel's icon (default `send`); register brand icons to show the logo. |
recipient? | string | Already masked, or pass it through `maskRecipient`. |
sender? | string | The account it is sent from. |
window? | { state: "open" | "closing" | "closed"; until?: Date | string | number } | Messaging windows (e.g. 24 hours after the customer's last message). |
context? | MessagePreviewContext[] | The last messages, oldest first. |
text? | string | Exactly what goes out. |
template? | { name: string; category?: string; language?: string; params?: string[] } | A pre-approved template instead of free text. |
media? | { kind: "image" | "video"; src: string; alt?: string; poster?: string } | The image or video of a post. |
warnings? | ReactNode[] | |
facts? | KeyValueItem[] | |
className? | string | Extra class on the root element. |
style? | CSSProperties | Inline style on the root element. |
ApprovalCard
| Prop | Type | Notes |
|---|---|---|
title | ReactNode | Required |
text? | ReactNode | |
children? | ReactNode | |
agent? | string | |
project? | string | |
family? | RiskFamily | |
familyLabel? | string | |
age? | string | |
escalation? | ReactNode | |
trace? | ReactNode | |
note? | ReactNode | |
heading? | string | |
options? | ApprovalOption[] | |
approveLabel? | string | |
onDecide? | (key: ApprovalKey, text?: string) => void | Promise<unknown> | Called with the answer (and the text of B or D). Return a Promise to keep the card busy until it settles: the answer's button spins and every answer is disabled; a rejection shows an error (a rejected string is shown as is) and keeps the card open. Once it resolves, a card without a `decision` prop collapses to its one-line record; with a plain callback, set `decision` yourself. |
decision? | ApprovalDecision | null | The decision record: shown as one line instead of the card; `null` keeps the card open. |
compact? | boolean | Side panels: tighter, the answers in a row, the payload folded behind "Show what runs" (one click, never a summary). |
stepUp? | boolean | Money, legal and infrastructure decisions: A and B (the answers that run something) need a fresh passkey. They show "Needs your passkey"; while `onDecide` is pending the pressed answer says "Confirm with passkey". Do the WebAuthn step-up in `onDecide` and reject if it fails. |
busy? | ApprovalKey | null | The answer being sent, when you track it yourself (controlled busy state). |
error? | ReactNode | An error to show above the answers (controlled); a rejected `onDecide` shows one by itself. |
screen? | boolean | Fills its container, e.g. a deep link on a phone: the content scrolls and A–D stay at the bottom, full width, in thumb reach (with the safe area). |
href? | string | Makes the title a link to the full approval (with `linkAs` for a router's link). |
linkAs? | ElementType | |
onApprove? | () => void | |
onDeny? | () => void | |
onEdit? | (text: string) => void | |
state? | "approved" | "denied" | |
className? | string | Extra class on the root element. |
style? | CSSProperties | Inline style on the root element. |