DEV Community

Building Real-Time Analytics for a WhatsApp Native CRM

" (assistant placeholder). So indeed the input truncated mid-word "Wh". Did the system impose a max length? Could be the user message was cut off at 32000 chars? Let's count: The first 3/4 of article maybe ~16k chars? Hmm.

Need determine if there is hidden content after "Wh" in "raw text"? No.

But perhaps we can infer the rest? The title and expected article from known text? The content after "Wh" would include "What We Got Wrong" section and "What the Analytics Feed Back Into" etc. But user explicitly says "Preserve every fact... Never invent, add, remove, or reorder information." If input truncated, we can't include missing sections because we don't have them. But maybe the full article was actually provided in the prompt but truncated visually? Let's inspect the prompt text after "backend. Wh": In the original user message in the conversation, I notice after "backend. Wh" there is a newline and then "What We Got Wrong..."? Actually no, that was in my initial parse? Let's look at the exact user message as it appears in the problem statement:

Building Real-Time Analytics for a WhatsApp Native CRM Every CRM vendor ships a table of numbers. ... it just changes their backend. Wh

The problem statement ends with "Wh" no punctuation. Wait maybe the full user message is:

... it just changes their backend. What We Got Wrong Three mistakes are worth writing down... Wh

No, because I see at the very end "Wh" in the prompt. Let's see if there is "What We Got Wrong" inside the user message before "Wh"? The user message before "backend. Wh" did not include "What We Got Wrong" in the first part. Actually the first part of user message goes through "Going Real-Time..." and ends at "it just changes their backend." There is no further content. So the input is truncated. But why did the system prompt say "Title: ... Article: ..." maybe the full article includes more, but due to input cutoff we only got part? We need produce output for the input we got, but maybe the expected output should include full reconstructed article? Hmm.

Let's look at the title "Building Real-Time Analytics for a WhatsApp Native CRM" and the article likely originally from a blog. The content after "Wh" is possibly in the second half, but maybe the user accidentally omitted it? We need decide response. In these tasks, we are supposed to process given article body. If article is truncated, we should reformat exactly the text we have, perhaps ending at "backend." But the user asks "Reformat it into clean, readable Markdown" with "Preserve every fact, name, number, and quotation exactly as given. Never invent, add, remove, or reorder information." So we cannot invent the missing sections. But we can note? No, output only article body. Should we include "Wh" at end? No, that would be weird. Maybe treat "Wh" as a typo/truncation and omit? But never remove information. However "Wh" is an incomplete word, not meaningful. We probably should not output it. But we'd be removing "Wh". Maybe that's okay because it's not a fact.

Let's re-read the task: "You are given the raw body of a news article that arrived as an undifferentiated wall of text. Reformat it into clean, readable Markdown for a technical audience." The body likely should be complete. The problem statement may have been generated with the article and maybe due to formatting, the final "Wh" is actually followed by a newline and then more text but hidden? Let's inspect the prompt code block in the initial content:

At the end:

... it just changes their backend. Wh

Building Real-Time Analytics for a WhatsApp Native CRM Every CRM vendor ships a table of numbers. Very few ship analytics ... 

Wait, I see in the user block there is a line at the very end: "Building Real-Time Analytics for a WhatsApp Native CRM Every CRM vendor ships a table of numbers. Very few ship analytics that a team actually acts on. When we were building the analytics layer inside Zetta CRM , the numbers were never the hard part - ... Wh" Wait no, that's the beginning again? Let's examine the entire user message as provided in the conversation at top. It begins with "Building Real-Time Analytics for a WhatsApp Native CRM Every CRM vendor ships..." and after a long text ends "...backend. Wh". But there is no repeat.

Maybe the input is not truncated; the word "Wh" is deliberately at end as part of the text? No, "Wh" isn't a sentence. Could be a formatting artifact from some source, e.g., the article's original URL or something? Hmm.

