Skip to main content
Sends a message to the agent. Supports both visible messages and silent messages that are hidden from the chat UI.

Syntax

await instance.send(message);
await instance.send(message, options);

Parameters

message
string | object
required
The message to send. The value can be a simple string or a MessageRequest object.
options
object
Optional settings. Use { silent: true } to hide the message from the UI.

Returns

Promise<void>
Resolves when the message is sent.

Examples

The following example sends a simple text message:
// Send a visible message
await instance.send('Hello, how can you help me?');

// Send a silent message (hidden from UI)
await instance.send('User clicked help button', { silent: true });

Considerations

silent option

Silent messages are sent to the agent but remain hidden from the chat UI. Use the silent option when you need to trigger agent responses without cluttering the conversation. When you send a silent message, the following sequence occurs:
  1. Message is sent to the agent for processing.
  2. Message is hidden from the chat UI.
  3. Agent can respond (response is visible to user).
  4. User only sees the agent’s response, not the trigger.
The following example triggers a welcome message:
await instance.send('', { silent: true });
The following example sends a feedback notification:
async function handleFeedback(rating, comment) {
    const message = `User feedback: ${rating} stars - ${comment}`;
    await instance.send(message, { silent: true });
}
The following example tracks a user action:
await instance.send('User viewed pricing page', { silent: true });
Advanced implementation with MessageRequest with additional_properties For more control, use a MessageRequest object to specify message properties including visibility, thread targeting, and custom context.

MessageRequest structure

{
  message: {
    role: 'user',
    content: 'Your message text',
    additional_properties: {
      display_properties: {
        skip_render: boolean  // true = hidden, false = visible
      }
    }
  },
  context: {                  // Optional: custom context data
    key: 'value'
  }
}
The following example sends a silent message with MessageRequest:
await instance.send({
    message: {
        role: 'user',
        content: 'User clicked help button',
        additional_properties: {
            display_properties: {
                skip_render: true  // Hide from UI
            }
        }
    }
});
The following example sends a message with Thread and Context:
await instance.send({
    message: {
        role: 'user',
        content: 'I need help with my order'
    },
    context: {
        user_location: 'checkout_page',
        cart_value: 150.00
    }
});

Override behavior

When you use both a MessageRequest object and the { silent: true } option, the { silent: true } option takes precedence:
// The { silent: true } option overrides skip_render in the message
await instance.send({
    message: {
        role: 'user',
        content: 'Message',
        additional_properties: {
            display_properties: { skip_render: false }  // Will be overridden!
        }
    }
}, { silent: true });  // Final result: message is hidden
Priority rules for override behavior:
  1. { silent: true } option It always hides the message.
  2. skip_render: true in message
    It hides the message.
  3. skip_render: false in message It shows the message.
  4. No option or property It shows the message. This is the default.
When to use each approach:
  • Use { silent: true } for simple cases and quick overrides.
  • Use additional_properties.display_properties.skip_render when building MessageRequest objects.
  • Combine both when you need to override message object settings at runtime.

Do you need practical examples?

Learn how to apply the features available for embedded chat into your implementation with guidance and examples.