Skip to Content
All Systems

03IntegrationsType: Reference architecture

SMS and chat inside the CRM, with one record per message and no blind resends

A reference design for a Zoho CRM extension built for many orgs: one record per provider message, and a person for any unclear send.

Shows

  • Software Architecture
  • Enterprise Integrations
  • API Design

Where this comes from: Drawn from systems I've designed on Zoho. The business, names and data here are generalized. The patterns and failure modes come from real work, and the design includes what that work taught me.

On This Page

In 30 Seconds

A Zoho CRM extension lets staff text and chat with customers from the record, a shared inbox or a bulk send, through a messaging provider. Each company that installs it keeps its own settings, data center and provider account. Every message, in or out, becomes one CRM record keyed by the provider's message id. A send with an unclear outcome waits for a person.

What It Guarantees

  • A repeated event is refused, and a twin that slips past is found by a scheduled check.
  • A send with an unknown outcome is never repeated on its own.
  • Every bulk recipient ends in a named bucket: sent, skipped with a reason, failed, or not confirmed.
  • A message that can't be recorded yet is retried, then swept up; a permanent failure is named, never dropped quietly.

The Problem

Picture a services company whose teams work in Zoho CRM, while customer texts go out from a provider portal and personal phones. The record shows none of it.

Moving messaging into the CRM sounds like one API call. It isn't. Provider events arrive late, twice or out of order. A message sent in bulk may not be readable by its id for a while. A send can time out, leaving nobody sure the customer got it. Phone numbers sit in local formats the provider can't deliver to. Some business chat channels accept only pre-approved templates once a 24-hour reply window closes. As a marketplace extension, the same code has to run in many orgs and data centers, each with its own provider account.

The Approach, in One Sentence

Sending and recording are separate steps, joined by the provider's message id; one import, safe to rerun, writes one CRM record per id.

Architecture

How a message becomes one CRM record
Record and inboxOne message from the thread
Bulk sendAudience from a view, checked first
Provider eventsThin webhook: message id, sender account
Send guardCanonical number, reply window, file size
Messaging providerOne id per accepted message
Import by message idFresh read, one at a time; repeats refused
Not confirmedUnknown outcome waits for a person
Pending importShort retries, then a scheduled sweep
One message recordOn the person's thread, with owner

Connections in this diagram

  • Record and inbox → Send guard (send)
  • Bulk send → Send guard (batches)
  • Provider events → Import by message id (message id)
  • Send guard → Messaging provider (valid)
  • Messaging provider → Import by message id (message ids)
  • Messaging provider → Not confirmed (no answer)
  • Import by message id → Pending import (not found yet)
  • Import by message id → One message record (new id)
  • Pending import → One message record (retry)

Key Decisions

  1. Record by the provider's message id, apart from sending

    The alternatives were writing the record from the browser, which can close mid-batch, or from the thin webhook payload, which can repeat. One import that reads each message fresh by id, and lets the CRM refuse a known id, can run any number of times. "Sent, not yet recorded" becomes a visible state.

  2. An unknown outcome is "Not confirmed", never "Failed"

    The alternatives were automatic retries, or Failed with a Retry button. Without a key the provider can use to drop repeats, both can text a customer twice. The thread reloads to look for the message, and the agent chooses Send again or Discard. "Not sent" appears only when that is certain.

  3. Each install stands alone, and the shared backend knows as little as possible

    The alternative was a central service holding every org's credentials. Screens act as the signed-in user through Zoho's embedded SDK. Provider credentials are used only server-side. When I last designed for it, screens could read the extension's settings, so the key is kept where screens can't reach it; that may have changed. Per org, the backend keeps the org id, its Zoho API domain (data center) and an encrypted key that can call one retry function.

  4. Check the whole audience before the first message goes out

    The alternative was letting the provider reject bad numbers one by one. A preflight converts every number to E.164 (plus sign, country code, number), drops duplicates, flags missing template fields and names each skip's reason. A size cap stops an accidental "all records".

When Things Go Wrong

  • An event arrives twice

    The message id sits in a unique field, and imports for one org run one at a time, so a repeat finds the first record saved and is refused. Not a search: when I last designed for it, Zoho's search could trail a fresh write by seconds or longer and miss a twin. Nor a unique field alone: in my tests, it let truly parallel writes through. Both may have changed. A scheduled check finds any twin that gets past, so the later record can be removed.

  • The provider hasn't caught up

    Right after a bulk send, a message read by id can come back "not found". Its id becomes a pending import, retried after growing delays; a scheduled CRM sweep picks up the rest.

  • A batch fails halfway

    Batches settle one by one, and each recipient lands in one bucket: sent, skipped, failed or not confirmed. Pressing Send again skips recipients already sent and leaves Not confirmed ones to a person.

  • A number is stored in a local format

    The provider can't deliver to it, and a reply opens a second conversation. One normalization rule runs before sending, in the conversation key and when matching inbound senders; what it can't normalize is refused with a reason.

What the Business Gets

  • Every message sits on its contact or lead, one thread per number and channel.
  • Staff message from the record, a shared inbox or a list view, with no second tool.
  • A bulk send ends with a summary naming every skipped or failed recipient, and why.

For Engineers

How I Build Systems Like This

Before changing an extension, I write down how it behaves today and list findings, each with a severity and the file and line behind it. AI agents (Claude Code) now do much of my hands-on research, code and tests. Analysis is read-only, a second read-only review checks the work before it ships, and done means the full test suite and a live test on a real org both pass.

How I Build With AI

On LinkedIn: more notes on Zoho architecture and AI.