Skip to main content

POST /updateUserPersona

  • Auth: header x-api-key: <API_KEY> (if enforced upstream; function itself only validates method/body)
  • Method: POST
  • Body:
    • parentDocId (string, required) — business ID
    • subDocId (string, required) — participant/user ID
    • updates (object, required)
      • For array fields (e.g., themes, values, personality, writingTechniques), values are appended using Firestore arrayUnion
      • For scalar/object fields (e.g., role), values replace existing
  • Behavior: updates businesses/{parentDocId}/participants/{subDocId} with a mixed replace/append strategy
  • Responses:
    • 200: { ok: true }
    • 400: missing/invalid inputs
    • 405: wrong method
    • 500: internal error

Example request body:

{
"parentDocId": "biz123",
"subDocId": "user456",
"updates": {
"role": "coach",
"themes": [{ "type": "A", "description": "new desc" }]
}
}

Source: apps/functions/updateUserPersona.js.