SCALIX help

← All tools

salesforce_create_contact

Salesforce write high risk

Part of the Salesforce Agent.

What it does

Creates a new Contact record (a person associated with an Account). Two-phase write (Scalix guardrail, ADR-028/029): the first call (no preview_id) echoes the exact payload as the preview and returns a preview_id WITHOUT calling Salesforce - no dedupe, diff or picklist validation happens at preview; re-call with that preview_id and identical arguments to COMMIT: the request executes, Salesforce's response is returned, and an immutable audit row is written (single-use token, 30 min; a changed, forged or replayed token fails closed). Key inputs: fields{} (LastName required; FirstName, Email, AccountId, Title, Phone, LeadSource, plus custom __c), consent_confirmed, preview_id. Use when attaching a known person to an existing Account (e.g. for opportunity attribution) rather than filing a raw inbound Lead. Returns {success:true,data:{applied,result}} where result is Salesforce's response (e.g. {id,success,errors} on create; empty on a 204 PATCH).

When to use it

Use to attach a known, consented person (the client's own contact) to an existing Account — e.g. a stakeholder on an Opportunity you will attribute LinkedIn spend to. Preview to dedupe by Email and confirm LastName; require explicit approval. For raw inbound demand, prefer salesforce_create_lead / salesforce_upsert_lead_from_linkedin. Never create Contacts from non-client or unconsented data.

Inputs

NameTypeRequiredDescription
fieldsobjectyesContact field map. REQUIRED: LastName. Common: FirstName, Email, AccountId (the parent Account), Title, Phone, LeadSource ('LinkedIn'), plus the LinkedIn external-id custom field where applicable. Reject unknown fields.
consent_confirmedbooleanyesMust be true to proceed (checked at preview and at commit): caller attests the client has a lawful basis/consent to store this person's PII. False blocks the write.
preview_idstringnoOmit it to preview: nothing is applied, and the call returns a preview_id bound to this exact request. Pass it only after the user approves that preview in a later message, with the same arguments (leave out validate_only, and add any confirmation flag the preview names). Single-use, expires in 30 minutes; changed arguments need a fresh preview.

Safeguards

A change in two steps. The first call previews and changes nothing; Claude shows you the preview and applies it only after you approve, within 30 minutes and with the same arguments. Every applied change goes to the audit log. How changes are approved.

Policy

Two-phase: preview (dedupe + required-field check) then commit only on explicit approval; never auto-create. LinkedIn member/lead data may be used ONLY for the authorizing client and ONLY for consented purposes — set consent_confirmed=true before committing a LinkedIn-derived Contact; NEVER use member data for prospecting/enrichment, append/verify profiles, build a cross-account or unaffiliated database, or commingle across clients; forward only the client's OWN contacts. Hash PII where the destination supports it. Strict per-account isolation. Honor deletion on request and member-data retention (profile <=24h, social activity <=48h).

Reminder

Preview + dedupe first, confirm consent for LinkedIn-derived PII, then write one Contact to this client's org only — never for enrichment or prospecting.

Errors

Error classMeansWhat to doRetry
TOKEN_REVOKEDSession expired/invalid (HTTP 401 INVALID_SESSION_ID).needs_reauth — refresh once; only retry the POST if no Id was returned. Else prompt reconnect.yes
VALIDATION_ERRORMissing/invalid field (HTTP 400 REQUIRED_FIELD_MISSING e.g. LastName, INVALID_EMAIL_ADDRESS, FIELD_CUSTOM_VALIDATION_EXCEPTION).Surface errors[].message + fields[]; fix and re-preview.no
CONFLICTDuplicate rules blocked insert (DUPLICATES_DETECTED) or preview dedupe matched an existing Contact by Email.Surface the matched Id(s); recommend update instead of create. Do not force a duplicate.no
NOT_FOUNDReferenced AccountId does not exist / out of scope (HTTP 400 INVALID_CROSS_REFERENCE_KEY).Verify AccountId belongs to this org; fix and re-preview.no
PERMISSION_DENIEDUser lacks Create on Contact or a field (HTTP 403 INSUFFICIENT_ACCESS).Request access; not retryable as-is.no
CONSENT_REQUIREDContact is LinkedIn-derived but consent_confirmed was not true (blocked client-side).Confirm lawful basis/consent for this client's own contact, set consent_confirmed=true, re-preview.no
RATE_LIMITEDAPI limit exceeded (HTTP 403 REQUEST_LIMIT_EXCEEDED or 503 Retry-After).Backoff, honor Retry-After, report quota; do not blind-retry a POST.yes
PREVIEW_EXPIREDpreview_id unknown/expired or fields changed since preview.Re-run preview before committing.no
PLATFORM_UNAVAILABLESalesforce 5xx (HTTP 500/502/503).Retry with backoff after re-querying by Email to confirm the Contact was not already created.yes

Edge cases

  • Preview (no preview_id) echoes the request and returns a preview_id; nothing is sent to Salesforce.
  • Missing AccountId creates a 'private' Contact (no parent Account) — allowed but flag it.
  • Org duplicate/matching rules can block at commit even when preview found no Email match.
  • Person-Account orgs treat some Contacts specially — note the parent AccountId behavior.
  • Idempotency: plain create is not idempotent; on ambiguous 5xx re-query before retry.
  • Retention/consent: LinkedIn source data must be the client's own consented data, not retained beyond 24h/48h.