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.
| Name | Type | Description |
|---|---|---|
recordId | String | The ID of the record for the Messaging session. |
| messageType | String | The message component type to place in the service rep’s text box. For example, StaticContentMessage. See Message Types and Message Format Types. |
| nameOrId | String | The name or ID of the messaging component to place in the service rep’s text box. |
| text | String | Optional. The message to the end user. For example: This is a sample message. |
| setAtCursor | Boolean | Optional. 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.