Files
Properties used for sending files.
When any of these properties are used, dragAndDrop is enabled automatically.
images
- Type: 
true|FilesServiceConfig 
Creates a button that allows the user to upload images. 
This property can be set with a boolean true or configured with a FilesServiceConfig object.
- Sample code
 - Full code
 
<deep-chat images="true"></deep-chat>
<!-- This example is for Vanilla JS and should be tailored to your framework (see Examples) -->
<deep-chat
  images="true"
  demo="true"
  style="border-radius: 8px"
  introMessage='{"text": "Use the image button or drop a file to attach it to the next outgoing message."}'
  history='[{"files": [{"src": "path-to-file.jpeg", "type": "image"}], "role": "user"}]'
></deep-chat>
gifs
- Type: 
true|FilesServiceConfig 
Creates a button that allows the user to upload GIFs. 
This property can be set with a boolean true or configured with a FilesServiceConfig object.
- Sample code
 - Full code
 
<deep-chat gifs="true"></deep-chat>
<!-- This example is for Vanilla JS and should be tailored to your framework (see Examples) -->
<deep-chat
  gifs="true"
  demo="true"
  style="border-radius: 8px"
  introMessage='{"text": "Use the GIF button or drop a file to attach it to the next outgoing message."}'
  history='[{"files": [{"src": "path-to-file.gif", "type": "image"}], "role": "user"}]'
></deep-chat>
camera
- Type: 
true|CameraFilesServiceConfig 
Creates a button that allows the user to capture images using a web camera. 
This property can be set with a boolean true or configured with a CameraFilesServiceConfig object.
- Sample code
 - Full code
 
<deep-chat camera="true"></deep-chat>
<!-- This example is for Vanilla JS and should be tailored to your framework (see Examples) -->
<deep-chat
  camera="true"
  demo="true"
  style="border-radius: 8px"
  introMessage='{"text": "Use the camera button to open up a modal for capturing photos."}'
  history='[{"files": [{"src": "path-to-file.jpeg", "type": "image"}], "role": "user"}]'
></deep-chat>
audio
- Type: 
true|FilesServiceConfig 
Creates a button that allows the user to upload audio files. 
This property can be set with a boolean true or configured with a FilesServiceConfig object.
- Sample code
 - Full code
 
<deep-chat audio="true"></deep-chat>
<!-- This example is for Vanilla JS and should be tailored to your framework (see Examples) -->
<deep-chat
  audio="true"
  demo="true"
  style="border-radius: 8px"
  introMessage='{"text": "Use the audio button or drop a file to attach it to the next outgoing message."}'
  history='[{"files": [{"src": "path-to-file.wav", "type": "audio"}], "role": "user"}]'
></deep-chat>
microphone
- Type: 
true|MicrophoneFilesServiceConfig 
Creates a button that allows the user to record audio files using the microphone. 
This property can be set with a boolean true or configured with a MicrophoneFilesServiceConfig object.
- Sample code
 - Full code
 
<deep-chat microphone="true"></deep-chat>
<!-- This example is for Vanilla JS and should be tailored to your framework (see Examples) -->
<deep-chat
  microphone="true"
  demo="true"
  style="border-radius: 8px"
  introMessage='{"text": "Use the microphone button or drop a file to attach it to the next outgoing message."}'
  history='[{"files": [{"src": "path-to-file.wav", "type": "audio"}], "role": "user"}]'
></deep-chat>
mixedFiles
- Type: 
true|FilesServiceConfig 
Creates a button that allows the user to upload any kind of files. 
This property can be set with a boolean true or configured with a FilesServiceConfig object.
- Sample code
 - Full code
 
<deep-chat mixedFiles="true"></deep-chat>
<!-- This example is for Vanilla JS and should be tailored to your framework (see Examples) -->
<deep-chat
  mixedFiles="true"
  demo="true"
  style="border-radius: 8px"
  introMessage='{"text": "Use the file button or drop a file to attach it to the next outgoing message."}'
  history='[{"files": [{"src": "path-to-file.txt", "name": "text-file.txt", "type": "file"}], "role": "user"}]'
></deep-chat>
dragAndDrop
- Type: 
boolean|CustomStyle - Default: false
 
Configuration for the drag and drop functionality. If any of the above properties are defined or you have defined a service in the directConnection property which allows file uploads -
this will automatically be defaulted to true. Once the user drops a file, it will only be accepted if any of the above properties allow it via their default or custom acceptedFormats property's value. For example if
".png,.jpg" in images are the only file types allowed, a dropped .txt file will not be accepted.
Example
- Sample code
 - Full code
 
