Replicant California Property Integration

Date: 2026-07-05

Status: Proposed integration accepted for implementation; local secret configured, code not wired yet.

Scope: California property-management line, +15102160079, vanity URL https://riff.chattychapters.com/property.

Response To Aman

Suggested reply:

Thanks. We will treat Twilio as a placeholder in the API notes and use our Telnyx voice gateway on the Riff side.

Our review approves the two-endpoint shape for the California property-management line. Riff will call POST /riff/identify at call start while the greeting plays, use a 2-second timeout, and continue as an unknown caller if Replicant is unavailable. At the end of intake, Riff will call POST /riff/maintenance-tickets with the same stable call id for idempotency and durable retries.

We have the HMAC secret installed locally as Replicant_RIFF_WEBHOOK_SECRET; we will keep it out of git and use it only for signed Replicant requests. The main API clarification we recommend before implementation is permission_to_enter: a boolean is too lossy for no, conditional, and unknown, so either make it an enum or preserve conditional access in entry_notes. SMS consent design looks correct: Riff should not promise text updates unless sms_consent is already true or the caller agrees to receive the opt-in text.

Local Configuration

Replicant_RIFF_WEBHOOK_SECRET has been added to the local .env file for the Replicant HMAC signing flow.

Do not commit the value. .env is ignored by git. Production deployment needs the same variable set on whichever node runs the California property flow.

The mixed-case spelling is intentional. Implementation code should read the exact Replicant_RIFF_WEBHOOK_SECRET key.

VariableUse
Replicant_RIFF_WEBHOOK_SECRETNew shared HMAC secret for Replicant identify and maintenance-tickets requests.
RIFF_DIALED_ROUTING_TABLE_JSONLive override for mapping the California number to the intended flow.
RIFF_REPLICANTPM_VOICE_RESULTS_URLOlder post-call Replicant voice-results export. This is not the new two-endpoint ticket API.
RIFF_REPLICANTPM_TOKENOlder bearer-style post-call export token. Do not confuse with HMAC signing.

Recommended Runtime Behavior

At call start:

  1. Normalize caller_phone and called_number to E.164.
  2. Fire POST /riff/identify while the greeting audio plays.
  3. Sign the exact JSON request body with Replicant_RIFF_WEBHOOK_SECRET.
  4. Budget 2 seconds.
  5. Store organization, tenant, units, and SMS consent in session slots if matched.
Identify resultFlow behavior
Tenant with one active unitConfirm the unit briefly, then collect issue details. Do not ask for name, phone, address, or unit from scratch.
Tenant with multiple unitsAsk which property/unit has the issue, then store the selected unit_id.
No match, timeout, 5xx, or 404Continue as an unknown caller and collect name, address, unit, and issue details verbally. Alert on 404 because that means the called number is not registered in Replicant.

At intake completion:

  1. Build a maintenance-tickets payload from slots.
  2. Use a stable carrier-neutral call id for the API field currently named call_sid.
  3. Submit immediately if possible.
  4. On timeout or 5xx, persist a durable retry job with the same call id for up to 24 hours.
  5. On 4xx, do not retry; log and alert because that is a contract or payload bug.

Slot Mapping

Riff slot/sourceReplicant field
stable Telnyx/Riff call idcall_sid
identify responseorganization_id, tenant_user_id, unit_id
inbound callercaller_phone
unknown caller fallbackcaller_name, stated_address
issue summarytitle, description
issue categorycategory
urgency/severity slotsseverity_hint
access permissionpermission_to_enter, entry_notes
post-call artifacttranscript_url when safe to expose
SMS consent questionrequest_sms_optin

SMS Consent Rule

Replicant owns consent server-side.

If identify returns sms_consent: true, Riff may say the caller will receive text updates.

If sms_consent: false, Riff should ask whether the caller wants a text to opt in. Only set request_sms_optin: true when the caller agrees. Riff should not promise ongoing text updates before the opt-in is completed.

Current Repo Gaps

  1. riff/postcall/replicantpm_adapter.py is the older post-call export to /api/v1/ai/voice/results/. It does not implement the new HMAC identify plus maintenance-tickets contract.
  2. flows/property_trouble_ticket.yaml currently performs its own caller verification and collects property/address/unit information. The Replicant version should skip those fields when identify returns a tenant and unit.
  3. flows/_routing.yaml currently maps +15102160079 to plumbing_intake as a temporary domain-tree demo. Before a live Replicant test, route the California number to the property/Replicant flow through RIFF_DIALED_ROUTING_TABLE_JSON or by updating the routing table.
  4. A durable retry queue is required for ticket POST failures. A best-effort post-call hook is not enough.
  5. The API field name call_sid is Twilio-shaped. Since Riff uses Telnyx, implementation should treat it as a stable carrier-neutral call id unless Replicant renames it to call_id.

Implementation Checklist