Skip to navigation

On Flow Ended

View as Markdown

Triggered when the session finishes — with the complete results, or with the reason there are none.

This is the event that means finished. Its payload carries is_closed: true at the top — however the session ended, with an aes_key or without one —, and that field — not the arrival of any webhook, not the widget closing, not a WAITING status — is what tells you a session is over and its results are final. If you also subscribe to On Partial Results, you will have seen the same session earlier with is_closed: false: branch on that field and you cannot get it wrong.

What data carries, and what actually travels

The schema below describes data decrypted — on purpose, so this reference has a model you can read and code against. What arrives at your endpoint depends on how the session was created:

  • With an aes_key: data is a single string, aes::Base64(IV + Ciphertext + Tag). Decrypt it and you get exactly the object documented below. The walkthrough and the code are in Payload Encryption.
  • Without an aes_key: data is not in the body at all — absent, not null. Somebody’s records are never put on the wire unencrypted, so the event tells you what happened and you read the content from Get Session Results when it arrives.
A session can end without results

Cancelled by your customer, cancelled by you, timed out, failed: status_code says which, and data then carries the reason rather than the records — user_feedback with what your customer answered in the cancellation dialog, system_feedback when the platform is what stopped it. No results are coming afterwards; it is a finished session like any other.

messages: what the session found, beside what it read. The payload carries a messages list — situations the session detected while it ran; most sessions carry none. The one to route is flag: it never means something failed on our side, it means the session found something about the person or the data that deserves a decision on yours. location is a loc list (["data", "customer", "profile"]) pointing at the part of this document the message is about, and message_id is the stable name of the situation — automate on that, never on the wording.

Expand messages in the response explorer to see the object, and Get Session Results for what each type means and what to do with them.

Answer 2xx as soon as the payload reaches you, whatever your processing does with it afterwards: any other status is recorded as a failed delivery even though the event arrived. Answering a delivery has the handler to copy.

Payload

The payload of this webhook request is an object.
event_class"EsPublicAdministrationV1FlowEvent"Required

Payload class discriminator — always this value for Spain Public Administration events.

app_idstringRequiredformat: "object-id"
customer_idstringRequired1-64 characters
session_idstringRequiredformat: "object-id"
producer"es-public-administration"Required
The flow that produced the event.
event"es-public-administration:ended"Required

The event type: ended.

status_codeenumRequired
Describes the status of a flow.
is_closedtrueRequired

Always true: the session is over and its results are final — however it ended, and whether data travels or not. This field, not the widget closing, is what says a session is finished.

datestringOptionalformat: "datetime"
status_messagestring or nullOptional
dataobjectOptional

Verification results payload.

  • Documented decrypted, delivered encrypted. With an aes_key on the session this field is the aes::Base64(IV + Ciphertext + Tag) string of the object described here, which decrypts into FlowResultsSchema; without one it is not in the body at all and the results are read from the session results endpoint instead.
  • On a session that ended without results — cancelled, timed out, failed — it carries the reason instead, as WebhookEndedErrorPayload.

Response

200
Successful Response
422
Validation Error