<deep-chat dragAndDrop='{"backgroundColor": "#80ff704d", "border": "5px dashed #52c360"}'></deep-chat>
<!-- This example is for Vanilla JS and should be tailored to your framework (see Examples) -->
<deep-chat
  dragAndDrop='{"backgroundColor": "#80ff704d", "border": "5px dashed #52c360"}'
  mixedFiles="true"
  demo="true"
  style="border-radius: 8px"
  introMessage='{"text": "Drag and drop a file to observe the result."}'
></deep-chat>
Types
Types shared by files properties:
FilesServiceConfig
Object used to configure the ability for the component to send files. 
connect object is used to override the default service connection settings when sending a file. 
files controls what files can be uploaded to the component. 
button is used to customize the the button element that enables the files to be uploaded. 
- Sample code
 - Full code
 
<deep-chat
  audio='{
    "connect": {"url": "https://customapi.com/audio"},
    "files": {"acceptedFormats": ".mp3,.wav"},
    "button": {"position": "outside-left"}
  }'
></deep-chat>
<!-- This example is for Vanilla JS and should be tailored to your framework (see Examples) -->
<deep-chat
  audio='{
    "connect": {"url": "https://customapi.com/audio"},
    "files": {"acceptedFormats": ".mp3,.wav"},
    "button": {"position": "outside-left"}
  }'
  demo="true"
  style="border-radius: 8px"
  introMessage='{"text": "Use the audio button or drop a file to attach it to the next outgoing message."}'
></deep-chat>
FileAttachments
- 
Type: {
maxNumberOfFiles?: number,
acceptedFormats?: string,
infoModal?: InfoModal
} - 
Default: {
acceptedFormats:
for images: ".png,.jpg",
for audio: ".4a,.mp3,.webm,.mp4,.mpga,.wav,.mpeg,.m4a",
for gifs: ".gif"
} 
Used to configure what files the component can accept. 
maxNumberOfFiles controls the maximum number of files that can be sent within one message. 
acceptedFormats is used to define the accepted file formats. This is a string that uses the same syntax
as the accept attributes
in input elements. The dragAndDrop feature will also
use this value to verify the dropped files. 
infoModal is used to display noteworthy information when the user clicks the button to browse for a file. 
- Sample code
 - Full code
 
<deep-chat images='{"files": {"maxNumberOfFiles": 2, "acceptedFormats": ".jpg,.png"}}'></deep-chat>
<!-- This example is for Vanilla JS and should be tailored to your framework (see Examples) -->
<deep-chat
  images='{"files": {"maxNumberOfFiles": 2, "acceptedFormats": ".jpg,.png"}}'
  demo="true"
  style="border-radius: 8px"
  introMessage='{"text": "Use the image button or drop a file to attach it to the next outgoing message."}'
></deep-chat>
InfoModal
- Type: {
textMarkDown: string,openModalOnce?: boolean,containerStyle?: CustomStyle} - Default: {openModalOnce: false}
 
A modal that is triggered when a user clicks on a button to upload a file. It is useful for scenarios when a user needs some
clarification of how their data will be handled or other noteworty information. 
textMarkDown is a string that uses Markdown syntax to generate the modal content.
Use this Playground to help customize your content. 
openModalOnce controls whether the modal is opened when the user clicks a button once or every time. 
containerStyle is used to augment the basic styling of the modal element.
- Sample code
 - Full code
 
<deep-chat
  images='{
    "files": {
      "infoModal": {
        "textMarkDown":
          "Please note our terms of service for sending files: [link](https://www.youtube.com/watch?v=dQw4w9WgXcQ&ab_channel=RickAstley).",
        "openModalOnce": true,
        "containerStyle": {"borderRadius": "5px"}
      }
    }
  }'
></deep-chat>
<!-- This example is for Vanilla JS and should be tailored to your framework (see Examples) -->
<deep-chat
  images='{
    "files": {
      "infoModal": {
        "textMarkDown":
          "Please note our terms of service for sending files: [link](https://www.youtube.com/watch?v=dQw4w9WgXcQ&ab_channel=RickAstley).",
        "openModalOnce": true,
        "containerStyle": {"borderRadius": "5px"}
      }
    }
  }'
  demo="true"
  style="border-radius: 8px"
  introMessage='{"text": "Click the image button to open up the modal."}'
></deep-chat>
CameraFilesServiceConfig
- Type: {
connect?: Connect,
files?: CameraFiles,
button?: Button,
modalContainerStyle?: CustomStyle
} 
Configuration for capturing images using a web camera and handling the resultant files. 
connect is used to override the default connection settings when sending image files. 
files is used to configure the files that are captured by the camera. 
button is used to customize the button element used for the camera. 
modalContainerStyle is used to customize the modal used to display the camera. 
- Sample code
 - Full code
 
<deep-chat
  camera='{
    "connect": {"url": "https://customapi.com/image-from-camera"},
    "files": {"format": "png"},
    "button": {"position": "outside-left"},
    "modalContainerStyle": {"borderRadius": "5px"}
  }'
