Your system to Docistra
When a patient is created or changed in your system, send it:POST /patients never makes a second copy of a person. It finds the patient in this order:
- already linked to this
external_id - the same phone and the same name. Arabic and English spellings of the same name match (“منى سامي” and “Mona Samy”)
- the same phone with a different name: a family member who uses that phone. They’re created under the phone’s holder (
holder_id), so messages still reach that phone
external_id; you get 200 with "created": false. A new patient is 201 with "created": true.
For later changes, use PATCH /patients/ext:P-10293 with only the fields that changed. null clears a field.
Phones
Egyptian mobiles are accepted in any spelling (01012345678, +201012345678, 201012345678) and returned as +201012345678. International numbers must start with + or 00.
Family members
To add a child under a parent explicitly, sendholder_id (the parent, as an id or ext:) and relationship (son, daughter, wife, husband, father, mother, brother, sister, grandson, granddaughter, grandfather, grandmother, other).
Docistra to your system
Patients also appear in Docistra without you: the AI agent registers new patients from WhatsApp, and patients book on the clinic’s page. Listen topatient.created and patient.updated:
- If
data.object.external_idis set, it’s a patient you already have: update it. - If not, create it in your system, then link it back:
PATCH /patients/{id}with{"external_id": "<your new id>"}.
PATCH doesn’t come back to you as a webhook.