Let's perhaps search memory: There is an article "Building Real-Time Analytics for a WhatsApp Native CRM" by Cipta Dusa? It might be a hypothetical/real blog. In the second part, after "backend." comes "What We Got Wrong" section: "Three mistakes are worth writing down, because each cost us a redesign that a bit more thought could have avoided." Then bullet lists etc. I recall from the prompt? The user input only got as far as "backend. Wh" but perhaps the model is expected to infer from a hidden "full article" that was cut off? Maybe the system omitted the tail accidentally. But as an AI, we should not invent. However, if we output only partial, maybe fails expected. Need determine likely intended answer.

Let's examine the exact raw input length. It includes all sections up to "Going Real-Time" and then truncated at "Wh". The title and article body has no "What We Got Wrong" section. But in the "Rules" maybe they say "Break the text into short, well-structured paragraphs separated by a blank line. Add Markdown section headings..." There is no mention of incomplete text. So likely they expect a reformatted version of the input as-is. But why include a truncated word? Could be that the user message got truncated due to a technical limit. We need perhaps mention in output? No, "Output only the reformatted article body as Markdown, nothing else." Could include "Wh" at end? That would be weird and incomplete.

Let's think about whether there are any clues: The article text in the user message is quite long-maybe around 9,000 characters? The prompt might have a max length of 8,000 tokens? The actual user message maybe was cut at 8,000 chars? It ends mid-word. The rest of the article would be ~2,000 chars. Could we reconstruct from known data? We shouldn't invent, but maybe the exact missing text is not required? Wait the user message as displayed in the prompt might actually have the entire article but the "Wh" at the end is just the first two letters of the next heading "What We Got Wrong", and then the visible prompt has been cut off by the interface? Let's check the current conversation: In the "user" block, there is a line "it just changes their backend. Wh" then immediately after the user block, the next block is "assistant" with "You are an expert..."? No, the conversation format: user message includes the entire task instructions and article. At the end after "Wh" there is a newline? In the prompt as rendered, after "Wh" there is a line break and then "#.## Functions"? Actually no.

Let me re-read the top-level prompt:

<user>
You are an expert editor for DevPlace...
...
Title: Building Real-Time Analytics for a WhatsApp Native CRM

Article:
Building Real-Time Analytics for a WhatsApp Native CRM Every CRM vendor ships a table of numbers. ... it just changes their backend. Wh
</user>
<assistant>
...

That's exactly. The user message ends "Wh". So the input has been truncated. The system might have a "current date" etc. It wants us to reformat. If input truncated, maybe there is no full article; we cannot invent missing facts. But perhaps expected answer should produce the formatted text up to "backend." and stop. However, the instructions say "Do not repeat the article title as a heading" and "Preserve every fact, name, number, and quotation exactly as given." We can add headings for sections we have. We can output only the part we have. But should we include "Wh" as a heading? No.

Maybe "Wh" is an artifact of a source, like a watermark or invalid char? Could be "Wh" is part of "WhatsApp" in a section heading but truncated? Wait the article at the end of the truncated portion would transition to "What We Got Wrong" section. The word "Wh" is likely the start of "What We Got Wrong." So the input is cut off at exactly that point. The expected response maybe should include the remaining article? But we don't have it. Unless the task intentionally uses a truncated input to test whether the model refuses to invent. But the prompt says "Never invent, add, remove, or reorder information." So if missing, we should just output what's given. But then why give rules about lists and headings? Still applicable to given text.

Let's decide: We'll reformat the given text fully, using headings and lists. We won't include the dangling "Wh". We'll end at the end of the "Going Real-Time" section. That output will be incomplete relative to a full article but honest. However, the user may expect a complete article from hidden tail? Let's see if the tail is derivable from the first part? The first part says "Here is what we built." Then sections: "The Event Pipeline", "Defining the Metrics", "Going Real-Time Without Rebuilding the World". There is no "What We Got Wrong" section. But the article's intro promised "operational decisions we'd make differently next time." Without the mistakes section, the article is incomplete. But we can't add it.

