In this guide, we will demonstrate how to add a custom message with a custom-built message bubble to the Message List component.
We recommend that you read the Key Concepts , follow the guidelines, and also take the time to familiarise yourself with the library’s components.
In the example below, we are going to simulate a “nudge” behaviour which sends out a custom message when the user clicks on the auxiliary button placed in the Message Composer component.
@ViewChild('auxButtonRef') auxButtonRef!:TemplateRef<any>;messagesConfiguration:MessagesConfiguration = new MessagesConfiguration({});ngAfterViewInit(){ this.messagesConfiguration.messageComposerConfiguration.auxilaryButtonView = this.auxButtonRef;}
We’ll create a new message template for the custom message and add to the list of pre-defined list of message templates. The pre-defined message templates are fetched using the CometChatUIKit class.