Files 

This card helps to get files or attachments from the visitor.

AttributeMandatoryDescriptionValues
typeYesThe type of input to be displayed to the visitorfile
minNoSpecify the minimum number of files to be attached.One is the minimum number of files to be uploaded.
maxNoSpecify the maximum number of files to be attached.Five is the maximum number of files that can be uploaded.
formatsNoSpecify the allowed file types  Supported file types: doc, txt, docx, pdf, html, js, css, ppt, pptx, xls, xlsx, jpg, jpeg, gif, mp3, mp4, 3gp, png, avi, aac, 3ga, amr, wav, bmp, zip, rar

Note: The maximum file size allowed is 10 MB.

 Channel compatibility and limitations

     

Pro Tip: Facebook Messenger, Instagram, WhatsApp, Telegram, and LINE channels do not support this card. However, you can handle it differently using the channel value in the visitor map

 

Output

The above is an example to get the files from the visitor.

Use case

Copied{
  "type": "file",
  "min": 1,
  "max": 5,
  "formats": [
    "doc",
    "txt",
    "docx",
    "pdf",
    "html",
    "js",
    "css",
    "ppt",
    "pptx",
    "xls",
    "xlsx",
    "jpg",
    "jpeg",
    "gif",
    "mp3",
    "mp4",
    "3gp",
    "png",
    "avi",
    "aac",
    "3ga",
    "amr",
    "wav",
    "bmp",
    "zip",
    "rar"
  ]
}
Copied// Context handler function 
result = Map();
response = Map();
response.put("action", "reply");
response.put("replies", ["Please upload any government authorized ID."]);
response.put("input", {
  "type": "file",
  "min": 1,
  "max": 5,
  "formats": [
    "doc",
    "txt",
    "docx",
    "pdf",
    "html",
    "js",
    "css",
    "ppt",
    "pptx",
    "xls",
    "xlsx",
    "jpg",
    "jpeg",
    "gif",
    "mp3",
    "mp4",
    "3gp",
    "png",
    "avi",
    "aac",
    "3ga",
    "amr",
    "wav",
    "bmp",
    "zip",
    "rar"
  ]
});
prompt = Map(); 
prompt.put("param_name", "reply"); 
prompt.put("data", response); 
result.put("prompt", prompt); 
result.put("todo", "prompt");
return result;

// Execution function
result = Map();
response = Map();
response.put("action", "reply");
response.put("replies", ["Please upload any government authorized ID."]);
response.put("input", {
  "type": "file",
  "min": 1,
  "max": 5,
  "formats": [
    "doc",
    "txt",
    "docx",
    "pdf",
    "html",
    "js",
    "css",
    "ppt",
    "pptx",
    "xls",
    "xlsx",
    "jpg",
    "jpeg",
    "gif",
    "mp3",
    "mp4",
    "3gp",
    "png",
    "avi",
    "aac",
    "3ga",
    "amr",
    "wav",
    "bmp",
    "zip",
    "rar"
  ]
});
result.put("data", response);
return result;
Copied{
  "type": "file",
  "min": 1,
  "max": 5,
  "formats": [
    "doc",
    "txt",
    "docx",
    "pdf",
    "html",
    "js",
    "css",
    "ppt",
    "pptx",
    "xls",
    "xlsx",
    "jpg",
    "jpeg",
    "gif",
    "mp3",
    "mp4",
    "3gp",
    "png",
    "avi",
    "aac",
    "3ga",
    "amr",
    "wav",
    "bmp",
    "zip",
    "rar"
  ]
}
Copied{
  "platform": "ZOHOSALESIQ",
  "action": "reply",
  "replies": [
    "Please upload any government authorized ID."
  ],
  "input": {
  "type": "file",
  "min": 1,
  "max": 5,
  "formats": [
    "doc",
    "txt",
    "docx",
    "pdf",
    "html",
    "js",
    "css",
    "ppt",
    "pptx",
    "xls",
    "xlsx",
    "jpg",
    "jpeg",
    "gif",
    "mp3",
    "mp4",
    "3gp",
    "png",
    "avi",
    "aac",
    "3ga",
    "amr",
    "wav",
    "bmp",
    "zip",
    "rar"
  ]
}
}
Copied"user_defined": {
  "zohosalesiq": {
    "action": "reply",
    "replies": [
      "Please upload any government authorized ID."
    ],
    "input": {
  "type": "file",
  "min": 1,
  "max": 5,
  "formats": [
    "doc",
    "txt",
    "docx",
    "pdf",
    "html",
    "js",
    "css",
    "ppt",
    "pptx",
    "xls",
    "xlsx",
    "jpg",
    "jpeg",
    "gif",
    "mp3",
    "mp4",
    "3gp",
    "png",
    "avi",
    "aac",
    "3ga",
    "amr",
    "wav",
    "bmp",
    "zip",
    "rar"
  ]
}
  }
}
Copied"channelData": {
  "zohosalesiq": {
    "action": "reply",
    "replies": [
      "Please upload any government authorized ID."
    ],
    "input": {
  "type": "file",
  "min": 1,
  "max": 5,
  "formats": [
    "doc",
    "txt",
    "docx",
    "pdf",
    "html",
    "js",
    "css",
    "ppt",
    "pptx",
    "xls",
    "xlsx",
    "jpg",
    "jpeg",
    "gif",
    "mp3",
    "mp4",
    "3gp",
    "png",
    "avi",
    "aac",
    "3ga",
    "amr",
    "wav",
    "bmp",
    "zip",
    "rar"
  ]
}
  }
}

Payload (Message object) when a file is uploaded:

Copied{
    "meta": {
        "card_data": {
            "type": "file",
            "value": "45d37e0b030bf84e851867fc89461bfe4dfdc6bd2b756c96e"
        },
        "version": "1"
    },
    "files": [
        "James doc.txt",
        "James ID proof.jpg"
    ],
    "text": "James doc.txt",
    "type": "files"
}