On Flow Ended
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:datais 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:datais not in the body at all — absent, notnull. 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.
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
Payload class discriminator — always this value for Spain Public Administration events.
The event type: ended.
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.
Verification results payload.
- Documented decrypted, delivered encrypted. With an
aes_keyon the session this field is theaes::Base64(IV + Ciphertext + Tag)string of the object described here, which decrypts intoFlowResultsSchema; 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.