Bespoke CRM contracts
AI Integration with Custom CRM
Recover the meaning of custom CRM records before connecting AI: identity, merges, null values, lifecycle changes and safe update contracts.
A custom CRM may have exactly the data an AI assistant needs and still lack a reliable integration contract. The difficulty is often meaning: whether “active” describes a customer, a contract or a sales process; whether an empty field means unknown or intentionally cleared; and what happens when two customer records are merged. An AI layer should not discover these rules by trial and error in production.
This guide is for the owner of a bespoke CRM and the team adding AI to it. The goal is to recover and formalise the existing application's behaviour, then expose a narrow supported operation. It is not a proposal to replace the CRM or let a model write directly to its tables.
Recover the contract from three kinds of evidence
Start with the business owner, the application maintainers and representative records. The business owner explains what a valid transition means. The maintainers explain where that rule is enforced. Records and controlled test cases show whether the implementation behaves as expected. None of these sources alone is sufficient: documentation may be old, code may contain accidental behaviour and users may have developed workarounds.
Choose one operation, such as adding an approved account-review note to the current customer record. Walk through its normal path and exceptions. Ask what identifies the customer, which relationships matter, what permissions apply and whether adding the note triggers any automation. Confirm what “saved” means to the user and which system provides the authoritative acknowledgement.
Where the CRM exposes HTTP interfaces, an OpenAPI description can record paths, operations, schemas and security requirements. It provides a structured interface description, but the project must still document business meaning, lifecycle rules and recovery. A schema-valid payload is not evidence that the selected customer or transition is correct.
Write the semantic dictionary before the model prompt
| Concept | Question to settle | Evidence to retain |
|---|---|---|
| Customer identity | Which immutable key identifies the customer, and how are merges represented? | Approved examples of active, merged and retired records. |
| Lifecycle state | What does each state permit, and who may change it? | Transition rules with allowed and rejected examples. |
| Empty values | Does omitted, null or empty text mean preserve, unknown or clear? | Operation-specific update tests. |
| Relationships | Does the note belong to a customer, subsidiary, contact or contract? | Stable relationship keys and ownership rules. |
| Time | Which event time, time zone and effective date govern the decision? | Examples crossing a reporting or operational boundary. |
| Visibility | Which person and service may read or write this record? | Permission decisions for representative roles. |
| Completion | What response proves persistence and which downstream effects remain pending? | Destination identifiers and reconciliation examples. |
Give each definition a business owner and technical owner. If two departments use “active customer” differently, preserve that distinction in the integration rather than selecting one meaning silently. A model may explain the difference, but it should not resolve an ownership disagreement through probability.
Worked example: the customer was merged while the proposal waited
In an illustrative CRM, an account-review assistant prepares a note for customer A12. Before the reviewer approves it, the data team merges A12 into canonical customer C40. A12 remains as a retired reference for historical lookups. The integration still holds the earlier identifier and a valid-looking draft note.
Several bad outcomes are possible. A permissive endpoint might recreate A12. Another may attach the note to a hidden retired record, so the account team never sees it. A search-based retry may choose a third customer with a similar name. Each failure comes from an incomplete identity contract rather than poor prose generation.
The proposed contract treats a merged identifier as a specific lifecycle condition. At execution, the adapter resolves the reference through an authorised canonical mapping and evaluates whether the original review remains valid for C40. If the merge changed the relevant business context, the note requires reconsideration. The adapter must not automatically transfer every prior approval or permission to a new canonical record.
Preserve both the original reference and the resolved destination in the evidence chain. The reviewer should understand why the target changed. If the mapping cannot be established reliably, stop the write and route the case to the data owner. Do not use fuzzy name matching as an invisible recovery mechanism for a consequential update.
Expose a small operation instead of an unrestricted update surface
A generic endpoint that accepts arbitrary table names, filters and fields makes it difficult to prove the boundaries of the AI feature. Prefer a business operation with an explicit target, allowed fields, current-state conditions and documented response. The model can propose the note text; the server should supply or validate the trusted customer key and decide whether the operation is permitted.
The API-first integration guide develops the interface contract. Access-control design addresses the requester and service identities. Keep the decisive permission checks server-side, including checks that run after a merge or relationship change. Hiding a button in the CRM interface does not prevent another client from invoking an inadequately protected endpoint.
If the existing CRM has no suitable operation, adding a narrow supported endpoint may be necessary. Decide whether this is a small integration extension or a substantive application feature. Integration versus custom development helps make that scope visible, including ownership of the new code and its maintenance.
Make partial updates and deletion behaviour explicit
Test omitted fields, explicit null values and empty strings separately. An assistant that lacks a phone number should not erase the existing phone number because a serialiser emitted null. Conversely, an authorised request to clear a field should not be silently ignored. Define these semantics for the actual endpoint rather than assuming that every PATCH implementation behaves the same way.
Soft deletion, archiving and merging also need distinct outcomes. A record may remain physically present for historical or retention reasons while no longer being eligible for operational updates. The AI read path should not accidentally present archived records as current prospects. A deletion request may also require propagation to search indexes and derived stores, governed by the applicable retention and data-rights process.
Record who owns the lifecycle decision. The integration can enforce a known state transition; it should not invent the business policy for restoring archived accounts or undoing merges. Where human repair is necessary, provide a bounded operation with reviewable evidence rather than encouraging direct database edits.
Define compatibility in terms of meaning as well as shape
A response can retain the same fields while changing their meaning. For example, a CRM may redefine “last contact” from the last customer conversation to the last automated message. The AI summary could then imply a recent human discussion that never happened. Treat such semantic changes as integration changes even when JSON validation still passes.
Version the contract and keep a small set of accepted examples that represent important meanings. When a schema adds a new enum value, decide whether the adapter can safely ignore it, present it as unknown or must stop. Do not map every unrecognised state to the nearest familiar label. Unknown information should remain visible until an owner defines its treatment.
For event-based interfaces, document whether an event means that a change was requested, committed or later corrected. A merge event and a record-update event may arrive in an unexpected order. Event-driven integration covers sequencing and replay; the custom CRM contract supplies the identity and state rules needed to interpret those events.
Test the difficult records, not only clean demonstration data
Build a safe test set containing merged records, duplicate names, missing values, restricted subsidiaries, archived contacts and mixed Arabic and English names. Include a case where two records look similar but must remain separate. Test the selected operation with the actual limited service identity and with a user whose access is revoked before execution.
Evaluate identity resolution, permission correctness, field preservation and generated content independently. In the illustrative merge case, the acceptance result should show whether the operation stopped, was reconsidered or reached C40 under a valid decision. Counting only successful HTTP requests would hide the most important failure.
The integration testing strategy should include a compatibility check whenever the CRM team changes lifecycle behaviour or adds fields that affect the operation. Maintain a clear change-notification route; the team shipping a CRM release needs to know which external contracts depend on its semantics.
Make the handover maintainable by the CRM owner
Deliver the semantic dictionary, supported-operation specification, permission map, example cases, error catalogue and reconciliation procedure. Name the owner of customer identity and the owner of technical execution. Include enough audit evidence to distinguish an incorrect proposal from a correct proposal applied to the wrong record, because those require different fixes.
For AI integration and delivery with OpenForAI, prepare one masked normal record, one difficult lifecycle example and the existing interface or maintainer contact. Enquire about AI integration with a custom CRM around a specific operation. The resulting scope should make the CRM's existing rules understandable to the integration before the AI is allowed to act on them.
FAQ
Your questions, answered.
Can we integrate AI with a custom CRM that has no API documentation?
Yes, but contract discovery becomes part of the delivery scope. Work with the application and business owners to identify supported operations, record identity, permissions, lifecycle rules and recovery behaviour. Use controlled examples to verify the implementation. Do not treat an undocumented endpoint or direct table access as production-ready merely because a prototype can read data.
What should an AI integration do when customer records are merged?
Recognise the merge as a lifecycle event and resolve the canonical reference through a controlled mapping. Recheck access and whether the earlier proposal remains valid for the resolved record. Preserve both identifiers in the evidence chain. If the mapping or decision context is uncertain, stop and ask the responsible owner rather than relying on a name search.
How should null values work in an AI CRM update?
The endpoint contract must distinguish omission, an explicit null and an empty string. They may mean preserve, unknown or clear, depending on the implemented operation. Test these cases before release. The AI should not erase existing information merely because it lacks a value, and an authorised clearing action should require an explicit supported instruction.
Is an OpenAPI document enough to make a custom CRM ready for AI?
It is useful for describing the interface, but it does not settle the business meaning of fields, lifecycle transitions, identity merges or operational recovery. Pair it with a semantic dictionary and representative accepted examples. The model and adapter need both the technical shape and the conditions under which an operation is correct and authorised.
Can an unchanged JSON schema still break an AI CRM integration?
Yes. A field can keep the same type while its meaning changes, such as redefining last contact to include automated messages. The integration may then produce a misleading interpretation without any schema error. Treat semantic changes as contract changes and review them against examples that reflect the business decisions the AI supports.
Should a CRM AI assistant search by customer name again before every write?
A name search can help discovery, but it should not silently replace a resolved target at execution. Names can be duplicated, translated or changed. Preserve a controlled record identity and revalidate its lifecycle and permissions. If the identity has changed through a merge or another event, follow the explicit resolution and review process.