Preview:
sendMessage() {
  const sentMessage = this.chatForm.value.message!;
  this.loading = true;
  this.messages.push({
    type: 'user',
    message: sentMessage,
  });
  this.chatForm.reset();
  this.scrollToBottom();
  this.messageService.sendMessage(sentMessage).subscribe((response: any) => {
    for (const obj of response) {
      let value;
      console.log(obj);
      if (obj.hasOwnProperty('text')) {
        value = obj['text'];
        this.pushMessage(value);
      }
      if (obj.hasOwnProperty('image')) {
        value = obj['image'];
        this.pushMessage(value);
      }
      // Handle buttons
      if (obj.hasOwnProperty('buttons')) {
        value = obj['buttons'];
        // Add logic to handle buttons here
      }
      // Handle custom payloads
      if (obj.hasOwnProperty('custom')) {
        value = obj['custom'];
        // Add logic to handle custom payloads here
      }
    }
    // MANIPULATION OF DATA TYPES OF RASA SUCH AS IMAGE, TEXT, BUTTONS, ETC
  }, (error) => { console.log(error); });
}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter