Skip to content

Message

The Message component lets you create a simple chat message that can be stored or sent within Nappai.
You specify who is sending the message, what the message says, and optionally link it to a particular chat session.

How it Works

When you drop the Message component into a workflow, you fill in the four fields:

  1. Sender Type – choose whether the message comes from the system (“Machine”) or a human user (“User”).
  2. Sender Name – give the name of the person or system that is sending the message (optional).
  3. Text – type the actual content of the message.
  4. Session ID – provide the ID that identifies the chat session this message belongs to.

The component then builds a Message object that contains all of this information plus the current workflow’s flow ID.
That object is returned as the component’s output and can be passed to other components, such as a chat history logger or a response generator.

Inputs

  • Sender Type: Choose who is sending the message.
    Visible in: All uses of the component.

  • Sender Name: The name of the sender (e.g., “Alice” or “Nappai Bot”).
    Visible in: All uses of the component.

  • Text: The actual message content you want to send or store.
    Visible in: All uses of the component.

  • Session ID: The identifier for the chat session that this message belongs to.
    Visible in: All uses of the component.

Outputs

The component outputs a Message object that contains:

  • text – the message content
  • sender – “Machine” or “User”
  • sender_name – the name you provided
  • flow_id – the ID of the current workflow
  • session_id – the session identifier you supplied

This object can be used by downstream components to log the message, trigger responses, or display it in a chat UI.

Usage Example

  1. Drag the Message component into your workflow.
  2. Set Sender Type to User.
  3. Enter Sender Name as “Alice”.
  4. Type “Hi, I need help with my report.” into Text.
  5. Provide the session ID that matches the current chat session (e.g., session_12345).
  6. Connect the output of this component to a Chat History component to store the message.

The workflow will now create a message object that can be logged or used to generate a reply.

  • Chat History – Store and retrieve messages for a session.
  • Session Manager – Create, update, and manage session IDs.
  • Response Generator – Produce automated replies based on incoming messages.

Tips and Best Practices

  • Keep the Session ID consistent across all components that belong to the same conversation.
  • Use Sender Type to differentiate between system‑generated messages and user inputs.
  • If you don’t need a sender name, leave Sender Name blank; the component will still work.
  • Store the output Message object in a database or log for later analysis or auditing.

Security Considerations

  • Treat Session ID as sensitive data; avoid exposing it in public logs or UI elements.
  • Ensure that only authorized users can create or modify messages that affect critical workflows.