Payloads and presentation
A payload is the data ExecKernel prepares for your application to present the session’s current position. It brings together the node’s description, the labels of its choices and, at a terminal, any output associated with the result.
The session state records progress through the graph. The payload describes that position for the application: what step it is, what choices it can show or what result it can present. Your application uses those data to build its own interface.
Describe the step and name its choices
Section titled “Describe the step and name its choices”Node metadata describes a position in the process. A title can identify the step, while a subtitle or description can explain what the user needs to decide. These descriptions belong to nodes in the graph.
An edge label names a choice. It gives the application a readable text to show for a connection whose ID it will submit when that choice is made. The question “How will you attend?” describes a node; “In person” and “Online” name two edges leaving it.
We will add presentation data to the workshop graph introduced in Graph-based execution model. Its root is node 100: edge 101 leads to venue selection, while edge 102 selects online attendance and ends at terminal 400. This fragment adds an English title and labels to that existing definition:
{ "metadata": [ { "node_id": 100, "lang": "en", "title": "How will you attend?" } ], "labels": [ { "edge_id": 101, "lang": "en", "text": "In person" }, { "edge_id": 102, "lang": "en", "text": "Online" } ]}The node_id associates the title with the step. Each edge_id associates its text with a choice. Changing the wording does not change those connections or the edge IDs used to navigate.
From graph descriptions to a screen
Section titled “From graph descriptions to a screen”When your application requests an English payload at node 100, the engine selects the relevant metadata and labels. These are some of the resulting fields:
{ "type": "node", "node_id": 100, "title": "How will you attend?", "edges": [ { "id": 101, "labels": [{ "text": "In person" }] }, { "id": 102, "labels": [{ "text": "Online" }] } ]}The extract focuses on text and IDs; the full payload also includes information about each edge’s availability. Both choices are available at this step in the example.
Your application can use title as a heading and each edge’s labels[0].text as the text of a button. It keeps the edge’s id as the value to submit when the button is selected. This is one possible interface built from those fields:
ExecKernel supplies the data. Your application chooses whether to render buttons, links, a select control or another suitable interface, and how to represent an unavailable choice. The picture illustrates an application view; it is not a screen generated by the engine.
Presenting a terminal result
Section titled “Presenting a terminal result”A terminal can also have node metadata. Its title can describe the outcome, while optional outputs provide content associated with that outcome, such as a message or a link.
For this page, we give the workshop’s online terminal a title and add a content output containing a message. We also add extras.attendance: "online" to its metadata. extras holds data defined by your application; here it identifies the selected attendance mode independently of the visible wording.
After choosing edge 102, these selected fields appear in the terminal payload:
{ "type": "terminal", "node_id": 400, "title": "Online attendance selected", "extras": { "attendance": "online" }, "outputs": [ { "type": "content", "content": "To attend, have a browser and an internet connection ready." } ]}The application can recognise the terminal through type, display its title and use the content output as a message. The terminal payload contains outputs instead of outgoing choices.
The title and the output have separate purposes: one describes the terminal node, and the other carries result content. A terminal may have a title and no outputs, or no presentation data at all. It still marks the end of navigation.
The same position in another language
Section titled “The same position in another language”To offer Spanish, add Spanish metadata and label records for the same node and edge IDs. For example, the title for node 100 becomes “¿Cómo quieres asistir?” and the label for edge 102 becomes “En línea”. The Spanish content output says “Para asistir, prepara un navegador y una conexión a internet.”
Requesting a Spanish payload selects those declared texts. ExecKernel does not translate them automatically. Changing the requested language does not move the session or change its path; choosing “Online” or “En línea” still submits edge 102.
Keep any application-defined values that need a stable meaning consistent across translations. In this example, extras.attendance remains "online" in both languages.
Explore the presentation in the Showcase
Section titled “Explore the presentation in the Showcase”In Labels and metadata, switch between EN and ES in the header without restarting the session. Watch the heading, description and choice texts change while the current node and recorded path remain the same.
This demo presents an introductory tour. Complete it and inspect the terminal: it has its own description even though it has no terminal outputs configured.
Labels, metadata and languages explains how to define these records, and Terminal outputs develops the available output types. For the complete returned fields, see Node and terminal payloads.