Handle inbound webchat message
Inbound webhook called by the embedded webchat widget when a visitor sends a message. Validates the configured webchatConfigId, upserts the visitor as a contact, persists the message + any attachments, and emits a socket event so connected agents can respond.
Body
Per-conversation widget session identifier generated client-side.
WebchatConfig _id that identifies which embedded widget sent the message.
Visitor message body.
Stable per-browser device identifier used to deduplicate visitors across sessions.
Optional visitor display name captured by the widget pre-chat form.
Optional visitor email captured by the widget pre-chat form.
Optional visitor phone number captured by the widget pre-chat form.
Free-form context the widget attaches (referrer, page URL, UTM params, etc.).
Response
Message accepted (processed asynchronously)
Ack returned to the embedded webchat widget after queuing an inbound message for async processing.