setMessagingComponent() for LWC for Lightning Experience

Inserts a specified messaging component into the service rep’s text box. You can also use this method to insert text into the service rep’s text box. This method works only in Lightning console apps.

NameTypeDescription
recordIdStringThe ID of the record for the Messaging session.
messageTypeStringThe message component type to place in the service rep’s text box. For example, StaticContentMessage. See Message Types and Message Format Types.
nameOrIdStringThe name or ID of the messaging component to place in the service rep’s text box.
textStringOptional. The message to the end user. For example: This is a sample message.
setAtCursorBooleanOptional. Indicates whether to insert the message at the current cursor location. If false, the message overwrites any existing text. Default value is false.

Returns a Promise. Success resolves to true. The Promise is rejected if there’s an error.

This example inserts a static content message into the service rep’s text box.