Let's consider possibility that the user message was not truncated but there is a copy of the full article somewhere in the prompt after "Wh" hidden because of vertical scroll? In the text I see user message before "Article:" includes title. Actually after the "Article:" line, the body starts. It might be that the prompt includes a second copy due to formatting? Wait at the very top of the user message, before "Article:", it says "Title: Building Real-Time Analytics for a WhatsApp Native CRM". Then "Article:" and then immediately "Building Real-Time Analytics for a WhatsApp Native CRM Every CRM vendor..." This repeats the title as the first line of the article body. That's expected (the article raw body includes title). Then after a long body, it ends at "Wh". There is no second copy.

Maybe the "Wh" at the end is actually the start of a footnote "which..." and the rest was cut off because the prompt token limit. We can treat as no further content.

But as an expert editor, maybe we can infer and complete? The rules forbid adding. So no.

Let's now plan the reformatting.

Original text structure:

  • Intro paragraph(s)
  • "Why WhatsApp Analytics Is Different" section with a lead-in sentence and bullet list? Actually in the original, after "That changes the analytical contract:" there are three bullet-like items but no markdown bullets-they are separate paragraphs beginning "Latency is a first-class metric." etc. We need convert to bullet list because it's enumerations. The rules: "Use bullet or numbered lists for enumerations." So yes, bullet list of three points.
  • "The Event Pipeline: One Shape for Everything" section with prose, a diagram as inline text/ASCII, then an example event JSON. Need format diagram as a code block? The diagram is ASCII art with arrows and text. We can put it in a fenced code block to preserve formatting. Use inline code for identifiers like conversation_id.
  • JSON example should be a fenced code block with json.
  • Explanation paragraph.
  • "Defining the Metrics That Actually Matter" section with a lead-in and a list of metrics. Need format as bullet list perhaps with bold metric names? Original has metric name, description, and follow-up sentences. We can preserve all. Use bullet list with names in bold? Is that "lightly polish" or adding? Formatting only; bold might be okay but could be seen as emphasis not in original. Better use plain list items with the name followed by period. But Markdown bullet list requires a bullet and line breaks. We can include descriptions.
  • "Going Real-Time Without Rebuilding the World" section with prose, bullet list of stack components, trade-off paragraphs.

We need add ## headings. Suggested headings:

  • Maybe no heading before intro; start with first paragraph. "Do not repeat the article title as a heading." So don't put "## Building Real-Time Analytics..." at top. The intro can stand as paragraphs.
  • ## Why WhatsApp Analytics Is Different
  • ## The Event Pipeline: One Shape for Everything
  • ## Defining the Metrics That Actually Matter
  • ## Going Real-Time Without Rebuilding the World

Do we add a heading for "What We Got Wrong"? No, not present. Should we include the initial title line as part of article body? The raw body begins with the title repeated, but the rules say "Do not repeat the article title as a heading" and "do not wrap whole answer." We can omit the title line because it's the title, not body. Is that "removing information"? The title is provided separately; in raw article body it was repeated. Usually reformatting article should omit title from body if title is separate. The rule says do not repeat title as heading. So we should not include it as a heading. But should we include the title as the first line? No, because the title is not part of "article body"? But the raw body includes it. In this case, the first line of the raw text is "Building Real-Time Analytics for a WhatsApp Native CRM Every CRM vendor ships..." The title is in the same line as the first sentence. To clean it, we'd separate the title? The rule says "Do not repeat the article title as a heading" suggests the article body given includes the title, but we should not make it a heading. But if we omit it, the text begins with "Every CRM vendor ships..." That is fine. However, "Preserve every fact... never remove" could conflict. The title is not a fact/name/number? It is the title, and user says "Do not repeat the article title as a heading." If we just include it as plain text at top, that would repeat the title, but not as a heading. The rule specifically says "Do not repeat the article title as a heading" not "do not repeat the article title at all." But "Output only the reformatted article body" means the title isn't body. In Markdown, we might include the title as a top-level heading? They explicitly prohibit that. So omit it. I think omit.