></deep-chat>
<!-- This example is for Vanilla JS and should be tailored to your framework (see Examples) -->
<deep-chat
  camera='{
    "connect": {"url": "https://customapi.com/image-from-camera"},
    "files": {"format": "png"},
    "button": {"position": "outside-left"},
    "modalContainerStyle": {"borderRadius": "5px"}
  }'
  demo="true"
  style="border-radius: 8px"
  introMessage='{"text": "Use the camera button to open up a modal for capturing photos."}'
></deep-chat>
CameraFiles
- 
Type: {
format?:"png"|"jpeg",
dimensions?:{width?: number,height?: number}
maxNumberOfFiles?: number,
acceptedFormats?: string
} - 
Default: {
format: "png",
acceptedFormats: "image/*"
} 
Configuration for the captured files by the camera. 
format is the resultant format of the image file that is produced by capturing a photograph. 
dimensions are used to set the pixel area of the photograph. Please note that this is largely controlled by the mediaDevice
of the user's browser, so if the dimensions you have provided skew the photograph in a particular way they may be overriden.
maxNumberOfFiles is the limit to the number of images that can be captured for one message. 
acceptedFormats is used to limit the allowed files that can be dropped via the dragAndDrop functionality as this feature will enable it automatically.
It uses the same syntax as the accept attributes
in input elements. If the configuration in images also uses
the acceptedFormats property, it will override this one.
- Sample code
 - Full code
 
<deep-chat
  camera='{
    "files": {
      "format": "png",
      "dimensions": {"width": 450, "height": 600},
      "maxNumberOfFiles": 2,
      "acceptedFormats": ".jpg,.png"
    }
  }'
></deep-chat>
<!-- This example is for Vanilla JS and should be tailored to your framework (see Examples) -->
<deep-chat
  camera='{
    "files": {
      "format": "png",
      "dimensions": {"width": 450, "height": 600},
      "maxNumberOfFiles": 2,
      "acceptedFormats": ".jpg,.png"
    }
  }'
  demo="true"
  style="border-radius: 8px"
  introMessage='{"text": "Use the camera button to open up a modal for capturing photos."}'
></deep-chat>
MicrophoneFilesServiceConfig
Configuration for recording audio using a microphone and handling the resultant files. 
connect is used to override the default connection settings when sending audio files. 
files is used to configure the resultant files that are recorded by the microphone. 
button is the styling used for the microphone button element. 
- Sample code
 - Full code
 
<deep-chat
  microphone='{
    "connect": {"url": "https://customapi.com/audio-from-microphone"},
    "files": {"format": "mp3"},
    "button": {"position": "outside-left"}
  }'
></deep-chat>
<!-- This example is for Vanilla JS and should be tailored to your framework (see Examples) -->
<deep-chat
  microphone='{
    "connect": {"url": "https://customapi.com/audio-from-microphone"},
    "files": {"format": "mp3"},
    "button": {"position": "outside-left"}
  }'
  demo="true"
  style="border-radius: 8px"
  introMessage='{"text": "Use the microphone button to record audio."}'
></deep-chat>
AudioRecordingFiles
- 
Type: {
format?: AudioFormat,
maxDurationSeconds?: number,
maxNumberOfFiles?: number,
acceptedFormats?: string
} - 
Default: {
format: "mp3",
maxDurationSeconds: 5999,
acceptedFormats: "audio/*"
} 
Configuration for the recorded microphone files. 
format is the resultant audio file format. 
maxDurationSeconds is the maximum length of time one audio file can be recorded.
maxNumberOfFiles is the limit to the number of files that can be recorded for one message. 
acceptedFormats is used to limit the allowed files that can be dropped via the dragAndDrop functionality as this feature will enable it automatically.
It uses the same syntax as the accept attributes
in input elements. If the configuration in audio also uses
the acceptedFormats property, it will override this one.
- Sample code
 - Full code
 
<deep-chat
  microphone='{
    "files": {
      "format": "mp3",
      "maxDurationSeconds": 10,
      "maxNumberOfFiles": 2,
      "acceptedFormats": ".mp3,.wav"
    }
  }'
></deep-chat>
<!-- This example is for Vanilla JS and should be tailored to your framework (see Examples) -->
<deep-chat
  microphone='{
    "files": {
      "format": "mp3",
      "maxDurationSeconds": 10,
      "maxNumberOfFiles": 2,
      "acceptedFormats": ".mp3,.wav"
    }
  }'
  demo="true"
  style="border-radius: 8px"
  introMessage='{"text": "Use the microphone button to record audio."}'
></deep-chat>
The use of this object will automatically disable the speechToText functionality.
AudioFormat
- Type: 
"mp3"|"4a"|"webm"|"mp4"|"mpga"|"wav"|"mpeg"|"m4a" 
Allowed audio file formats.