{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreig5rfo56wr44a4bnpkamdmy5qacjkpgxmpe4dwfp6smonzrzk6gwa",
    "uri": "at://did:plc:25rdn5elo5izoxrmtis34zuk/app.bsky.feed.post/3mp6hjbgqpdw2"
  },
  "coverImage": {
    "$type": "blob",
    "ref": {
      "$link": "bafkreice4e5mh2kjfkqh3dtirmwen4okvdgk5fszv6sti7zr2qift44nq4"
    },
    "mimeType": "image/webp",
    "size": 101154
  },
  "path": "/northbeamtech/automating-student-onboarding-via-whatsapp-in-sugarcrm-pad",
  "publishedAt": "2026-06-26T07:41:34.000Z",
  "site": "https://dev.to",
  "tags": [
    "php",
    "crm",
    "twilio",
    "automation",
    "northbeam-tech.com"
  ],
  "textContent": "A multi-step conversation engine that captures leads and creates CRM records automatically — no staff required.\n\n##  The Problem\n\nWhen prospective students first contact the school via WhatsApp, staff had to manually collect their details and create a record in SugarCRM by hand. Leads that arrived outside business hours were simply missed or delayed — there was no way to capture them without a person in the loop.\n\nThe school was already using Twilio for outbound WhatsApp messages from SugarCRM, but replies from unknown numbers went nowhere.\n\n##  What We Built\n\nA **multi-step conversation engine** built directly into SugarCRM. When an unknown number sends a WhatsApp message, the system:\n\n  1. Intercepts the message via a Twilio webhook\n  2. Checks whether the phone number already exists as a student record\n  3. If yes → routes to the existing follow-up flow (no change)\n  4. If no → starts a guided intake questionnaire, validates each answer, and creates the student record automatically\n\n\n\nZero admin involvement for new contacts.\n\n##  How It Works\n\n##  Key Technical Decisions\n\n**State machine, not a script.**\n\nEach conversation is a session with a `current_step` pointer. Questions can be reordered, toggled, or mapped to any CRM field without changing code. Admins manage the question bank directly from SugarCRM's UI.\n\n**Phone number normalization.**\n\nThe system normalizes Israeli, US, and Vietnamese number formats before matching — preventing duplicate records from format variations like `+1-555...` vs `001555...`.\n\n**Media guard.**\n\nIf a student sends a photo or voice note, the system replies politely that only text is supported and automatically resends the current question.\n\n**Partial completion handling.**\n\nIf a student stops mid-flow, automated reminders go out at 2h and 24h. If minimum data (name + phone) is collected and the student still doesn't respond, a partial record is saved so the lead isn't lost.\n\n**Multi-number support.**\n\nMultiple Twilio sender numbers can be registered in SugarCRM. Each conversation session locks to the number the student originally contacted.\n\n##  What Changed After Launch\n\n  * ✅ Student record creation from WhatsApp is fully automated for new contacts\n  * ✅ Leads outside business hours are captured without any staff intervention\n  * ✅ Admins can view full chat history, manually resume sessions, or override any step from inside SugarCRM\n  * ✅ The existing outbound messaging workflow for known students is completely unchanged\n\n\n\n##  Stack\n\n  * **PHP** — core logic and SugarCRM custom modules\n  * **SugarCRM** — custom modules for session management, question bank, and student records\n  * **Twilio WhatsApp API** — inbound webhook + outbound messaging\n  * **MySQL** — session state persistence\n\n\n\nThe main lesson here: WhatsApp bots don't need a separate platform. If your CRM already has a webhook endpoint and an API, you can build the conversation engine right inside it — and keep everything in one place for your team.\n\n_Originally published on northbeam-tech.com_",
  "title": "Automating Student Onboarding via WhatsApp in SugarCRM"
}