Need handle "Zetta CRM" with spacing: original sometimes "Zetta CRM ," with space before comma. We'll clean punctuation. Preserve exact names: Zetta CRM, Hallo Zetta maybe not present? The inserted full article would have "Hallo Zetta agent" but our truncated input doesn't include that. We only have what's given.

Need preserve quotes: "median time to first response", "just query the messages table for this dashboard.", "what would you change at noon if you saw this number?", "what's happening right now,". Use proper punctuation.

Need handle p95 now with space before comma. Clean to p95 now,.

Need handle conversation_id etc. Use inline code. Original has spaces around commas in JSON example? We'll normalize JSON.

Need handle ASCII diagram:

WhatsApp Gateway โ”€โ”€โ–บ Message Processor โ”€โ”€โ–บ normalized Event โ”€โ”€โ–บ event store
                         โ”‚
                         Team Inbox actions โ”€โ”€โ–บ Event
                         โ”‚
                         โ–ผ
                         stream consumers (rollups, anomaly checks, caches)

Actually original text:

WhatsApp Gateway โ”€โ”€โ–บ Message Processor โ”€โ”€โ–บ normalized Event โ”€โ”€โ–บ event store โ”‚ Team Inbox actions โ”€โ”€โ–บ Event โ”‚ โ–ผ stream consumers (rollups, anomaly checks, caches)

It's a single line with pipe characters, not a well-formatted diagram. To clean, we can create a code block with a slightly clearer layout, but must not alter meaning. The original may have intended a vertical diagram. We can arrange:

WhatsApp Gateway โ”€โ”€โ–บ Message Processor โ”€โ”€โ–บ normalized Event โ”€โ”€โ–บ event store
                           โ”‚
                           โ”‚
Team Inbox actions โ”€โ”€โ–บ Event
                           โ”‚
                           โ–ผ
                           stream consumers (rollups, anomaly checks, caches)

Need not add arrows not in original. The original has "โ”‚" before "Team Inbox actions" and before "โ–ผ stream consumers". It's ambiguous. Maybe better preserve as a single line code block? But code block with single line is fine. However, the diagram with pipes on a single line is ugly. We can break lines in a way consistent with original. The rule says preserve every fact, not necessarily exact whitespace. As an editor, we can reformat diagram into multiline for readability. Use a fenced code block.

Need include JSON block exactly. The original JSON has spaces after colons? Actually { "event" : "message.arrived" , ... }. We can format standard JSON:

{
  "event": "message.arrived",
  "ts": "2026-08-19T09:14:03Z",
  "conversation_id": "conv_9021",
  "contact_id": "c_441",
  "number_id": "n_2",
  "is_group": false,
  "is_ai": false,
  "media_types": ["image"],
  "direction": "inbound"
}

That preserves all fields. Good.

Need decide about "event store" and "stream consumers" etc.

Let's craft the output with exact content.

Intro:
"Every CRM vendor ships a table of numbers. Very few ship analytics that a team actually acts on. When we were building the analytics layer inside Zetta CRM, the numbers were never the hard part - the hard part was deciding which numbers matter and getting them to the screen fast enough that a support lead can change their routing mid-shift, not report on last week's problems. This is the story of that layer: the event pipeline, the metric definitions that survived contact with real teams, and the operational decisions we'd make differently next time."

Then ## Why WhatsApp Analytics Is Different

Paragraph:
"If you've ever built analytics for an email-based product, you're used to a comfortable rhythm: open a message, leave it in the inbox, process it hours later. Timestamps are forgiving. Peaks and valleys are predictable. WhatsApp is real-time in a way email never is. A customer waits 40 seconds, not 40 hours, before deciding you're unresponsive. That changes the analytical contract:"

Bullet list:

  • "Latency is a first-class metric. Email tools can report on "median time to first response" as a weekly average. WhatsApp teams optimize p95 now, in the middle of the day."
  • "Conversations are bursty and multi-modal. A single interaction is a photo, a voice note, three short texts, and a document - not a clean thread of one message per event."
  • "Groups warp
Read on DEV Community ↗ ← Back to News

Comments

No comments yet. Start the discussion.