Skip to content

BinaryUpload

Element name: BinaryUpload

Category: Programing

Description: Basic functionality that consists of a configurable dialog box with a customizable name. It is oriented towards multimedia management in Lynn.

Funcionality: Allows uploading a file from an entity with binary data, which is available for presentation. It is oriented towards remote retrieval of binary files, which can be obtained through consumption of external APIs provided by third parties.

The upload limits must be taken into consideration. For channels such as WhatsApp, the maximum allowed size is 16 MB for any of its multimedia files.

Configuration fields of the action

[Name]: Unique descriptor of the configuration box for the purpose of identifying it in the flow.

General subset

  • [Entity with the binary file]: Name of the entity from where the base64 of the file to be uploaded will be obtained.

    -- See an example of a binary file Here

Suggestion: You can preview your base64 file using the following web tool Here

  • [Do you want the file to be displayed in the browser?]: If 'Yes' is selected, the file will be displayed in your current browser in a new tab. It is recommended to keep this value as 'Yes'. Otherwise, if 'No' is selected, the URL associated with the file will be downloaded to your local device without display. The presentation of images may vary depending on the channel and its capabilities.

  • [File extension entity]: This refers to the entity that contains the file extension type of the uploaded binary file, such as JPG, PNG, PDF.

  • [File extension name]: This refers to the entity that contains the file name, without the file extension.

--Example:

File name: ArchivoBinario.jpg What should be in the entity: ArchivoBinario

  • [Output URL entity]: defines the entity that will store the final path of the file previously uploaded through the binary.

  • [Error handler]: This refers to the intent to execute in case of an error, which can be selected from the drop-down list. If you cannot find your entity, remember to create it beforehand.

Examples of BinaryUpload implementation

Example:

  1. Five entities must be created:

    • base64 -> string
    • pdf -> string
    • nombreArchivo -> string
    • salidaBase64 -> string
    • archivoPDF -> string

-[Entity with the binary file]: ArchivoB --> Certificado Asistencia en Viajes.pdf (Base64)

-[Do you want the file to be displayed in the browser?]: YES

-[File extension entity]: EXT --> application/pdf

-[File extension name]: NombreCert --> Certificado Asistencia en Viajes

obj.respuesta.nombre

-- JS Code block input for obtaining data for entities:

try {
    var JsonResponse = GetEntityValue('archivoPDF'); 
    var base64 = '';
    var nombreArchivo = '';
    var obj = '';

    if(JsonResponse != null)
    {
      obj = JSON.parse(JsonResponse);

      base64 = obj.base64;
      nombreArchivo = obj.nombre;
    }

    SetEntityByName('base64', base64);
    SetEntityByName('nombreArchivo', nombreArchivo.replace('.pdf',''));
    SetEntityByName('pdf','application/pdf');

    JsonResponse = null;
    }catch (error) {
          InduceMessage('The value has not been found: '+ error, '', '', true, true);
  }
  1. Create the Binary Upload box with the following configuration:

  2. Entity with the binary file: base64

  3. Do you want the file to be displayed in the browser?: yes
  4. File extension entity (ex: image/jpeg): pdf
  5. File name entity (sin extensión de archivo): nombreArchivo --> "Certificado Asistencia en Viajes"
  6. Output URL entity: salidaBase64 -> image URL

Result:

Graphical user interface, Text, Application, Chat or Text message Automatically generated description

Keep in mind that the output result may vary as the values obtained from the API are different for each client.

Advanced functions: Undeclared.